【问题标题】:Does boost not include a /lib directory?boost 不包含 /lib 目录吗?
【发布时间】:2021-02-02 21:40:31
【问题描述】:

我正在尝试从源代码构建 boost 1.74.0 库,以便生成带有 cmake 的 make 文件。我看不懂:根据boost install page,建库应该生成lib路径。但是我只看到 libs 文件夹。 我使用

构建了boost
./bootstrap.sh --with-libraries=system
sudo apt-get install libbz2-dev
./b2 toolset=gcc cxxflags=-std=gnu++0x

得到输出

Performing configuration checks

    - default address-model    : 64-bit (cached)
    - default architecture     : x86 (cached)

Building the Boost C++ Libraries.



Component configuration:

    - atomic                   : not building
    - chrono                   : not building
    - container                : not building
    - context                  : not building
    - contract                 : not building
    - coroutine                : not building
    - date_time                : not building
    - exception                : not building
    - fiber                    : not building
    - filesystem               : not building
    - graph                    : not building
    - graph_parallel           : not building
    - headers                  : not building
    - iostreams                : not building
    - locale                   : not building
    - log                      : not building
    - math                     : not building
    - mpi                      : not building
    - nowide                   : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - stacktrace               : not building
    - system                   : building
    - test                     : not building
    - thread                   : not building
    - timer                    : not building
    - type_erasure             : not building
    - wave                     : not building

...found 165 targets...
...updating 10 targets...
boost-install.generate-cmake-config- bin.v2/libs/headers/build/stage/boost_headers-config.cmake
boost-install.generate-cmake-config- bin.v2/libs/system/build/stage/boost_system-config.cmake
boost-install.generate-cmake-config-version- bin.v2/libs/system/build/stage/boost_system-config-version.cmake
common.copy /home/vm-umic/boost/boost_1_74_0/stage/lib/cmake/boost_system-1.74.0/boost_system-config.cmake
common.copy /home/vm-umic/boost/boost_1_74_0/stage/lib/cmake/boost_system-1.74.0/boost_system-config-version.cmake
common.copy /home/vm-umic/boost/boost_1_74_0/stage/lib/cmake/boost_headers-1.74.0/boost_headers-config.cmake
boost-install.generate-cmake-config-version- bin.v2/libs/headers/build/stage/boost_headers-config-version.cmake
common.copy /home/vm-umic/boost/boost_1_74_0/stage/lib/cmake/boost_headers-1.74.0/boost_headers-config-version.cmake
...updated 10 targets...


The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/vm-umic/boost/boost_1_74_0

The following directory should be added to linker library paths:

    /home/vm-umic/boost/boost_1_74_0/stage/lib

所以我认为它有效。我看到了include 路径。但我看不到lib 路径。只有libs 路径?

lib 路径在哪里?为什么没建好。

编辑: 文档的相关摘录如下。如您所见,它指出在顶层应该有一个 lib\ 路径?文档有错吗?

boost_1_73_0\ .................The “boost root directory”
   index.htm .........A copy of www.boost.org starts here
   boost\ .........................All Boost Header files
   lib\ .....................precompiled library binaries
   libs\ ............Tests, .cpps, docs, etc., by library
     index.html ........Library documentation starts here
     algorithm\
     any\
     array\
                     …more libraries…
   status\ .........................Boost-wide test suite
   tools\ ...........Utilities, e.g. Boost.Build, quickbook, bcp
   more\ ..........................Policy documents, etc.
   doc\ ...............A subset of all Boost library docs

(这取自文档 1.74,尽管它在此摘录的顶部说 1.73)。 我问这一切的原因是因为我想明确地将不同的文件夹交给cmake。

【问题讨论】:

  • 所以,有路径/home/vm-umic/boost/boost_1_74_0/stage/libs,但没有路径/home/vm-umic/boost/boost_1_74_0/stage/lib。我是否正确理解您的问题?
  • @Tszvarev:差不多。没有/home/vm-umic/boost/boost_1_74_0/lib,但有/home/vm-umic/boost/boost_1_74_0/stage/lib。为什么?文档有错吗?
  • documentation 显示了您在解压缩 (tar --bzip2 -xf /path/to/boost_1_73_0.tar.bz2) 存档 后会得到什么。如果您构建 Boost,目录结构可能会有所不同。是否创建 stage/ 子目录取决于您在构建 Boost 时传递的选项。
  • 安装后会发生什么?您现在只是在构建 Boost,而不是根据您的命令安装它。可能需要在构建命令中指定安装前缀。
  • 使用./b2 install 将boost 安装到您在构建后提供的目录中,请参阅boost.org/doc/libs/1_75_0/more/getting_started/… 顺便说一句:这样做之后,您不需要手动提供目录来cmake,因为安装已经到来使用 cmake 配置脚本,您可以使用 find_package(Boost COMPONENTS ... CONFIG),只要您安装 boost 的目录位于 CMAKE_PREFIX_PATH 中,它就会为您提供包含信息的导入目标 (Boost::<component_name>)。

标签: ubuntu boost cmake


【解决方案1】:

您找到的libs 目录是源(库 TU、测试、示例和文档)所在的位置。

仔细看:

请注意其中的stage/。

【讨论】:

  • 添加了一些评论以消除最可能的混淆。
  • 好的,但文档另有说明,还是我忽略了什么?请参阅我对原始问题的编辑,因为文档指出 lib 路径不应位于 /stage/lib 下,而应直接位于 /lib 下。正如编辑中所述,我需要这些路径来包含Boost_INCLUDE_DIRS 和Boost_LIBRARY_DIRS,因为不幸的是自动查找不起作用。
猜你喜欢
  • 1970-01-01
  • 2013-06-02
  • 1970-01-01
  • 2017-06-19
  • 1970-01-01
  • 2013-04-19
  • 2017-05-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多