如何在VCPKG(Windows)中设置mingw

发布于 2025-01-24 04:55:15 字数 4093 浏览 0 评论 0原文

我尝试从VCPKG安装MINGW软件包,但是我有一个错误

C:\Users\Administrator\Downloads\vcpkg>vcpkg.exe install curl:x64-mingw-static
Computing installation plan...
The following packages will be built and installed:
    curl[core,non-http,schannel,ssl,sspi]:x64-mingw-static -> 7.82.0
  * zlib[core]:x64-mingw-static -> 1.2.12
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-mingw-static...
Error: while detecting compiler information:
The log content at C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\stdout-x64-mingw-static.log is:
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:128 (message):
    Command failed: ninja -v
    Working Directory: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/vcpkg-parallel-configure
    Error code: 1
    See logs for more information:
      C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\config-x64-mingw-static-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:370 (vcpkg_execute_required_process)
  scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
  scripts/ports.cmake:145 (include)



Error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.

C:\Users\Administrator\Downloads\vcpkg>

如何修复? c:/mingw32 上安装了mingw

我在c:/mingw64-out.log

[1/1] cmd /c "cd .. && "C:/Users/Administrator/Downloads/vcpkg/downloads/tools/cmake-3.22.2-windows/cmake-3.22.2-windows-i386/bin/cmake.exe" "C:/Users/Administrator/Downloads/vcpkg/scripts/detect_compiler" "-DCMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows-static" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v143" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-DZ_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-D_VCPKG_INSTALLED_DIR=C:/Users/Administrator/Downloads/vcpkg/installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/Users/Administrator/Downloads/vcpkg/packages/detect_compiler_x64-windows-static""
-- The C compiler identification is MSVC 19.31.31107.0
-- The CXX compiler identification is MSVC 19.31.31107.0
#COMPILER_HASH#c3649029c7e070e5f43d9ce4d317605f000f9404
#COMPILER_C_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_C_VERSION#19.31.31107.0
#COMPILER_C_ID#MSVC
#COMPILER_CXX_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_CXX_VERSION#19.31.31107.0
#COMPILER_CXX_ID#MSVC
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_SHARED_LIBS
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_LIBDIR
    VCPKG_TARGET_ARCHITECTURE
    _VCPKG_ROOT_DIR


-- Build files have been written to: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-windows-static-rel

它看起来像检测Microsoft编译器,而不是mingw

I tried to install mingw package from vcpkg but I got an error

C:\Users\Administrator\Downloads\vcpkg>vcpkg.exe install curl:x64-mingw-static
Computing installation plan...
The following packages will be built and installed:
    curl[core,non-http,schannel,ssl,sspi]:x64-mingw-static -> 7.82.0
  * zlib[core]:x64-mingw-static -> 1.2.12
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-mingw-static...
Error: while detecting compiler information:
The log content at C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\stdout-x64-mingw-static.log is:
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:128 (message):
    Command failed: ninja -v
    Working Directory: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/vcpkg-parallel-configure
    Error code: 1
    See logs for more information:
      C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\config-x64-mingw-static-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:370 (vcpkg_execute_required_process)
  scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
  scripts/ports.cmake:145 (include)



Error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.

C:\Users\Administrator\Downloads\vcpkg>

How can I fix it? I have mingw installed on C:/mingw64 and C:/mingw32 and I'm using them in CLion without problems

Error in config-x64-mingw-static-out.log

[1/1] cmd /c "cd .. && "C:/Users/Administrator/Downloads/vcpkg/downloads/tools/cmake-3.22.2-windows/cmake-3.22.2-windows-i386/bin/cmake.exe" "C:/Users/Administrator/Downloads/vcpkg/scripts/detect_compiler" "-DCMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows-static" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v143" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-DZ_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-D_VCPKG_INSTALLED_DIR=C:/Users/Administrator/Downloads/vcpkg/installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/Users/Administrator/Downloads/vcpkg/packages/detect_compiler_x64-windows-static""
-- The C compiler identification is MSVC 19.31.31107.0
-- The CXX compiler identification is MSVC 19.31.31107.0
#COMPILER_HASH#c3649029c7e070e5f43d9ce4d317605f000f9404
#COMPILER_C_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_C_VERSION#19.31.31107.0
#COMPILER_C_ID#MSVC
#COMPILER_CXX_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_CXX_VERSION#19.31.31107.0
#COMPILER_CXX_ID#MSVC
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_SHARED_LIBS
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_LIBDIR
    VCPKG_TARGET_ARCHITECTURE
    _VCPKG_ROOT_DIR


-- Build files have been written to: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-windows-static-rel

It looks like it detects microsoft compiler instead of mingw

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ゝ杯具 2025-01-31 04:55:15

问题没有设置为路径中的gcc.exe,添加了解决问题

The problem was not set gcc.exe in PATH, adding it resolved problem

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文