c++ - CMake 找不到请求的 Boost 库
问题描述
既然我已经查看了其他人的解决方案几个小时,但找不到适合我的问题的正确答案,我想把我的具体问题带给你。:)
我正在尝试使用 CMake 构建 vsomeip。为此,我之前构建了 boost 1.55,但是,我在 CMake 中收到以下错误:
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visua Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Setting build type to 'RelWithDebInfo' as none was specified.
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.12/Modules/FindBoost.cmake:2025 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/Program Files/boost/boost_1_55_0
Could not find the following static Boost libraries:
boost_system
boost_thread
boost_log
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:99 (find_package)
Boost was not found!
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Systemd was not found, watchdog disabled!
using MSVC Compiler
Predefined unicast address: 127.0.0.1
Predefined diagnosis address: 0x00
Predefined routing application: vsomeipd
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at CMakeLists.txt:335 (message):
Doxygen is not installed. Documentation can not be built.
CMake Warning at CMakeLists.txt:374 (message):
asciidoc is not installed. Readme can not be built.
GTEST_ROOT is not defined. For building the tests the variable
GTEST_ROOT has to be defined. Tests can not be built.
Configuring incomplete, errors occurred!
See also "D:/Desktop/BACHELORARBEIT/vsomeip/build/CMakeFiles /CMakeOutput.log".
See also "D:/Desktop/BACHELORARBEIT/vsomeip/build/CMakeFiles/CMakeError.log".
它找不到静态 Boost 库。现在,我尝试使用 CMakeList.txt,这是应该处理链接的部分:
# Boost
set(BOOST_INCLUDE_DIR C:/Program Files/Boost/boost_1_55_0)
set(BOOST_LIBRARYDIR C:/Program Files/Boost/boost_1_55_0/stage/libs)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package( Boost 1.55 COMPONENTS system thread log REQUIRED )
include_directories( ${Boost_INCLUDE_DIR} )
if(Boost_FOUND)
if(Boost_LIBRARY_DIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR not empty using it: ${Boost_LIBRARY_DIR}" )
else()
if(BOOST_LIBRARYDIR)
MESSAGE( STATUS "Boost_LIBRARY_DIR empty but BOOST_LIBRARYDIR is set setting Boost_LIBRARY_DIR to: ${BOOST_LIBRARYDIR}" )
set(Boost_LIBRARY_DIR ${BOOST_LIBRARYDIR})
endif()
endif()
else()
MESSAGE( STATUS "Boost was not found!")
endif()
我也尝试过使用更新的 boost 版本(1.67),结果相同。任何帮助将不胜感激!
解决方案
检查您编译的库是否在以下目录中:
C:/Program Files/Boost/boost_1_55_0/stage/libs
如果没有,请设置您的 lib 文件夹目录路径:
set(BOOST_LIBRARYDIR path_to_lib_directory)
推荐阅读
- google-apps-script - Google Script 中的 MailApp 不会从我的业务域中的电子邮件地址发送电子邮件
- c# - .NET 中的 TransactionScope 是否仅适用于特定类型的事务?
- json - JSON/XML 中的语言字典是否有“标准”表示结构/规范?
- go - 银杏清理失败
- sql - SQL:如何虚拟组合两个表并链接到结果?
- javascript - if 语句多个值检查相同的来源,没有重复的来源
- amazon-web-services - 使用 cloudformation 创建时 ECS 服务的目标组健康检查失败
- amazon-ecs - AWS-ECS - 立即重启服务
- ssh - DBeaver ssh 隧道无效的私钥
- php - laravel 中的 phpunit 测试不显示真实的会话表