为 Windows 构建旧版本 grpc C++ 静态库的问题

问题描述 投票:0回答:1

我正在尝试使用 vcpkg 为平台工具集 v141 构建 grpc C++ 静态库,但在构建依赖库 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:\Source\Repos\vcpkg\buildtrees\re2\config-x64-windows-dbg-CMakeCache.txt.log
      C:\Source\Repos\vcpkg\buildtrees\re2\config-x64-windows-rel-CMakeCache.txt.log
      C:\Source\Repos\vcpkg\buildtrees\re2\config-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

到目前为止我尝试过的:

  1. git checkout 8184c5e -- ports/ 用于端口 Abseil、grpc、openssl、protobuf、re2、upb、zlib、vcpkg-cmake、vcpkg-cmake-get-vars 和 vcpkg-cmake-config。原因是提交8184c5e包含与v141工具集匹配的最后一个版本,请参阅https://github.com/microsoft/vcpkg/blob/8184c5e06c6bbf0f9ba67ab9e9b8b5b5202d6c08/ports/abseil/vcpkg.jsonhttps://github。 com/abseil/abseil-cpp/blob/20230125.4/absl/base/policy_checks.h
  2. 更改了适当的三元组。我已经安装了VS2017和VS2022。
    set(VCPKG_PLATFORM_TOOLSET v141)
    set(VCPKG_TARGET_ARCHITECTURE x64)
    set(VCPKG_CRT_LINKAGE dynamic)
    set(VCPKG_LIBRARY_LINKAGE dynamic)
    
  3. 删除已安装的 vcpkg 文件夹、任何工件的软件包和下载并调用 。u000bcpkg 安装 grpc:x64-windows

在config-x64-windows-dbg-CMakeCache.txt.log中有例如v143 的变量

MAKECOMMAND
也引用
cmake.exe
,但我不知道这是否重要。但是,编译器和链接器适用于 v141。你能给我提示一下要寻找什么吗?

我还看到 ninja 包上有一些错误。我应该使用哪个版本?

UPD: config-x64-windows-out.log 包含对 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

在哪里可以编辑re2的CMakeList?

c++ visual-c++ grpc vcpkg re2
1个回答
0
投票

我通过使用另一个版本的 re2 软件包解决了这个问题,该软件包是为 v141 构建的,请参阅 https://github.com/microsoft/vcpkg/blob/2023.07.21/ports/re2/vcpkg.jsonhttps: //github.com/google/re2/blob/2023-02-01/CMakeLists.txt

git checkout 6b8fd05 -- ports/re2

但是,我在运行代码时仍然遇到问题,但这超出了这个问题的范围。

© www.soinside.com 2019 - 2024. All rights reserved.