Msvc/vcpkg changes

FWIW, MSVC was not open. When I opened it after the pull, it started doing a vcpkg install all right. But in the end there were those errors and 3 wx…315 files left in the …\build\x64-Debug\kicad directory. After cache reconfigure, kicad main windows came up all right but the symbols (eeschema, pcbnew) were missing.
Only after I did a 3rd run, everything worked.
So let’s R.I.P that.

It is a misconception to think programs are deterministic :slight_smile:

Hi, running all from scratch, stuck at step 2 from Windows (Visual Studio) | Developer Documentation | KiCad :

1157l

Severity	Code	Description	Project	File	Line	Suppression State
Error		CMake Error at C:/code/vcpkg/scripts/buildsystems/vcpkg.cmake:858 (message):
  vcpkg install failed.  See logs for more information:
  C:\code\kicad\build\x64-Debug\vcpkg-manifest-install.log		C:/code/vcpkg/scripts/buildsystems/vcpkg.cmake	858	
Severity	Code	Description	Project	File	Line	Suppression State
Error		CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:128 (message):
    Command failed: msbuild C:/code/vcpkg/buildtrees/python3/x64-windows-rel/v3.9.10-fb0723a25d.clean/PCbuild/pcbuild.proj /p:Configuration=Release /p:IncludeExtensions=true /p:IncludeExternals=true /p:IncludeCTypes=true /p:IncludeSSL=true /p:IncludeTkinter=false /p:IncludeTests=false /p:ForceImportBeforeCppTargets=C:/code/vcpkg/buildtrees/python3/src/v3.9.10-fb0723a25d.clean/PCbuild/python_vcpkg.props /p:IncludeUwp=false /p:_VcpkgPythonLinkage=DynamicLibrary /t:Rebuild /p:Platform=x64 /p:PlatformToolset=v143 /p:VCPkgLocalAppDataDisabled=true /p:UseIntelMKL=No /p:WindowsTargetPlatformVersion=10.0.19041.0 /p:VcpkgTriplet=x64-windows /p:VcpkgInstalledDir=C:/code/kicad/build/x64-Debug/vcpkg_installed /p:VcpkgManifestInstall=false /p:UseMultiToolTask=true /p:MultiProcMaxCount=5 /p:EnforceProcessCountAcrossBuilds=true /m:5
    Working Directory: C:/code/vcpkg/buildtrees/python3/x64-windows-rel/v3.9.10-fb0723a25d.clean
    Error code: 1
    See logs for more information:
      C:\code\vcpkg\buildtrees\python3\build-x64-windows-rel-out.log		C:\code\kicad\scripts/cmake/vcpkg_execute_required_process.cmake		

Last lines of “C:\code\vcpkg\buildtrees\python3\build-x64-windows-rel-out.log”:

       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pcbuild.proj" (Rebuild target) (1) ->
       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj" (Build target) (3:25) ->
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj(532,5): warning MSB3073: The command "git rev-parse --short HEAD > "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\obj\39amd64_Release\pythoncore\gitversion.txt"" exited with code 9009.


       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pcbuild.proj" (Rebuild target) (1) ->
       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj" (Build target) (3:25) ->
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj(533,5): warning MSB3073: The command "git describe --all --always --dirty > "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\obj\39amd64_Release\pythoncore\gittag.txt"" exited with code 9009.


       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pcbuild.proj" (Rebuild target) (1) ->
       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj" (Build target) (3:25) ->
       (_WarnAboutToolset target) -> 
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj(547,5): warning : Toolset v143 is not used for official builds. Your build may have errors or incompatibilities.


       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pcbuild.proj" (Rebuild target) (1) ->
       "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj" (Build target) (3:25) ->
       (ClCompile target) -> 
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PC\pyconfig.h(59,10): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj]
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PC\pyconfig.h(59,10): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj]
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PC\pyconfig.h(59,10): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj]
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PC\pyconfig.h(59,10): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj]
         C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PC\pyconfig.h(59,10): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\pythoncore.vcxproj]

    4 Warning(s)
    5 Error(s)

Time Elapsed 00:00:10.39

Last lines of “C:\code\kicad\build\x64-Debug\vcpkg-manifest-install.log”:

error: building python3: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:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+python3
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[python3]+Build+error
Include '[python3] 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-05-05-67e17c1782801cf481be9ac0b3765dff3e4bdeb8
    vcpkg-scripts version: a2d8a7cbb 2022-06-01 (17 hours ago)

There are no python.exe in the path (windows env var).

EDIT: Oh wait, I have python when running from cmd.exe, I will try to disable it (but this seems not to be an issue when reading this thread…)!

Edit #2: Nope, removing python entirely from env variables didn’t change anything. Issue still the same. IO.h not found. Found that IO.h inside C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\ added it to the path (h file is accessible from cmd.exe), but still the same. According to this: python - Cannot open include file: 'io.h': No such file or directory - Stack Overflow

Edit #3: Also added C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\Modules_decimal\libmpdec\ to the env variable, because it contains io.h, no success :smiley:

Edit #4: Also found that command git is not found in C:\code\vcpkg\buildtrees\python3\build-x64-windows-rel-out.log. Even it can be accessed from cmd.exe :confused:

Getting build info from git
         git name-rev --name-only HEAD > "C:\code\vcpkg\buildtrees\python3\x64-windows-rel\v3.9.10-fb0723a25d.clean\PCbuild\obj\39amd64_Release\pythoncore\gitbranch.txt"
         'git' is not recognized as an internal or external command,
         operable program or batch file.

Git also works in VStudio terminal:
0410X

Edit… Downloading portable git (Git - Downloading Package) and putting C:\code\PortableGit\bin\ to the path also did not made “git not recognized” to disappear from build-x64-windows-rel-out.log file…

Edit #5: installing python3 with vcpkg on windows 10 is failing with error "io.h" not found · Issue #7128 · microsoft/vcpkg · GitHub

As CMake likes to pick up tools from unrelated toolkits in PATH, the most robust way is to hardcode a proper PATH in CMakeSettings.json.

For VS Community 2022 version 17.2.1, x64:

  1. Open VS Developer command prompt:
    %comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64
  2. Execute echo %PATH%, copy the result into a text editor.
  3. Remove everything from that string that doesn’t belong to MS/Windows tools.
  4. Put it as a PATH environment variable to CMakeSettings.json.
  5. If python build doesn’t work, something like -DPYTHON_EXECUTABLE=${env.BuildDir}\\${name}\\vcpkg_installed\\x64-windows\\tools\\python3\\python.exe can be added to cmakeCommandArgs.
  6. Or, up/downgrade your system’s python to 3.9.10 (or whatever is in the logs).
  7. If KiCad build complains about not finding kernel32.lib or standard C++ library headers, add these to the environment variables configuration also:
      "LIB": "${env.LIB}",
      "LIBPATH": "${env.LIBPATH}",
      "INCLUDE": "${env.INCLUDE}",
My CMakeSettings.json
{
  "environments": [
    {
      "BuildDir": "${workspaceRoot}\\build",
      "InstallDir": "${workspaceRoot}\\build\\install"
    },
    {
      "environment": "vcpkg",
      "VcPkgDir": "S:/kicad-build/vcpkg",
      "PATH": "S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX64\\x64;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\VC\\VCPackages;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\bin\\Roslyn;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Team Tools\\Performance Tools\\x64;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Team Tools\\Performance Tools;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.7.2 Tools\\x64\\;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.19041.0\\\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\\\x64;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\\\MSBuild\\Current\\Bin\\amd64;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\;S:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\;C:\\WINDOWS;C:\\WINDOWS\\system32;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\",
      "LIB": "${env.LIB}",
      "LIBPATH": "${env.LIBPATH}",
      "INCLUDE": "${env.INCLUDE}"
    }
  ],
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64", "vcpkg" ],
      "buildRoot": "${env.BuildDir}\\${name}",
      "installRoot": "${env.InstallDir}\\${name}",
      "cmakeCommandArgs": "-DSWIG_EXECUTABLE=S:\\kicad-build\\swigwin-4.0.2\\swig.exe -DPYTHON_EXECUTABLE=${env.BuildDir}\\${name}\\vcpkg_installed\\x64-windows\\tools\\python3\\python.exe",
      "buildCommandArgs": "-v -j 4",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "KICAD_SPICE",
          "value": "OFF",
          "type": "STRING"
        },
        {
          "name": "KICAD_USE_OCC",
          "value": "ON",
          "type": "BOOL"
        },
        {
          "name": "KICAD_BUILD_QA_TESTS",
          "value": "False",
          "type": "BOOL"
        },
        {
          "name": "KICAD_WIN32_DPI_AWARE",
          "value": "ON",
          "type": "BOOL"
        }
      ],
      "cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
    },
    {
      "name": "x64-Release",
      "generator": "Ninja",
      "configurationType": "RelWithDebInfo",
      "inheritEnvironments": [ "msvc_x64_x64", "vcpkg" ],
      "buildRoot": "${env.BuildDir}\\${name}",
      "installRoot": "${env.InstallDir}\\${name}",
      "cmakeCommandArgs": "-DSWIG_EXECUTABLE=S:\\kicad-build\\swigwin-4.0.2\\swig.exe -DPYTHON_EXECUTABLE=${env.BuildDir}\\${name}\\vcpkg_installed\\x64-windows\\tools\\python3\\python.exe",
      "buildCommandArgs": "-v -j 4",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "KICAD_SPICE",
          "value": "OFF",
          "type": "STRING"
        },
        {
          "name": "KICAD_USE_OCC",
          "value": "ON",
          "type": "BOOL"
        },
        {
          "name": "KICAD_BUILD_QA_TESTS",
          "value": "False",
          "type": "BOOL"
        },
        {
          "name": "KICAD_WIN32_DPI_AWARE",
          "value": "ON",
          "type": "BOOL"
        }
      ],
      "cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
    }
  ]
}

Sure, there must be a better way…


Edit:

So I ended up with overriding PATH, LIB, LIBPATH, INCLUDE variables in CMakeSettings.json. Setting PYTHON_EXECUTABLE is not necessary now.

These lines didn’t do anything, they only helped me to notice the Provided 'inheritEnvironments' doesn't provide the necessary environment variables error:

      "LIB": "${env.LIB}",
      "LIBPATH": "${env.LIBPATH}",
      "INCLUDE": "${env.INCLUDE}",

Here’s how my CMakeSettings.json looks like now:

Click to expand

{
  "environments": [
    {
      "BuildDir": "${workspaceRoot}\\build",
      "InstallDir": "${workspaceRoot}\\build\\install"
    },
    {
      "environment": "vcpkg",
      "VcPkgDir": "C:/kicad-build/vcpkg",
      "PATH": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX64\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\VC\\VCPackages;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\bin\\Roslyn;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Team Tools\\Performance Tools\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Team Tools\\Performance Tools;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.7.2 Tools\\x64\\;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.19041.0\\\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\\\MSBuild\\Current\\Bin\\amd64;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\;C:\\WINDOWS;C:\\WINDOWS\\system32;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\",
      "LIB": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\lib\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\lib\\x64;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.7.2\\lib\\um\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\\\lib\\10.0.19041.0\\\\um\\x64",
      "LIBPATH": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\lib\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\lib\\x64;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\lib\\x86\\store\\references;C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.19041.0;C:\\Program Files (x86)\\Windows Kits\\10\\References\\10.0.19041.0;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319",
      "INCLUDE": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\include;C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\include;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.7.2\\include\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\um;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\cppwinrt"
    }
  ],
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64", "vcpkg" ],
      "buildRoot": "${env.BuildDir}\\${name}",
      "installRoot": "${env.InstallDir}\\${name}",
      "cmakeCommandArgs": "-DSWIG_EXECUTABLE=C:\\kicad-build\\swigwin-4.0.2\\swig.exe",
      "buildCommandArgs": "-v -j 4",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "KICAD_SPICE",
          "value": "OFF",
          "type": "STRING"
        },
        {
          "name": "KICAD_USE_OCC",
          "value": "ON",
          "type": "BOOL"
        },
        {
          "name": "KICAD_BUILD_QA_TESTS",
          "value": "OFF",
          "type": "BOOL"
        },
        {
          "name": "KICAD_WIN32_DPI_AWARE",
          "value": "ON",
          "type": "BOOL"
        }
      ],
      "cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
    },
    {
      "name": "x64-Release",
      "generator": "Ninja",
      "configurationType": "RelWithDebInfo",
      "inheritEnvironments": [ "msvc_x64_x64", "vcpkg" ],
      "buildRoot": "${env.BuildDir}\\${name}",
      "installRoot": "${env.InstallDir}\\${name}",
      "cmakeCommandArgs": "-DSWIG_EXECUTABLE=C:\\kicad-build\\swigwin-4.0.2\\swig.exe",
      "buildCommandArgs": "-v -j 4",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "KICAD_SPICE",
          "value": "OFF",
          "type": "STRING"
        },
        {
          "name": "KICAD_USE_OCC",
          "value": "ON",
          "type": "BOOL"
        },
        {
          "name": "KICAD_BUILD_QA_TESTS",
          "value": "OFF",
          "type": "BOOL"
        },
        {
          "name": "KICAD_WIN32_DPI_AWARE",
          "value": "ON",
          "type": "BOOL"
        }
      ],
      "cmakeToolchain": "${env.VcPkgDir}/scripts/buildsystems/vcpkg.cmake"
    }
  ]
}

1 Like

I’m confused, are you still having python build issues because that should have been resolved?

FYI, within the vcpkg environment, the vcpkg tooling is prepended to PATH already.

If KiCad build complains about not finding kernel32.lib or standard C++ library headers, add these to the environment variables configuration also:

But you just yo dawged it…it does nothing different. You are asking it to set the environment variable in invocation to cmake to the existing environment variable that VS would have passed anyway as a child process by default

That post is a summary of what I’ve had to do (the python build was some time ago).
If the python compilation process was improved, that’s good, disregard the python parts.

I had QT, WinAVR, GNU Tools ARM Embedded, CMake, probably GnuWin32 in PATH, so seems like prepending wasn’t enough (and removing some of these from system PATH would break other tools).

Well, for me, without these, the KiCad build fails somehow.

You don’t happen to have msys2 or cygwin on your PATH do you? If MSVC or anything ends up detecting the linuxish versions of cmake.exe instead of a true native cmake, it may do strange things. That’s the only thing I can think of.

In the CMake configuration log pane that VS has, you can see what it invokves near the top

1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G

You can also use "cmakeExecutable" in CMakeSettings.json to force a cmake.exe selection

1 Like

I don’t. But the official CMake installation comes before Microsoft’s CMake in PATH.

I would still check what MSVC is invoking like I noted

Well, with the path overridden, of course it uses VS’s cmake. Without, I don’t remember. I can try different configurations when it’s time to rebuild KiCad, but I don’t necessarily want to rebuild dependencies.

So after updating VS, renaming these env variables overrides, cleaning vcpkg caches and rebuilding dependencies, I get this:

CMake Log
1> S:\kicad-build\kicad\CMakeSettings.json: Warning: Failed to evaluate '${env.LIB}' in '0'
S:\kicad-build\kicad\CMakeSettings.json: Warning: Failed to evaluate '${env.LIBPATH}' in '0'
S:\kicad-build\kicad\CMakeSettings.json: Warning: Failed to evaluate '${env.INCLUDE}' in '0'
Provided 'inheritEnvironments' doesn't provide the necessary environment variables needed to set the context for the configuration x64-Release. You can work around this by adding the necessary environment variables such as INCLUDE, LIBPATH, PATH and others to an environment block in your CMakeSettings.json.

1> CMake generation started for configuration: 'x64-Release'.
1> Environment settings:
1>     BuildDir=S:\kicad-build\kicad\build
1>     InstallDir=S:\kicad-build\kicad\build\install
1>     VcPkgDir=S:/kicad-build/vcpkg
1>     PATH_=S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX64\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\VCPackages;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;S:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\bin\Roslyn;S:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\\x64;C:\Program Files (x86)\Windows Kits\10\bin\\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
1>     LIB_=${env.LIB}
1>     LIBPATH_=${env.LIBPATH}
1>     INCLUDE_=${env.INCLUDE}
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="S:\kicad-build\kicad\build\install\x64-Release" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="S:/kicad-build/vcpkg/scripts/buildsystems/vcpkg.cmake" -DKICAD_SPICE:STRING="OFF" -DKICAD_USE_OCC:BOOL="ON" -DKICAD_BUILD_QA_TESTS:BOOL="OFF" -DKICAD_WIN32_DPI_AWARE:BOOL="ON" -DSWIG_EXECUTABLE=S:\kicad-build\swigwin-4.0.2\swig.exe -DCMAKE_MAKE_PROGRAM="S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "S:\kicad-build\kicad" 2>&1"
1> Working directory: S:\kicad-build\kicad\build\x64-Release
1> [CMake] -- Running vcpkg install
1> [CMake] Detecting compiler hash for triplet x64-windows...
1> [CMake] All requested packages are currently installed.
1> [CMake] Restored 0 packages from C:\Users\Alex\AppData\Local\vcpkg\archives in 568.4 us. Use --debug to see more details.
1> [CMake] 
1> [CMake] Total elapsed time: 38.91 s
1> [CMake] 
1> [CMake] The package openssl is compatible with built-in CMake targets:
1> [CMake] 
1> [CMake]     find_package(OpenSSL REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
1> [CMake] 
1> [CMake] The package python3 is compatible with built-in CMake targets:
1> [CMake] 
1> [CMake]     find_package(Python3 COMPONENTS Development REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE Python3::Python)
1> [CMake] 
1> [CMake] curl provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(CURL CONFIG REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE CURL::libcurl)
1> [CMake] 
1> [CMake] The package glew is compatible with built-in CMake targets:
1> [CMake] 
1> [CMake]     find_package(GLEW REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE GLEW::GLEW)
1> [CMake] 
1> [CMake] glm provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(glm CONFIG REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE glm::glm)
1> [CMake] 
1> [CMake] harfbuzz provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(harfbuzz CONFIG REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE harfbuzz harfbuzz::harfbuzz)
1> [CMake] 
1> [CMake] opencascade provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(OpenCASCADE CONFIG REQUIRED)
1> [CMake]     # note: 45 additional targets are not displayed.    target_link_libraries(main PRIVATE TKBO TKBin TKCAF TKCDF)
1> [CMake] 
1> [CMake] The package wxwidgets provides CMake integration:
1> [CMake] 
1> [CMake]     find_package(wxWidgets REQUIRED)
1> [CMake]     target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$<CONFIG:DEBUG>:${wxWidgets_DEFINITIONS_DEBUG}>")
1> [CMake]     target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS})
1> [CMake]     target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})
1> [CMake] 
1> [CMake] -- Running vcpkg install - done
1> [CMake] -- The C compiler identification is unknown
1> [CMake] -- The CXX compiler identification is unknown
1> [CMake] CMake Error at S:\kicad-build\kicad\CMakeLists.txt:34 (project):
1> [CMake]   No CMAKE_C_COMPILER could be found.
1> [CMake] 
1> [CMake]   Tell CMake where to find the compiler by setting either the environment
1> [CMake]   variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
1> [CMake]   the compiler, or to the compiler name if it is in the PATH.
1> [CMake] 
1> [CMake] 
1> [CMake] CMake Error at S:\kicad-build\kicad\CMakeLists.txt:34 (project):
1> [CMake]   No CMAKE_CXX_COMPILER could be found.
1> [CMake] 
1> [CMake]   Tell CMake where to find the compiler by setting either the environment
1> [CMake]   variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
1> [CMake]   to the compiler, or to the compiler name if it is in the PATH.
1> [CMake] 
1> [CMake] 
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "S:/kicad-build/kicad/build/x64-Release/CMakeFiles/CMakeOutput.log".
1> [CMake] See also "S:/kicad-build/kicad/build/x64-Release/CMakeFiles/CMakeError.log".
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="S:\kicad-build\kicad\build\install\x64-Release" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="S:/kicad-build/vcpkg/scripts/buildsystems/vcpkg.cmake" -DKICAD_SPICE:STRING="OFF" -DKICAD_USE_OCC:BOOL="ON" -DKICAD_BUILD_QA_TESTS:BOOL="OFF" -DKICAD_WIN32_DPI_AWARE:BOOL="ON" -DSWIG_EXECUTABLE=S:\kicad-build\swigwin-4.0.2\swig.exe -DCMAKE_MAKE_PROGRAM="S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "S:\kicad-build\kicad" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="S:\kicad-build\kicad\build\install\x64-Release" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="S:/kicad-build/vcpkg/scripts/buildsystems/vcpkg.cmake" -DKICAD_SPICE:STRING="OFF" -DKICAD_USE_OCC:BOOL="ON" -DKICAD_BUILD_QA_TESTS:BOOL="OFF" -DKICAD_WIN32_DPI_AWARE:BOOL="ON" -DSWIG_EXECUTABLE=S:\kicad-build\swigwin-4.0.2\swig.exe -DCMAKE_MAKE_PROGRAM="S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "S:\kicad-build\kicad" 2>&1"' returned with exit code: 1'.



Why does it do this?

S:\kicad-build\kicad\CMakeSettings.json: Warning: Failed to evaluate '${env.LIB}' in '0'
S:\kicad-build\kicad\CMakeSettings.json: Warning: Failed to evaluate '${env.LIBPATH}' in '0'
S:\kicad-build\kicad\CMakeSettings.json: Warning: Failed to evaluate '${env.INCLUDE}' in '0'
Provided 'inheritEnvironments' doesn't provide the necessary environment variables needed to set the context for the configuration x64-Release. You can work around this by adding the necessary environment variables such as INCLUDE, LIBPATH, PATH and others to an environment block in your CMakeSettings.json.

If I restart VS a couple times, that VS bug disappears for the run, thanks MS!

But then I get this:

CMake log
1> CMake generation started for configuration: 'x64-Release'.
1> Environment settings:
1>     BuildDir=S:\kicad-build\kicad\build
1>     InstallDir=S:\kicad-build\kicad\build\install
1>     VcPkgDir=S:/kicad-build/vcpkg
1>     PATH_=S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX64\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\VCPackages;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;S:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\bin\Roslyn;S:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\\x64;C:\Program Files (x86)\Windows Kits\10\bin\\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\;S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
1>     LIB_=S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\lib\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.19041.0\\um\x64
1>     LIBPATH_=S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\lib\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\lib\x64;S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.19041.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.19041.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
1>     INCLUDE_=S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include;S:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="S:\kicad-build\kicad\build\install\x64-Release" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="S:/kicad-build/vcpkg/scripts/buildsystems/vcpkg.cmake" -DKICAD_SPICE:STRING="OFF" -DKICAD_USE_OCC:BOOL="ON" -DKICAD_BUILD_QA_TESTS:BOOL="OFF" -DKICAD_WIN32_DPI_AWARE:BOOL="ON" -DCMAKE_C_COMPILER:FILEPATH="S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" -DSWIG_EXECUTABLE=S:\kicad-build\swigwin-4.0.2\swig.exe -DCMAKE_MAKE_PROGRAM="S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "S:\kicad-build\kicad" 2>&1"
1> Working directory: S:\kicad-build\kicad\build\x64-Release
1> [CMake] -- Running vcpkg install
1> [CMake] Detecting compiler hash for triplet x64-windows...
1> [CMake] All requested packages are currently installed.
1> [CMake] Restored 0 packages from C:\Users\Alex\AppData\Local\vcpkg\archives in 994.9 us. Use --debug to see more details.
1> [CMake] 
1> [CMake] Total elapsed time: 27.84 s
1> [CMake] 
1> [CMake] The package openssl is compatible with built-in CMake targets:
1> [CMake] 
1> [CMake]     find_package(OpenSSL REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
1> [CMake] 
1> [CMake] The package python3 is compatible with built-in CMake targets:
1> [CMake] 
1> [CMake]     find_package(Python3 COMPONENTS Development REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE Python3::Python)
1> [CMake] 
1> [CMake] curl provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(CURL CONFIG REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE CURL::libcurl)
1> [CMake] 
1> [CMake] The package glew is compatible with built-in CMake targets:
1> [CMake] 
1> [CMake]     find_package(GLEW REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE GLEW::GLEW)
1> [CMake] 
1> [CMake] glm provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(glm CONFIG REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE glm::glm)
1> [CMake] 
1> [CMake] harfbuzz provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(harfbuzz CONFIG REQUIRED)
1> [CMake]     target_link_libraries(main PRIVATE harfbuzz harfbuzz::harfbuzz)
1> [CMake] 
1> [CMake] opencascade provides CMake targets:
1> [CMake]     # this is heuristically generated, and may not be correct
1> [CMake]     find_package(OpenCASCADE CONFIG REQUIRED)
1> [CMake]     # note: 45 additional targets are not displayed.    target_link_libraries(main PRIVATE TKBO TKBin TKCAF TKCDF)
1> [CMake] 
1> [CMake] The package wxwidgets provides CMake integration:
1> [CMake] 
1> [CMake]     find_package(wxWidgets REQUIRED)
1> [CMake]     target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$<CONFIG:DEBUG>:${wxWidgets_DEFINITIONS_DEBUG}>")
1> [CMake]     target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS})
1> [CMake]     target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})
1> [CMake] 
1> [CMake] -- Running vcpkg install - done
1> [CMake] -- The C compiler identification is MSVC 19.32.31329.0
1> [CMake] -- The CXX compiler identification is MSVC 19.32.31329.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - failed
1> [CMake] -- Check for working C compiler: S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe
1> [CMake] -- Check for working C compiler: S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - broken
1> [CMake] CMake Error at S:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
1> [CMake]   The C compiler
1> [CMake] 
1> [CMake]     "S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe"
1> [CMake] 
1> [CMake]   is not able to compile a simple test program.
1> [CMake] 
1> [CMake]   It fails with the following output:
1> [CMake] 
1> [CMake]     Change Dir: S:/kicad-build/kicad/build/x64-Release/CMakeFiles/CMakeTmp
1> [CMake]     
1> [CMake]     Run Build Command(s):S:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_9e28a && [1/2] Building C object CMakeFiles\cmTC_9e28a.dir\testCCompiler.c.obj
1> [CMake]     [2/2] Linking C executable cmTC_9e28a.exe
1> [CMake]     FAILED: cmTC_9e28a.exe 
1> [CMake]     cmd.exe /C "cd . && "S:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_9e28a.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\GNUTOO~1\5F17D~1.220\ARM-NO~1\bin\ld.exe /nologo CMakeFiles\cmTC_9e28a.dir\testCCompiler.c.obj  /out:cmTC_9e28a.exe /implib:cmTC_9e28a.lib /pdb:cmTC_9e28a.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D S:\kicad-build\kicad\build\x64-Release\CMakeFiles\CMakeTmp && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file S:/kicad-build/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary S:/kicad-build/kicad/build/x64-Release/CMakeFiles/CMakeTmp/cmTC_9e28a.exe -installedDir S:/kicad-build/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
1> [CMake]     LINK Pass 1: command "C:\PROGRA~2\GNUTOO~1\5F17D~1.220\ARM-NO~1\bin\ld.exe /nologo CMakeFiles\cmTC_9e28a.dir\testCCompiler.c.obj /out:cmTC_9e28a.exe /implib:cmTC_9e28a.lib /pdb:cmTC_9e28a.pdb /version:0.0 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_9e28a.dir/intermediate.manifest CMakeFiles\cmTC_9e28a.dir/manifest.res" failed (exit code 1) with the following output:
1> [CMake]     C:\PROGRA~2\GNUTOO~1\5F17D~1.220\ARM-NO~1\bin\ld.exe: cannot find /nologo: No such file or directory
1> [CMake]     CMakeFiles\cmTC_9e28a.dir\testCCompiler.c.obj: file not recognized: File format not recognized
1> [CMake]     ninja: build stopped: subcommand failed.
1> [CMake]     
1> [CMake]     
1> [CMake] 
1> [CMake]   
1> [CMake] 
1> [CMake]   CMake will not be able to correctly generate this project.
1> [CMake] Call Stack (most recent call first):
1> [CMake]   CMakeLists.txt:34 (project)
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "S:/kicad-build/kicad/build/x64-Release/CMakeFiles/CMakeOutput.log".
1> [CMake] See also "S:/kicad-build/kicad/build/x64-Release/CMakeFiles/CMakeError.log".
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="S:\kicad-build\kicad\build\install\x64-Release" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="S:/kicad-build/vcpkg/scripts/buildsystems/vcpkg.cmake" -DKICAD_SPICE:STRING="OFF" -DKICAD_USE_OCC:BOOL="ON" -DKICAD_BUILD_QA_TESTS:BOOL="OFF" -DKICAD_WIN32_DPI_AWARE:BOOL="ON" -DCMAKE_C_COMPILER:FILEPATH="S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" -DSWIG_EXECUTABLE=S:\kicad-build\swigwin-4.0.2\swig.exe -DCMAKE_MAKE_PROGRAM="S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "S:\kicad-build\kicad" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="S:\kicad-build\kicad\build\install\x64-Release" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="S:/kicad-build/vcpkg/scripts/buildsystems/vcpkg.cmake" -DKICAD_SPICE:STRING="OFF" -DKICAD_USE_OCC:BOOL="ON" -DKICAD_BUILD_QA_TESTS:BOOL="OFF" -DKICAD_WIN32_DPI_AWARE:BOOL="ON" -DCMAKE_C_COMPILER:FILEPATH="S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="S:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" -DSWIG_EXECUTABLE=S:\kicad-build\swigwin-4.0.2\swig.exe -DCMAKE_MAKE_PROGRAM="S:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "S:\kicad-build\kicad" 2>&1"' returned with exit code: 1'.

1> [CMake]     C:\PROGRA~2\GNUTOO~1\5F17D~1.220\ARM-NO~1\bin\ld.exe: cannot find /nologo: No such file or directory
1> [CMake]     CMakeFiles\cmTC_9e28a.dir\testCCompiler.c.obj: file not recognized: File format not recognized
1> [CMake]     ninja: build stopped: subcommand failed.

This is a linker tool from GNU Tools ARM Embedded. Why CMake decided to use that?

Use Delete Cache and Reconfigure, potentially just bad runs before you adjusted the variable put the cmakecache in a weird state.

But it’s apparently something that pops up in the wild as a bug in cmake. Probably having cygwin or mingw in your PATH or even some sort of global environment variable like MSYS triggers an alternate code path in cmake .

This is slightly OT, but where should I put the dictionary files (.mo) if I want to run MSVC build of KiCad from within Visual Studio?

My problem disappeared after when retrying building after one month and taken these steps:

  1. Update Visual studio;
  2. Refresh sources from gitlab;
  3. Refresh vcpkg, also deleted vcpkg folder from %appdata% dir;
  4. Commenting-out almost all windows environment variables, system wide and user wide. I probably had this dir in my path: C:\msys64\usr\bin, which caused the problem;

Now KiCad builds, but has no icons:
image


Edit: Just copied images.tar.gz from nightly installation folder to C:\code\kicad\build\x64-Debug\resources\images.tar.gz. Cannot afford rebuilding anything, cmake cache generation takes over 20 hours in my pc :D. Related: Linux build with installation prefix can't find icons (#9287) · Issues · KiCad / KiCad Source Code / kicad · GitLab, kicad: icons replaced with question marks (#8236) · Issues · KiCad / KiCad Source Code / kicad · GitLab

It should be cached in AppData, i.e. every time vcpkg determines a need for rebuild, it stores archive copies of the binaries in a cache. If you Delete and Reconfigure, it extracts from the cache.

The only note btw, if you upgrade MSVC even for a patch version i.e. 19.6.1 to 19.6.2, if the C++ compiler version changes, then a recompile of dependencies gets triggered as its considered an ABI change.

For images.tar.gz, review the build log to see if this appears
cmd.exe /C "cd /D E:\kicad\kicad\bitmaps_png\png && C:\Windows\System32\tar.exe cfz E:/kicad/kicad/build/x64-Debug/resources/images.tar.gz ."

It should already be creating the archive when it detects a change.

Nope, I have searched whole 713 ines of log file for images.tar.gz or tar.exe - such call is not existing. these where exact steps:

  1. Project → Delete cache and Reconfigure;
  2. After Generation is finished: Select build target as eeschema.exe (eeschema/eeschema.exe) in VS toolbar, and click to build it;
  3. Got ~750 lines in output log. I did not caught several last ones, as the log vanished after executable was started by VS;

Try building the whole solution rather than the building the target only.

1 Like

Yeah, the images archive is generated as part of a different target.

1 Like

This is my personal experience in building:
I have two PCs. On the first PC, cmake generation somehow passed by by doing:

After a month, I did try the same procedure on 2nd PC, and without success (there were some commits made to cmake part of sources, if not mistaken (2022-July end). Cmake generation finished only after such hard workaround:

  1. Transfer whole 25 Gigs of build folder, containing kicad sources (excluding kicad\build subdir) + vcpkg folder to 2nd pc (at the same hdd folder destination):
    5541B

  2. Copy paste vcpkg folder from 1st pc’s %appdata% folder to 2nd;

  3. Again, commenting out almost every env variable from OS, and cmake generation finished.

I did not ever ran clone vcpkg, bootstrap on the 2nd pc, and I naively believe that is the key to success (I also don’t understand what these steps do, sorry :blush: ).

Now I have the only annoying problem: I have to comment out msys from the path before every launch of VS, and de-comment after launch (this way I can use git from msys during VS session). Forgetting to comment msys env variable before VS start will cause cmake generation error (dod not saved a screenshot) and the only fix later is to “Delete cache and reconfigure”.

Random tidbit I don’t know where else to shove.

The latest update to 3.9.14 as the python distribution I fixed the missing python3.dll which some pip packages may want to use and had issues with. python3.dll is this weirdo redirect wrapper that only exists on windows that points to python39.dll. Only on Windows does python’s documentation tell libraries to link to it and at the same time 90% of libraries don’t use it because it only exists on Windows for some perverse reason I haven’t figured out, but that’s python in a nutshell.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.