User Tools

Site Tools


Sidebar

数値計算ライブラリ:boost

概要

ソースコードの入手

以下のサイトから入手できます。

記事執筆時点での最新版は1.76.0です。

インストール

入手した boost_1_76_0.tar.bz2 をホーム・ディレクトリに置き、ターミナルで以下のように入力します。

$ tar --bzip2 -xf boost_1_76_0.tar.bz2
$ cd boost_1_76_0

Boostライブラリをビルドするためのb2およびbjamが生成します。 toolsetは指定しなければgccになります。

$ ./bootstrap.sh ./bootstrap.sh --with-toolset=intel-linux

公式ではb2が推奨されていますので、こちらでBoostをビルドします。

$ sudo ./b2 install -j4 --prefix=/usr/local/boost_1_76_0 toolset=intel
  • prefixでインストール先のディレクトリを指定します
  • -j4 でビルドする時の並列数を指定します(この場合は4並列)
  • toolsetは指定しなければGCCが使われます。

Intel Pythonを使う場合

oneAPIの中のIntel Pythonを使うと、b2実行時に次のようなエラーが出ることがあります。(エラーが出てもビルドは止まりません)

./boost/python/detail/wrap_python.hpp:57:11: fatal error: 'pyconfig.h' file not found
# include <pyconfig.h>
          ^~~~~~~~~~~~
1 error generated.

pyconfig.hを見つけることができていません。 この場合はproject-config.jamを開いて次のように変更します。 (ディレクトリのパスは自分の環境に適宜合わせてください)

(略)
# Python configuration
import python ;
if ! [ python.configured ]
{
    using python : 3.7 : "/opt/intel/oneapi/intelpython/latest" : "/opt/intel/oneapi/intelpython/latest/include/python3.7m" ;
}
(略)
数値計算ライブラリ/boost.txt · Last modified: 2021/06/27 22:04 (external edit)