c++cmakevcpkgninja

VCPKG conflicting messaging


Conflicting messaging concerning the existance of Ninja on my system.

I see that it exists/doesn't exist. Do you know what the cause of this is? Could it be a problem with my port file?

-- Found external ninja('1.10.2').
-- Configuring x64-win-llvm-static-md
-- Building x64-win-llvm-static-md-dbg
...
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[kassert]+Build+error+on+x64-mingw-static&body=Copy+issue+body+from+E%3A%2FProjects%2FVCPKG%2Fpackage_test%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

-- Running vcpkg install - failed
CMake Error at E:/Projects/VCPKG/vcpkg/scripts/buildsystems/vcpkg.cmake:902 (message):
  vcpkg install failed.  See logs for more information:
  E:\Projects\VCPKG\package_test\build\vcpkg-manifest-install.log
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:5 (project)


CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build 
tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

Solution

  • The final error where CMake is seemingly unable to find Ninja is a cascading error which happens when the vcpkg toolchain file is provided to CMake, and any vcpkg step fails. This in turn causes CMake's post-toolchain steps to fail, amongst which is setting up the build tool—in your case, Ninja.

    It is confusing, yes, and the real cause is usually listed further up in the vcpkg output.

    You've not posted the entirety of your output, but telltale lines are the following:

    You can submit a new issue at:
      https://github.com/microsoft/vcpkg/issues/new?title=[kassert]+Build+error+on+x64-mingw-static&body=Copy+issue+body+from+E%3A%2FProjects%2FVCPKG%2Fpackage_test%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md
    

    The port that failed to build is in square brackets in the URL above: [kassert]. Chances are you will be able to determine the nature of the build failure by inspecting the log files in $VCPKG_ROOT/buildtrees/kassert/*.log. I would personally start with install-x64-mingw-static-dbg-out.log in that directory.