代码之家  ›  专栏  ›  技术社区  ›  Matthew Hoggan

即使正确设置了boost库dir,cmake find package boost也会失败[重复]

  •  0
  • Matthew Hoggan  · 技术社区  · 5 年前

    跑步时

    mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/home/install -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=On ..; cd ../
    

    在第三方库中。我得到以下错误。

    CMake Error at /usr/local/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
      Unable to find the requested Boost libraries.
    
      Boost version: 1.67.0
    
      Boost include path: /usr/local/include
    
      Could not find the following static Boost libraries:
    
              boost_thread
              boost_date_time
    
      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.
    

    因此,根据我添加的其他几个帖子:

    set(BOOST_ROOT /usr/local)
    set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
    message(STATUS "BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
    

    到他们的cmakelists.txt。这给了我以下信息:

    --boost_librarydir=/usr/local/lib
    --使用CPU本机标志进行SSE优化:-march=native
    ----找到GCC>4.3,启用-wabi
    ——找到OpenMP

    但是,我仍然得到同样的错误。列出的内容 BOOST_LIBRARYDIR 指示库在那里。

    root@74fdb1dd14f4:~/code/pcl# ls /usr/local/lib
    cmake                  libboost_prg_exec_monitor.so.1.67.0     libflann.so.1.9
    libboost_atomic.a          libboost_program_options.a          libflann.so.1.9.1-003
    libboost_atomic.so         libboost_program_options.so         libflann_cpp.so
    libboost_atomic.so.1.67.0      libboost_program_options.so.1.67.0      libflann_cpp.so.1.9
    libboost_chrono.a          libboost_regex.a                libflann_cpp.so.1.9.1-003
    libboost_chrono.so         libboost_regex.so               libflann_cpp_s.a
    libboost_chrono.so.1.67.0      libboost_regex.so.1.67.0            libflann_s.a
    libboost_date_time.a           libboost_system.a               libload_qos_controller-1.0.1.so
    libboost_date_time.so          libboost_system.so              libload_qos_controller.la
    libboost_date_time.so.1.67.0   libboost_system.so.1.67.0           libload_qos_controller.so
    libboost_filesystem.a          libboost_test_exec_monitor.a        liblogrotate_container_logger-1.0.1.so
    libboost_filesystem.so         libboost_thread.a               liblogrotate_container_logger.la
    libboost_filesystem.so.1.67.0  libboost_thread.so              liblogrotate_container_logger.so
    libboost_graph.a           libboost_thread.so.1.67.0           libmesos-1.0.1.so
    libboost_graph.so          libboost_timer.a                libmesos.la
    libboost_graph.so.1.67.0       libboost_timer.so               libmesos.so
    libboost_log.a             libboost_timer.so.1.67.0            mesos
    libboost_log.so            libboost_unit_test_framework.a          mesos-modules
    libboost_log.so.1.67.0         libboost_unit_test_framework.so         pkgconfig
    libboost_log_setup.a           libboost_unit_test_framework.so.1.67.0  python2.7
    libboost_log_setup.so          libfixed_resource_estimator-1.0.1.so    python3.4
    libboost_log_setup.so.1.67.0   libfixed_resource_estimator.la          python3.5
    libboost_prg_exec_monitor.a    libfixed_resource_estimator.so
    libboost_prg_exec_monitor.so   libflann.so
    

    为什么找不到图书馆?

    1 回复  |  直到 5 年前
        1
  •  1
  •   vre    5 年前

    您的cmake版本(我从命令行猜到是3.5)对于boost 1.67来说太旧了。Boost从1.66.0版开始更改了其命名方案,因此 set(Boost_ADDITIONAL_VERSIONS 1.67 1.67.0) 不会起作用。看到这个 answer 更多详情。升级cmake版本或降低Boost版本要求(如果可能)。