【问题标题】:How to install and use Boost.Program_options library?如何安装和使用 Boost.Program_options 库?
【发布时间】:2021-02-07 02:26:30
【问题描述】:

我正在尝试构建以下软件包: https://github.com/kahypar/kahypar

在需求部分,它要求Boost.Program_options,我真的不知道那是什么以及我应该如何处理它。如果您能帮助我,我将不胜感激。 我正在使用 macOS,并且我已经通过以下方式安装了 boost:

brew install boost

但还是不行。

【问题讨论】:

标签: c++ boost


【解决方案1】:

通知

因为有些人似乎没有意识到,手动说明适用于 macOS 100%(除了如何获取构建必需品,但显然 OP 已经有了它们)

但是,我无法在 macOS 上进行演示,因为我没有 Mac。对不起

通常的方法是在您的发行版之后或手动安装 boost:

发行版

例如 Ubuntu 20.04

apt -qq update
apt -qqyy install build-essential libboost-all-dev cmake git


git clone --recurse-submodules  https://github.com/kahypar/kahypar
cmake -B build kahypar/
cmake --build build -j5

煮点咖啡。利润。

手动构建

这使用Boost libraries - build only what I need来节省时间:

apt -qqyy install build-essential cmake git python3-dev wget
wget https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.bz2
tar xf boost_1_75_0.tar.bz2
(cd boost_1_75_0; ./bootstrap.sh; ./b2 --with-program_options)

git clone --recurse-submodules  https://github.com/kahypar/kahypar
BOOST_ROOT="$PWD/boost_1_75_0" cmake -B build kahypar/
cmake --build build -j5

现场演示

截图

当然,您可能只是将BOOST_ROOT 指向 brew 安装所在的位置,但我无法帮助您,因为我无法对其进行测试。您很可能需要单独设置包含/链接路径。

【讨论】:

  • 添加了一条通知,以防人们没有意识到您可以完全在 macOS 上使用手动方法。
  • 修复了截屏视频(最初交换了它们)
  • 如果你忘记了包名 libboost-all-dev 中的 allsudo apt-get install libboost-dev ,那么你只会得到标题而不是库。
猜你喜欢
  • 2018-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-29
  • 2010-11-04
  • 2018-03-10
  • 2022-09-23
相关资源
最近更新 更多