A question about building in Visual Studio

Hello,
I’m trying to build KiCad’s source using Visual Studio 2022, and when I follow the directions in the manual to configure CMake I get the following problem:

  1. CMake Error at F:/vcpkg/scripts/buildsystems/vcpkg.cmake:858 (message):
    vcpkg install failed. See logs for more information:
    F:\kicadsor\kicad\build\x64-Debug\vcpkg-manifest-install.log F:/vcpkg/scripts/buildsystems/vcpkg.cmake 858

2.CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:129 (message):
Command failed: F:/kicadsor/kicad/build/x64-Debug/vcpkg_installed/x64-windows/tools/python3/python.exe -m pip install -r F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89. clean/requirements.txt
Working Directory: F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean
See logs for more information:
F:\vcpkg\buildtrees\wxpython\prepare-requirements–out.log
F:\vcpkg\buildtrees\wxpython\prepare-requirements–err.log F:\kicadsor\kicad\scripts/cmake/vcpkg_execute_build_process.cmake

EDIT: Using Windows 10 and Visual Studio Community 2022

Thanks

Did you check that log?

Yes,I have checked it,But I can’t upload it now, something in it like:

Command failed: F:/kicadsor/kicad/build/x64-Debug/vcpkg_installed/x64-windows/tools/python3/python.exe -m pip install -r F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean/requirements.txt
Working Directory: F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean

Sorry I don’t know the usage of python.exe like this.

Ah, so your second point in first post was from that file.

Then check these

This is the install.log

**Detecting compiler hash for triplet x64-windows…
– Automatically setting HTTP(S)_PROXY environment variables to “127.0.0.1:10809”.
The following packages will be built and installed:
wxpython[core]:x64-windows → 4.1.1#9 – C:\Users\86131\AppData\Local\vcpkg\registries\git-trees\193a218169b9447eb971c2118c3092b761a57514
Restored 0 package(s) from C:\Users\86131\AppData\Local\vcpkg\archives in 426.4 us. Use --debug to see more details.
Installing 1/1 wxpython:x64-windows…
Building wxpython[core]:x64-windows…
– Installing port from location: C:\Users\86131\AppData\Local\vcpkg\registries\git-trees\193a218169b9447eb971c2118c3092b761a57514
– Using cached wxWidgets-phoenix-7d45ee6abbbc284f34d2ff018c464b65774f4ff3.tar.gz.
– Cleaning sources at F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean. Use --editable to skip cleaning for the packages you specify.
– Extracting source F:/vcpkg/downloads/wxWidgets-phoenix-7d45ee6abbbc284f34d2ff018c464b65774f4ff3.tar.gz
– Using source at F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean
– Using cached wxWidgets-wxWidgets-7ad1bffa875f7a38db58b6069ea3ff0c49c211d2.tar.gz.
– Cleaning sources at F:/vcpkg/buildtrees/wxpython/src/0c49c211d2-fef4512db7.clean. Use --editable to skip cleaning for the packages you specify.
– Extracting source F:/vcpkg/downloads/wxWidgets-wxWidgets-7ad1bffa875f7a38db58b6069ea3ff0c49c211d2.tar.gz
– Using source at F:/vcpkg/buildtrees/wxpython/src/0c49c211d2-fef4512db7.clean
– Using cached msys-gzip-1.11-1-x86_64.pkg.tar.zst.
– Using cached msys-bash-5.1.008-1-x86_64.pkg.tar.zst.
– Using cached msys-diffutils-3.8-2-x86_64.pkg.tar.zst.
– Using cached msys-coreutils-8.32-2-x86_64.pkg.tar.zst.
– Using cached msys-grep-3.0-2-x86_64.pkg.tar.xz.
– Using cached msys-sed-4.8-2-x86_64.pkg.tar.zst.
– Using cached msys-libpcre-8.45-1-x86_64.pkg.tar.zst.
– Using cached msys-gawk-5.1.0-2-x86_64.pkg.tar.zst.
– Using cached msys-mpfr-4.1.0-1-x86_64.pkg.tar.zst.
– Using cached msys-gmp-6.2.1-1-x86_64.pkg.tar.zst.
– Using cached msys-libreadline-8.1.001-1-x86_64.pkg.tar.zst.
– Using cached msys-ncurses-6.2-2-x86_64.pkg.tar.zst.
– Using cached msys-pkg-config-0.29.2-4-x86_64.pkg.tar.zst.
– Using cached msys-make-4.3-3-x86_64.pkg.tar.zst.
– Using cached msys-libintl-0.21-1-x86_64.pkg.tar.zst.
– Using cached msys-libiconv-1.16-2-x86_64.pkg.tar.zst.
– Using cached msys-gcc-libs-11.2.0-3-x86_64.pkg.tar.zst.
– Using cached msys-msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst.
– Using msys root at F:/vcpkg/downloads/tools/msys2/79d5b6b790550399
– Found Python3: F:/kicadsor/kicad/build/x64-Debug/vcpkg_installed/x64-windows/tools/python3/python.exe (found version “3.9.10”) found components: Interpreter
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:129 (message):
Command failed: F:/kicadsor/kicad/build/x64-Debug/vcpkg_installed/x64-windows/tools/python3/python.exe -m pip install -r F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean/requirements.txt
Working Directory: F:/vcpkg/buildtrees/wxpython/src/65774f4ff3-9ce5a4ad89.clean
See logs for more information:
F:\vcpkg\buildtrees\wxpython\prepare-requirements–out.log
F:\vcpkg\buildtrees\wxpython\prepare-requirements–err.log

Call Stack (most recent call first):
C:/Users/86131/AppData/Local/vcpkg/registries/git-trees/193a218169b9447eb971c2118c3092b761a57514/portfile.cmake:48 (vcpkg_execute_build_process)
scripts/ports.cmake:147 (include)

error: building wxpython:x64-windows failed with: BUILD_FAILED
Please ensure you’re using the latest port files with git pull and vcpkg update.
Then check for known issues at:
Issues · microsoft/vcpkg · GitHub
You can submit a new issue at:
Sign in to GitHub · GitHub
Include ‘[wxpython] Build error’ in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
vcpkg-tool version: 2022-07-21-a0e87e227afb536c62188c11ad029954f28fdb22
vcpkg-scripts version: 0257395b0 2022-07-26 (25 hours ago)

You can also use the prefilled template from F:\kicadsor\kicad\build\x64-Debug\vcpkg_installed\vcpkg\issue_body.md.**

It said that:

Ignoring numpy: markers ‘python_version <= “2.7”’ don’t match your environment
Ignoring setuptools: markers ‘python_version < “3.0”’ don’t match your environment
Ignoring sphinx: markers ‘python_version < “3.0”’ don’t match your environment

and

ERROR: Could not install packages due to an OSError: Proxy URL had no scheme, should start with http:// or https://

Do I need to install an older version of python?

No, you don’t need to install any python. Vcpkg pulls it’s own.

Do you have internet connection through proxy? If yes, what kind of proxy socks/http/other? Is it setup through environment variable?

I am using socket proxy, just by V2rayN. I tried to close the agent just now, but it still didn’t work. When I tried to directly look up VCPKG’s library I found that it did not have WxPython in it, I thought the error I encountered might be related to this

I think I should delete wxPython in the JSON file of VCPKG

You shouldn’t delete anything, wxpython is not in main microsoft vcpkg repo but it’s in kicad’s ports: ports · main · KiCad / KiCad Packaging / kicad-vcpkg-registry · GitLab

This is not informative. Did the error message change? Did you restart visual studio after disabling proxy?

Yes, I restarted Visual Studio and had the same problem.
All I’m saying is that I can install WxPython myself instead of using VCPKG and put it where it belongs. Or disable wxPython functionality outright.

There’s a good chance it will not work. wxPython needs to be compiled with the same toolchain and against same build of wxWidgets it will be later used with. But you can try.

If you don’t need plugins or scripting this is an option.

Your real issue is not with kicad though. It’s with vcpkg not being able to use your proxy. I’m not familiar with v2ray but their website claims it supports http proxy mode. You can try that. Also depending on how proxy settings are implemented just restarting VS may not be enough and you need to restart your OS.

If nothing works you should open issue on vcpkg github, describe your situation and attach logs. They will be more able to help with the proxy issue.

1 Like

I did not find these lines of code in vcpkg.json in the source code I downloaded. If the problem is caused by this, I will try to do something about it tomorrow

{
  "name": "wxpython",
  "version-string": "4.1.1",
  "port-version": 9,
  "description": "Python library that allows creating wxWidget interfaces from python",
  "homepage": "https://github.com/wxWidgets/phoenix",
  "supports": "windows & !static & !arm64 & !uwp",
  "dependencies": [
    "wxwidgets",
    "python3"
  ]
}

After I put this folder in my vcpkg /port, Visual Studio successfully downloaded WxPython, but it had problems compiling

I did not know that my Python decodes files in GBK, the default should be UFT-8, I have not used Python

You should not have to manually put any folders anywhere. Kicad source code uses custom vcpkg registry which I linked above and automatically pulls the custom ports.

I would start from scratch with fresh kicad checkout, fresh vcpkg install and clean build directory, since you have gotten past the proxy issue.

Every time i had issues with python related stuff and win10 (when building from source with vcpkg), they got solved when removed every instance of my system’s python, just remove it from the PATH never helped me. One time though, system’s local settings got involved too, it wasn’t solved but the error message changed and helped me to further troubleshoot. But since some time now i have no trouble, so the start from scratch is a nice step before trying to “mess” with your system settings…

I tried to switch to another agent and undo what I had just done, and WxPython was successfully downloaded, but now I’m having this problem building WxPython


As far as I know, this problem is caused by the inconsistent encoding of the files, which can be solved by changing the.py files, but these files will be re-downloaded every time you reconfigure them

Indeed, this is the second time I’ve re-downloaded the source code, after a lot of problems with my haphazard actions. Maybe I should use Linux instead

Check your environment variables for anything python related and remove them. Build scripts should default to utf8.
If there are no environment variables then try to explicitly set PYTHONIOENCODING=utf8

Python, is about as portable and user friendly as a cinderblock wall eh?

Thank you very much, I have successfully built,I found this:


And I’m using the Chinese system. By changing the code page encoding format of Visual Studio, I was able to build successfully.

2 Likes