linux下user-config.JAm指定コンパイラコンパイルboost
bjamはboostのコンパイルツールで、gnu makeに似ていて、boostはbjamでコンパイルされています.bjamは頭がいいので、boostをコンパイルするとき、自動的にシステムから適切なコンパイラを探してboostコンパイルを完了します.しかし、システムに複数のコンパイラが存在する場合、システムのデフォルトのコンパイラは/usr/bin/g++であり、また/usr/local/bin/g++より高いバージョンのコンパイラをインストールしました.boostをコンパイルすると、bjamは自動的に/usr/bin/g++を見つけることができますが、/usr/local/bin/g++を使用してコンパイルしたいと思います.bjamで自動的に見つけるコンパイラを使用してboostをコンパイルしたくない場合は、コンパイラを指定する必要があります.bjamにコンパイラを指定するにはuser-configを定義します.JAmはuser-configを定義する限り実現する.JAmファイル、指定のフォーマットでファイルにコンパイラを指定し、user-config.JAmファイルの場所はbjamに教えます(bjamは
説明:上のスクリプトは完全ではありません.スクリプトで使用される
user-configについてJAmプロファイルの詳細については、以下の参考資料のboost公式説明「Configuration」を参照してください.
『Configuration』『boost 1.56.0コンパイルと使用』
$HOME, $BOOST_BUILD_PATH
で定義されたフォルダの下でuser-config.jamを探します).# boost
INSTALL_FOLDER=$INSTALL_PREFIX_ROOT/$(install_suffix boost)
echo INSTALL_FOLDER:$INSTALL_FOLDER
remove_if_exist $INSTALL_FOLDER
bzip2_path=$INSTALL_PREFIX_ROOT/$(install_suffix "bzip2")
exit_if_not_exist $bzip2_path "not found $bzip2_path,please build bzip2"
pushd boost-1.58.0
# bzip2 , iostreams
#export LIBRARY_PATH=$bzip2_path/lib:$LIBRARY_PATH
#export CPLUS_INCLUDE_PATH=$bzip2_path/include:$CPLUS_INCLUDE_PATH
# user-config.jam /usr/local/bin/g++, 5.4.0
export BOOST_BUILD_PATH=$(pwd)
echo "using gcc : 5.4.0 : /usr/local/bin/g++ ;" >$BOOST_BUILD_PATH/user-config.jam
cat $BOOST_BUILD_PATH/user-config.jam
#
# atomic chrono container context coroutine date_time exception filesystem
# graph graph_parallel iostreams locale log math mpi program_options python
# random regex serialization signals system test thread timer wave
# --without-libraries
#./bootstrap.sh --without-libraries=python,mpi,graph,graph_parallel,wave
# --with-libraries
./bootstrap.sh --with-libraries=system,thread,filesystem,regex
exit_on_error
./b2 --clean
# --debug-configuration
./b2 -q --debug-configuration
exit_on_error
#
./b2 install --prefix=$INSTALL_FOLDER
popd
説明:上のスクリプトは完全ではありません.スクリプトで使用される
exit_on_error,install_suffix,remove_if_exist
などの関数は、私の前のブログ「linux下boostコンパイルインストール全プロセススクリプト塈bzip 2コンパイルインストール全プロセススクリプト」を参照してください.user-configについてJAmプロファイルの詳細については、以下の参考資料のboost公式説明「Configuration」を参照してください.
参考資料
『Configuration』『boost 1.56.0コンパイルと使用』