8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

cmake 没有找到 boost_graph 库

anthony sottile 2月前

19 0

问题是 cmake 在构建项目时找不到 boost-graph 库。但是,这个库已安装在系统上。大家好!我也遇到过这样的问题。我试过

问题是,在构建项目时,cmake 没有找到 boost-graph 库。但是,这个库已安装在系统上。

大家好!我遇到过这样的问题。我尝试构建一些依赖于 Boost 和 CLapack 包的项目。(我之前已经安装了这些包)我使用了这个命令:

$ cmake ../project_name/ -DCLAPACK_BASE_DIRECTORY=/home/vitalii/clapack-3.2.1-CMAKE -DCLAPACK_BUILD_DIRECTORY=/home/vitalii/clapack-3.2.1-CMAKE/BUILD

终端的输出是:

— The C compiler identification is GNU 11.4.0
— The CXX compiler identification is GNU 11.4.0
— Detecting C compiler ABI info
— Detecting C compiler ABI info - done
— Check for working C compiler: /usr/bin/cc - skipped
— Detecting C compile features
— Detecting C compile features - done
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info - done
— Check for working CXX compiler: /usr/bin/c++ - skipped
— Detecting CXX compile features
— Detecting CXX compile features - done
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake:141 (find_package):
  Found package configuration file:

    /usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/boost_graph-config.cmake

  but it set boost_graph_FOUND to FALSE so package "boost_graph" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_graph.so.1.74.0 (shared, Boost_USE_STATIC_LIBS=ON)

  * libboost_graph.a (shared runtime, Boost_USE_STATIC_RUNTIME=ON)

Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake:258 (boost_find_component)
  /usr/share/cmake-3.22/Modules/FindBoost.cmake:594 (find_package)
  CMakeLists.txt:45 (find_package)

— Configuring incomplete, errors occurred!
See also "/home/vitalii/Vitalii/lab/phd/cpf/cpf_build/CMakeFiles/CMakeOutput.log".

CMakeLists.txt第42-45行内容为:

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
find_package(Boost COMPONENTS graph program_options REQUIRED)

/usr/share/cmake-3.22/Modules/FindBoost.cmake 的 587-594 行是:

  if(BOOST_ROOT AND NOT Boost_ROOT)
    # Honor BOOST_ROOT by setting Boost_ROOT with CMP0074 NEW behavior.
    cmake_policy(PUSH)
    cmake_policy(SET CMP0074 NEW)
    set(Boost_ROOT "${BOOST_ROOT}")
    set(_Boost_ROOT_FOR_CONFIG 1)
  endif()
  find_package(Boost QUIET NO_MODULE ${_boost_FIND_PACKAGE_ARGS})

/usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake 的 238-262 行是:

# Find components

if("ALL" IN_LIST Boost_FIND_COMPONENTS)

  # Make sure "ALL" is the only requested component.
  list(LENGTH Boost_FIND_COMPONENTS __boost_find_components_count)
  if(NOT ${__boost_find_components_count} EQUAL 1)
    message(AUTHOR_WARNING "ALL cannot be combined with named components; the named components will be ignored.")
  endif()

  unset(__boost_find_components_count)

  set(Boost_ALL_TARGETS Boost::headers)

  boost_find_all_components()

else()

  foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)

**    boost_find_component(${__boost_comp} ${Boost_FIND_REQUIRED_${__boost_comp}} 0)**

  endforeach()

endif()

该命令证明boost_graph库存在于我的系统中:

$ find / -name *libboost_graph* 2> /dev/null
/home/vitalii/anaconda3/envs/my-rdkit-env/lib/libboost_graph.so.1.84.0
/home/vitalii/anaconda3/envs/my-rdkit-env/lib/libboost_graph.so
/home/vitalii/anaconda3/envs/AmberTools23/lib/libboost_graph.so.1.82.0
/home/vitalii/anaconda3/envs/AmberTools23/lib/libboost_graph.so
/home/vitalii/anaconda3/envs/AmberTools23/lib/cmake/boost_graph-1.82.0/libboost_graph-variant-shared.cmake
/home/vitalii/anaconda3/pkgs/libboost-devel-1.82.0-h00ab1b0_6/lib/cmake/boost_graph-1.82.0/libboost_graph-variant-shared.cmake
/home/vitalii/anaconda3/pkgs/boost-cpp-1.78.0-h2c5509c_4/lib/libboost_graph.so
/home/vitalii/anaconda3/pkgs/boost-cpp-1.78.0-h2c5509c_4/lib/libboost_graph.so.1.78.0
/home/vitalii/anaconda3/pkgs/boost-cpp-1.78.0-h2c5509c_4/lib/cmake/boost_graph-1.78.0/libboost_graph-variant-shared.cmake
/home/vitalii/anaconda3/pkgs/libboost-1.84.0-hba137d9_3/lib/libboost_graph.so.1.84.0
/home/vitalii/anaconda3/pkgs/libboost-1.84.0-hba137d9_3/lib/libboost_graph.so
/home/vitalii/anaconda3/pkgs/libboost-1.82.0-h6fcfa73_6/lib/libboost_graph.so.1.82.0
/home/vitalii/anaconda3/pkgs/libboost-1.82.0-h6fcfa73_6/lib/libboost_graph.so
/home/vitalii/anaconda3/pkgs/boost-cpp-1.78.0-h6582d0a_3/lib/libboost_graph.so
/home/vitalii/anaconda3/pkgs/boost-cpp-1.78.0-h6582d0a_3/lib/libboost_graph.so.1.78.0
/home/vitalii/anaconda3/pkgs/boost-cpp-1.78.0-h6582d0a_3/lib/cmake/boost_graph-1.78.0/libboost_graph-variant-shared.cmake
/usr/lib/x86_64-linux-gnu/libboost_graph.so.1.74.0
/usr/lib/x86_64-linux-gnu/libboost_graph_parallel.so.1.74.0
/usr/lib/x86_64-linux-gnu/libboost_graph.so
/usr/lib/x86_64-linux-gnu/libboost_graph_parallel.so
/usr/lib/x86_64-linux-gnu/libboost_graph_parallel.a
/usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/libboost_graph-variant-static.cmake
/usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/libboost_graph-variant-shared.cmake
/usr/lib/x86_64-linux-gnu/cmake/boost_graph_parallel-1.74.0/libboost_graph_parallel-variant-static.cmake
/usr/lib/x86_64-linux-gnu/cmake/boost_graph_parallel-1.74.0/libboost_graph_parallel-variant-shared.cmake
/usr/lib/x86_64-linux-gnu/libboost_graph.a

我也阅读了一些相关问题的答案。我尝试 cmake 使用选项 -DBoost_DEBUG=TRUE 来获取更多信息,因为这些答案中的一些用户推荐了它:

$ cmake ../project_name/ -DCLAPACK_BASE_DIRECTORY=/home/vitalii/clapack-3.2.1-CMAKE -DCLAPACK_BUILD_DIRECTORY=/home/vitalii/clapack-3.2.1-CMAKE/BUILD -DBoost_DEBUG=TRUE
— Found Boost 1.74.0 at /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0
— Requested configuration: QUIET REQUIRED COMPONENTS graph;program_options
— BoostConfig: find_package(boost_headers 1.74.0 EXACT CONFIG REQUIRED QUIET HINTS /usr/lib/x86_64-linux-gnu/cmake)
— Found boost_headers 1.74.0 at /usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.74.0
— BoostConfig: find_package(boost_graph 1.74.0 EXACT CONFIG REQUIRED QUIET HINTS /usr/lib/x86_64-linux-gnu/cmake)
— Found boost_graph 1.74.0 at /usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0
— Boost toolset is gcc11 (GNU 11.4.0)
— Scanning /usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/libboost_graph-variant*.cmake
— Including /usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/libboost_graph-variant-shared.cmake
— [ ] libboost_graph.so.1.74.0
— Including /usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/libboost_graph-variant-static.cmake
— [ ] libboost_graph.a
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake:141 (find_package):
Found package configuration file:

/usr/lib/x86_64-linux-gnu/cmake/boost_graph-1.74.0/boost_graph-config.cmake

but it set boost_graph_FOUND to FALSE so package "boost_graph" is
considered to be NOT FOUND. Reason given by package:

No suitable build variant has been found.

The following variants have been tried and rejected:

* libboost_graph.so.1.74.0 (shared, Boost_USE_STATIC_LIBS=ON)

* libboost_graph.a (shared runtime, Boost_USE_STATIC_RUNTIME=ON)

Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake:258 (boost_find_component)
/usr/share/cmake-3.22/Modules/FindBoost.cmake:594
22:55
(find_package)
CMakeLists.txt:45 (find_package)

— Configuring incomplete, errors occurred!
See also "/home/vitalii/Vitalii/lab/phd/cpf/cpf_build/CMakeFiles/CMakeOutput.log".

不幸的是,我还不知道如何解决这个问题。你有什么建议吗?

我的操作系统是 22.04.1-Ubuntu。

帖子版权声明 1、本帖标题:cmake 没有找到 boost_graph 库
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由anthony sottile在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 注意,99% 的库都是头文件。很有可能你不需要链接依赖。只依赖于 Boost::boost 或 Boost::headers - 我总是忘记哪个

返回
作者最近主题: