解决ubuntu18.04使用vcpkg安装库出现的一个问题
vcpkg
vcpkg - 一个用于管理 C 和 C++ 库的工具,支持在 Windows、Linux 和 macOS 上安装和集成各种库。
项目地址:https://gitcode.com/gh_mirrors/vc/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)
就可以正常下载安装库了
GitHub 加速计划 / vc / vcpkg
22.52 K
6.21 K
下载
vcpkg - 一个用于管理 C 和 C++ 库的工具,支持在 Windows、Linux 和 macOS 上安装和集成各种库。
最近提交(Master分支:1 个月前 )
4f746bc6
8 天前
6e90218d
8 天前
更多推荐
已为社区贡献2条内容
所有评论(0)