簡體   English   中英

如何處理“ Cmake錯誤:無法找到請求的Boost庫”?

[英]How to handle “Cmake Error: Unable to find the requested Boost libraries”?

我正在嘗試在Windows10環境中構建此項目https://github.com/DLuensch/StereoVision-ADCensus 事實證明,我需要建立openCV,boost,libConfig,PCL,OpenMP,Qt 4.8X。 我真的不知道所有這些庫是什么,但是,我只是按照提供的說明進行操作。 當我嘗試使用cmake ..命令構建項目時,CMake引發錯誤“無法找到請求的Boost庫”,如下所示

E:\>cd E:\Projects\VisualStudioProjects\StereoVision-ADCensus-master\StereoVision-ADCensus-master\ADCensusBM\build

E:\Projects\VisualStudioProjects\StereoVision-ADCensus-master\StereoVision-ADCensus-master\ADCensusBM\build>cmake ..
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.15.26730.0
-- The CXX compiler identification is MSVC 19.15.26730.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/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/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
OPENMP FOUND
CMake Warning (dev) at CMakeLists.txt:27 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    E:\BOOST\boost_1_70_0\boost_1_70_0

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at D:/Applications/CMake/share/cmake-3.14/Modules/FindBoost.cmake:2165 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.70.0

  Boost include path: E:/BOOST/boost_1_70_0/boost_1_70_0

  Could not find the following static Boost libraries:

          boost_filesystem
          boost_system

  No Boost libraries were found.  You may need to 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:27 (find_package)


CMake Error at CMakeLists.txt:36 (find_package):
  By not providing "FindPCL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "PCL", but
  CMake did not find one.

  Could not find a package configuration file provided by "PCL" (requested
  version 1.2) with any of the following names:

    PCLConfig.cmake
    pcl-config.cmake

  Add the installation prefix of "PCL" to CMAKE_PREFIX_PATH or set "PCL_DIR"
  to a directory containing one of the above files.  If "PCL" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "E:/Projects/VisualStudioProjects/StereoVision-ADCensus-master/StereoVision-ADCensus-master/ADCensusBM/build/CMakeFiles/CMakeOutput.log".

我對CMake或BOOST不太熟悉。 實際上,直到昨天我才認識他們。 因此,我無法清楚地找出問題所在。

首先,我搜索了BOOST路徑中的文件,是的,沒有名為“ boost_filesystem”或“ boost_system”的文件。 我懷疑我的增強版是否不匹配。 然后,我查看了“ CMakeLists.txt”文件。 我發現這樣的聲明

# Under Windows the system variable "BOOST_ROOT" must be set to the location of the root directory of Boost.
if(WIN32)
  set(Boost_USE_STATIC_LIBS ON)
  set(Boost_USE_STATIC ON)
endif(WIN32)
SET(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0")
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost 1.40.0 COMPONENTS filesystem system REQUIRED)
set(BOOST_FOUND ${Boost_FOUND})
set(BOOST_INCLUDE_DIRS "${Boost_INCLUDE_DIR}")
set(BOOST_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}")
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIRS})
SET(LIBS ${LIBS} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_DATE_TIME_LIBRARY})

這是否意味着我應該使用BOOST 1.47.0(我現在下載了1.70.0)? 並且,“ set(Boost_NO_BOOST_CMAKE ON)”是否意味着我甚至可以在沒有CMake的情況下構建該項目? 因為我認為CMake的關閉進度失敗是因為不是缺少BOOST,而是因為PCL(我還沒有嘗試處理)。 如果我可以跳過有關BOOST問題的處理,那么我想,因為我有點着急。 還是我必須解決這個問題? 希望獲得幫助。 提前致謝 :)

cmake只是存在一個問題,即找不到升壓庫文件boost_filesystemboost_system與您已安裝的boost版本鏈接。

cmake需要將BOOST_LIBRARYDIR設置為存儲庫文件的目錄,就像將BOOST_ROOT設置為安裝boost的目錄一樣。

安裝boost時,默認情況下不構建boost庫文件,請參見: boost:准備使用庫二進制文件 你可以建立自己的圖書館,描述在這里 但是,從此處下載並安裝相關的二進制文件更加容易。

注意: CMakeLists.txt文件行:

find_package(Boost 1.40.0 COMPONENTS filesystem system REQUIRED)

需要最低 boost版本1.40.0。 您應該對Boost版本1.70沒問題,除非發生了一些更改,從而破壞了向后兼容性。
CMakeLists.txt文件中引用的1.40和1.47版本非常舊...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM