无法使用 MinGW 编译器通过 vcpkg 安装库

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

我正在尝试使用 MinGW C++ 编译器

tbb
g++
包管理器在 Windows 上安装
vcpkg
库。但是,运行
.\vcpkg install tbb --triplet=x64-mingw-static --host-triplet=x64-mingw-static
会出现以下错误:

The C++ compiler "C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe" is not able to compile a simple test program.

有人知道如何解决这个问题吗?


GitHub 错误报告:https://github.com/microsoft/vcpkg/issues/40664


.\vcpkg --version
C:\Users\<user>\vcpkg
的输出为:

vcpkg package management program version 2024-08-01-fd884a0d390d12783076341bd43d77c3a6a15658

See LICENSE.txt for license information.

.\g++ --version
C:\msys64\mingw64\bin
的输出为:

g++ (Rev3, Built by MSYS2 project) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.\x86_64-w64-mingw32-g++.exe --version
C:\msys64\mingw64\bin
的输出为:

x86_64-w64-mingw32-g++.exe (Rev3, Built by MSYS2 project) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.\vcpkg install tbb --triplet=x64-mingw-static --host-triplet=x64-mingw-static
C:\Users\<user>\vcpkg
的输出为:

Computing installation plan...
The following packages will be built and installed:
    tbb:[email protected]
Detecting compiler hash for triplet x64-mingw-static...
Compiler found: C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe
Restored 0 package(s) from C:\Users\<user>\AppData\Local\vcpkg\archives in 226 us. Use --debug to see more details.
Installing 1/1 tbb:[email protected]...
Building tbb:[email protected]...
C:\Users\<user>\vcpkg\triplets\community\x64-mingw-static.cmake: info: loaded community triplet from here. Community triplets are not built in the curated registry and are thus less likely to succeed.
-- Using cached oneapi-src-oneTBB-v2021.13.0.tar.gz.
-- Cleaning sources at C:/Users/<user>/vcpkg/buildtrees/tbb/src/v2021.13.0-c5ed208c36.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/<user>/vcpkg/downloads/oneapi-src-oneTBB-v2021.13.0.tar.gz
-- Using source at C:/Users/<user>/vcpkg/buildtrees/tbb/src/v2021.13.0-c5ed208c36.clean
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
    Command failed: C:/Users/<user>/vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v
    Working Directory: C:/Users/<user>/vcpkg/buildtrees/tbb/x64-mingw-static-rel/vcpkg-parallel-configure
    Error code: 1
    See logs for more information:
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeCache.txt.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeCache.txt.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeConfigureLog.yaml.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeConfigureLog.yaml.log
      C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-out.log

Call Stack (most recent call first):
  installed/x64-mingw-static/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:269 (vcpkg_execute_required_process)
  ports/tbb/portfile.cmake:17 (vcpkg_cmake_configure)
  scripts/ports.cmake:192 (include)


error: building tbb:x64-mingw-static 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 tbb:x64-mingw-static: 6.3 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+tbb
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[tbb]+Build+error+on+x64-mingw-static&body=Copy+issue+body+from+C%3A%2FUsers%2F<user>%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md

以下是日志文件:

文件 粘贴Bin链接
C:/Users/<user>/vcpkg/installed/vcpkg/issue_body.md
https://pastebin.com/KGhPaR1r
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeConfigureLog.yaml.log
https://pastebin.com/CM3kysi8
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-rel-CMakeCache.txt.log
https://pastebin.com/bkJkstb2
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-out.log
https://pastebin.com/GkbrQwYs
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeConfigureLog.yaml.log
https://pastebin.com/UZDx7Wnt
C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-dbg-CMakeCache.txt.log
https://pastebin.com/qgDL3vJc

C:\Users\<user>\vcpkg\buildtrees\tbb\config-x64-mingw-static-out.log
的相关部分如下:

-- The CXX compiler identification is GNU 14.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:73 (message):
  The C++ compiler

    "C:/msys64/mingw64/bin/x86_64-w64-mingw32-g++.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'C:/Users/<user>/vcpkg/buildtrees/tbb/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-cvmmjb'
    
    Run Build Command(s): C:/Users/<user>/vcpkg/downloads/tools/ninja/1.10.2-windows/ninja.exe -v cmTC_ef730
    [1/2] C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe    -o CMakeFiles/cmTC_ef730.dir/testCXXCompiler.cxx.obj -c C:/Users/<user>/vcpkg/buildtrees/tbb/x64-mingw-static-rel/CMakeFiles/CMakeScratch/TryCompile-cvmmjb/testCXXCompiler.cxx
    [2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe   CMakeFiles/cmTC_ef730.dir/testCXXCompiler.cxx.obj -o cmTC_ef730.exe -Wl,--out-implib,libcmTC_ef730.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    FAILED: cmTC_ef730.exe 
    C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe   CMakeFiles/cmTC_ef730.dir/testCXXCompiler.cxx.obj -o cmTC_ef730.exe -Wl,--out-implib,libcmTC_ef730.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
    Das System kann den angegebenen Pfad nicht finden.
    ninja: build stopped: subcommand failed.

主要错误似乎是

Das System kann den angegebenen Pfad nicht finden.

字面意思是

The system cannot find the path specified.

但是,我不知道这是指哪条路径。如上所示,文件

C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe
确实存在。

c++ mingw tbb vcpkg
1个回答
0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.