无法找到请求的 Boost 库boost_lboost_thread



我一直在尝试在CMake环境中运行Qt项目。Qt项目正在使用openCV和Boost依赖项。在成功解决所有编译错误后,我一直在与Boost错误作斗争。 一旦我运行CMake,我就会收到以下错误:

在/home/labrat/Desktop/cam-proc/build 中运行 "/usr/bin/cmake/home/labrat/Desktop/cam-proc '-GCodeBlocks - Unix Makefiles'"。

**CMake Error at /usr/share/cmake-3.5/Modules/FindBoost.cmake:1677 (message):**
Unable to find the requested Boost libraries.
Boost version: 1.58.0
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_lboost_thread
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):
src/libCam/CMakeLists.txt:7 (find_package)**
Boost version: 1.58.0
Found the following Boost libraries:
system
thread
filesystem
chrono
date_time
atomic
-- Configuring incomplete, errors occurred!
See also "/home/labrat/Desktop/cam-proc/build/CMakeFiles/CMakeOutput.log".
See also "/home/labrat/Desktop/cam-proc/build/CMakeFiles/CMakeError.log".
*** cmake process exited with exit code 1.

我分析了/usr/share/cmake-3.5/Modules/FindBoost.cmake:1677(消息(处给出的 CMake 错误:并打开了巨大的FindBoost.cmake文件,根据警告,这里是错误的部分:

消息(SEND_ERROR"找不到请求的 Boost 库。${Boost_ERROR_REASON}"(

# Add pthread library on UNIX if thread component was found
_Boost_consider_adding_pthreads(Boost_LIBRARIES ${Boost_LIBRARIES})
else()
if(Boost_FIND_REQUIRED)
message(SEND_ERROR "Unable to find the requested Boost libraries.n${Boost_ERROR_REASON}")
else()
if(NOT Boost_FIND_QUIETLY)
# we opt not to automatically output Boost_ERROR_REASON here as
# it could be quite lengthy and somewhat imposing in its requests
# Since Boost is not always a required dependency we'll leave this
# up to the end-user.
if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
message(STATUS "Could NOT find Boostn${Boost_ERROR_REASON}")
else()
message(STATUS "Could NOT find Boost")
endif()
endif()
endif()
endif()

另外,由于错误消息的另一部分说调用堆栈(最近的调用优先(:src/libCam/CMakeLists.txt:7(find_package(在这里我附加了CMakeLists.txt如果有帮助的话,它实现了libcam项目:

cmake_minimum_required (VERSION 2.8.12)
project(libCam)
find_package(Qt5Widgets REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Boost COMPONENTS filesystem lboost_thread system REQUIRED)
find_package(Boost COMPONENTS system thread filesystem REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
###
# make sure we use c++11
###
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
include_regular_expression("^([^b]|b[^o]|bo[^o]|boo[^s]|boos[^t]|boost[^/]).*$")
qt5_wrap_ui (UIS_HDRS  qtinclude/imagemanager.ui qtinclude/stereomanager.ui qtinclude/stereolistwidget.ui qtinclude/connectionmenu.ui)
file(GLOB LIBCAM_SRCS
"include/*.h"
"include/*.cpp"
"include/*.hpp"
"qtinclude/*.h"
"qtinclude/*.cpp"
"qtinclude/*.hpp"
)
file(GLOB UI_RC
"qtinclude/qdarkstyle/*.qrc"
)
add_library(libCam SHARED ${LIBCAM_SRCS} ${UIS_HDRS} ${UI_RC})
target_include_directories (libCam  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries (libCam  Qt5::Widgets  Qt5::PrintSupport Qt5::Core Qt5::Quick Qt5::Sql Qt5::XmlPatterns ${Boost_LIBRARIES} ${OpenCV_LIBS} )

过去两天我一直在谷歌上搜索错误,寻找解决这个问题的信息和代码,但我的想法已经用完了。我尝试下载 boost 1.55,但它不起作用,因为编译器只看到 boost 1.58。

关于如何阐明此事的任何想法?我遗漏了什么吗?

问题是这条线

find_package(Boost COMPONENTS filesystem lboost_thread system REQUIRED)

应更改为

find_package(Boost COMPONENTS filesystem thread system REQUIRED)

或者干脆删除,因为它等效于下一行。

相关内容

  • 没有找到相关文章

最新更新