系统相关
首页 > 系统相关> > 解决ubuntu18.04使用vcpkg安装库出现的一个问题

解决ubuntu18.04使用vcpkg安装库出现的一个问题

作者:互联网

报错描述如下

book@100ask:~/vcpkg$ vcpkg install freetype
Computing installation plan...
The following packages will be built and installed:
  * brotli[core]:x64-linux -> 1.0.9#1
  * bzip2[core]:x64-linux -> 1.0.8#1
    freetype[brotli,bzip2,core,png,zlib]:x64-linux -> 2.10.4
  * libpng[core]:x64-linux -> 1.6.37#14
  * zlib[core]:x64-linux -> 1.2.11#9
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-linux...
Error: while detecting compiler information:
The log content at /home/book/vcpkg/buildtrees/detect_compiler/stdout-x64-linux.log is:
-- Configuring x64-linux-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:105 (message):
    Command failed: /home/book/vcpkg/downloads/tools/cmake-3.19.2-linux/cmake-3.19.2-Linux-x86_64/bin/cmake /home/book/vcpkg/scripts/detect_compiler -DCMAKE_MAKE_PROGRAM=/home/book/vcpkg/downloads/tools/ninja-1.10.1-linux/ninja -DCMAKE_SYSTEM_NAME=Linux -DBUILD_SHARED_LIBS=OFF -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/book/vcpkg/scripts/toolchains/linux.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DVCPKG_SET_CHARSET_FLAG=ON -DVCPKG_PLATFORM_TOOLSET=external -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=/home/book/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=dynamic -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=/home/book/vcpkg -D_VCPKG_INSTALLED_DIR=/home/book/vcpkg/installed -DVCPKG_MANIFEST_INSTALL=OFF -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/book/vcpkg/packages/detect_compiler_x64-linux
    Working Directory: /home/book/vcpkg/buildtrees/detect_compiler/x64-linux-rel
    Error code: 1
    See logs for more information:
      /home/book/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-out.log
      /home/book/vcpkg/buildtrees/detect_compiler/config-x64-linux-rel-err.log

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



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

解决办法如下
打开/home/book/vcpkg/scripts/buildsystems/vcpkg.cmake这个文件在第24行添加两行代码
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)

就可以正常下载安装库了

标签:cmake,DVCPKG,x64,book,vcpkg,linux,ubuntu18.04,安装
来源: https://blog.csdn.net/qq_32856147/article/details/115160398