首页 > 解决方案 > 我该如何解决这个与使用 VCPKG 安装 GMP 相关的问题?

问题描述

当我尝试使用 VCPKG for Visual Studio 安装 GMP 时,它给了我这个错误:

    ./vcpkg install gmp
Computing installation plan...
The following packages will be built and installed:
    gmp[core]:x86-windows
Detecting compiler hash for triplet x86-windows...
Starting package 1/1: gmp:x86-windows
Building package gmp[core]:x86-windows...
Could not locate cached archive: C:\Users\utente\AppData\Local\vcpkg\archives\ae\aee4cb498b812554294e4bbc47b9469351282935.zip
-- Using cached C:/Users/utente/Documents/Visual Studio 2019/vcpkg/downloads/ShiftMediaProject-gmp-e140dfc8668e96d7e56cbd46467945adcc6b3cc4.tar.gz
-- Cleaning sources at C:/Users/utente/Documents/Visual Studio 2019/vcpkg/buildtrees/gmp/src/adcc6b3cc4-2b6258d695.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/utente/Documents/Visual Studio 2019/vcpkg/downloads/ShiftMediaProject-gmp-e140dfc8668e96d7e56cbd46467945adcc6b3cc4.tar.gz
-- Applying patch vs.build.patch
-- Applying patch runtime.patch
-- Applying patch prefix.patch
-- Using source at C:/Users/utente/Documents/Visual Studio 2019/vcpkg/buildtrees/gmp/src/adcc6b3cc4-2b6258d695.clean
-- Building SMP/libgmp.sln for Release
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:72 (message):
    Command failed: msbuild "C:/Users/utente/Documents/Visual Studio 2019/vcpkg/buildtrees/gmp/x86-windows-rel/adcc6b3cc4-2b6258d695.clean/SMP/libgmp.sln" /p:Configuration=ReleaseDLL /p:UseEnv=True /t:Rebuild /p:Platform=x86 /p:PlatformToolset=v142 /p:VCPkgLocalAppDataDisabled=true /p:UseIntelMKL=No /p:WindowsTargetPlatformVersion=10.0.18362.0 /p:VcpkgTriplet=x86-windows "/p:VcpkgCurrentInstalledDir=C:/Users/utente/Documents/Visual Studio 2019/vcpkg/installed/x86-windows" /p:VcpkgManifestInstall=false /m "/p:ForceImportBeforeCppTargets=C:/Users/utente/Documents/Visual Studio 2019/vcpkg/scripts/buildsystems/msbuild/vcpkg.targets" /p:VcpkgApplocalDeps=false
    Working Directory: C:/Users/utente/Documents/Visual Studio 2019/vcpkg/buildtrees/gmp/x86-windows-rel/adcc6b3cc4-2b6258d695.clean
    Error code: 1
    See logs for more information:
      C:\Users\utente\Documents\Visual Studio 2019\vcpkg\buildtrees\gmp\build-x86-windows-rel-out.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_install_msbuild.cmake:162 (vcpkg_execute_required_process)
  ports/gmp/portfile.cmake:48 (vcpkg_install_msbuild)
  scripts/ports.cmake:79 (include)


Error: Building package gmp:x86-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: gmp:x86-windows
  Vcpkg version: 2020.06.15-nohash

我尝试在另一台 PC 上安装 GMP,它给出了同样的错误,我还尝试卸载并重新安装 Visual Studio 和 vcpkg,但没有任何改变。

标签: c++visual-studiolibrariesbuild-errorvcpkg

解决方案


首先,我建议您更新vcpkg到最新版本。

如果不行,检查Visual Studio的语言设置是否为英文,如果不是,可以在Visual Studio中选择Tools->Options->Environment->International Settings设置English

最后,如果还是不能解决问题,请给我看一下C:\Users\utente\Documents\Visual Studio 2019\vcpkg\buildtrees\gmp\build-x86-windows-rel-out.log.

此外,您可以参考此链接了解更多信息。


推荐阅读