I’m trying to build grpc C++ static lib using vcpkg for platform toolset v141, but get an error building a dependency lib re2:
Installing 8/11 re2:x64-windows@2023-07-01...
Building re2:x64-windows@2023-07-01...
-- Downloading https://github.com/google/re2/archive/2023-07-01.tar.gz -> google-re2-2023-07-01.tar.gz...
-- Extracting source C:/Source/Repos/vcpkg/downloads/google-re2-2023-07-01.tar.gz
-- Using source at C:/Source/Repos/vcpkg/buildtrees/re2/src/2023-07-01-5f6ab6c906.clean
-- Configuring x64-windows
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
Command failed: C:/Source/Repos/vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v
Working Directory: C:/Source/Repos/vcpkg/buildtrees/re2/x64-windows-rel/vcpkg-parallel-configure
Error code: 1
See logs for more information:
C:SourceReposvcpkgbuildtreesre2config-x64-windows-dbg-CMakeCache.txt.log
C:SourceReposvcpkgbuildtreesre2config-x64-windows-rel-CMakeCache.txt.log
C:SourceReposvcpkgbuildtreesre2config-x64-windows-out.log
Call Stack (most recent call first):
installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:252 (vcpkg_execute_required_process)
ports/re2/portfile.cmake:9 (vcpkg_cmake_configure)
scripts/ports.cmake:192 (include)
error: building re2:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle re2:x64-windows: 2.8 s
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+re2
You can submit a new issue at:
https://github.com/microsoft/vcpkg/issues/new?title=[re2]+Build+error+on+x64-windows&body=Copy+issue+body+from+C%3A%2FSource%2FRepos%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
What I tried so far:
- git checkout 8184c5e — ports/<port> for ports abseil, grpc, openssl, protobuf, re2, upb, zlib, vcpkg-cmake, vcpkg-cmake-get-vars and vcpkg-cmake-config. The reason is that commit 8184c5e contains the last version matching v141 toolset, see https://github.com/microsoft/vcpkg/blob/8184c5e06c6bbf0f9ba67ab9e9b8b5b5202d6c08/ports/abseil/vcpkg.json and https://github.com/abseil/abseil-cpp/blob/20230125.4/absl/base/policy_checks.h
- Changed appropriate triplets. I have both installed VS2017 and VS2022.
set(VCPKG_PLATFORM_TOOLSET v141) set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic)
- Remove vcpkg folders installed, packages and downloads for any artifacts and call .vcpkg install grpc:x64-windows
In config-x64-windows-dbg-CMakeCache.txt.log there are e.g. a variable MAKECOMMAND
referencing to cmake.exe
for v143 too, but I don’t know if this important. However, compiler and linker are for v141. Could you give me a hint what to look for?
Also I see some errors on ninja package. Which version should I use instead?
UPD: config-x64-windows-out.log contains a reference to VS2022 cmake:
[1/2] "C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe" -E chdir "../../x64-windows-dbg" "C:/Program Files/Microsoft Visual Studio/2022/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe" ...
-- The CXX compiler identification is MSVC 19.16.27051.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:40 (message):
you need Visual Studio 2019 or later
Where can I edit CMakeList of re2?
1
I solved this by using another version of re2 package, which was built for v141, see https://github.com/microsoft/vcpkg/blob/2023.07.21/ports/re2/vcpkg.json and https://github.com/google/re2/blob/2023-02-01/CMakeLists.txt i.e.
git checkout 6b8fd05 — ports/re2
However, I still have problems running my code, but it is out of the scope of this question.