VCPKG causes configuration time to explode, despite each on their own not taking time, how to debug?

2 weeks ago 16
ARTICLE AD BOX

I'm on RHEL8, and a while back, I used to have no issues. At some point something about the system changed and I started having issues with slow CMake generation times, which eclipsed my compile times.

I've ran vcpkg by itself with a lot of dependencies, and it takes an expect and quick amount of time. I'm offline and all of my dependency downloads have been cached.

If I make a default project for C++ and CMake, and don't use a vcpkg.json, everything is quick. The moment I add an empty vcpkg.json, my configuration times jump to 60->100 seconds.

The fact that both pieces individually do not take time, but using both together do is super confusing. What is more, looking at resource monitor on linux I see no spikes in CPU usage. I've seen hints on google that this may be related to locks somehow, but I've seen zero explanation of how to solve the problem.

Here's my code, though I suspect this won't be reproducible, hence why I'm asking how to debug this myself, all I get is "Configuration done (60.0s)" in cmake with no explanation.

#CmakeLists.txt cmake_minimum_required(VERSION 3.25) project(test_cmake) set(CMAKE_CXX_STANDARD 20) add_executable(test_cmake main.cpp)

--

//main.cpp #include <iostream> int main() { std::cout << "Hello World" << std::endl; return 0; }

-- vcpkg.json

{ "name": "test-cmake", "version-string": "1.0.0", "dependencies": [ ], "builtin-baseline": "983621a75271456417e82fae3256de2999249f13" }

-- CMakePresets.json

{ "version": 3, "cmakeMinimumRequired": { "major": 3, "minor": 25, "patch": 0 }, { "name": "DebugTemplate", "displayName": "Debug Template", "description": "", "generator": "Ninja", "binaryDir": "${sourceDir}/cmake-build-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }, "hidden": true }, { "name": "LinuxDefault", "displayName": "Default Linux Config with hardware", "description": "", "inherits": "Default", "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "$env{WHERE_VCPKG_IS_INSTALLED}/scripts/buildsystems/vcpkg.cmake", "VCPKG_TARGET_TRIPLET": "x64-linux" }, "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" }, "hidden": true }, { "name": "LinuxDebug", "displayName": "Linux hardware Debug Config", "description": "", "inherits": [ "LinuxDefault", "DebugTemplate" ] } ] }

and the command that is run is:

/path_to_cmake/bin/cmake/linux/x64/bin/cmake -DCMAKE_BUILD_TYPE=Debug --preset LinuxDebug -S /path_to_project/test_cmake -B /path_to_project/test_cmake/cmake-build-debug -- Running vcpkg install All requested packages are currently installed. Total install time: 27.1 us -- Running vcpkg install - done -- Configuring done (60.0s) -- Generating done (0.0s) -- Build files have been written to: /path_to_project/test_cmake/cmake-build-debug [Finished]

How do I debug this? I've tried cmake --trace-expand, and I see all the calls, but it stops at "Total install time: 27.1 us" and then dumps out the rest of the text immediately after 60s, I can't tell what is actually taking all the time here.

Read Entire Article