CentOS はコンパイルされた boost ライブラリを認識しません

CentOS はコンパイルされた boost ライブラリを認識しません

以下の手順で boost をビルドしてインストールしました。

# Boostrap and install
JOBS=`grep -c ^processor /proc/cpuinfo`
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2
tar xf boost_1_67_0.tar.bz2
cd boost_1_63_0
./bootstrap.sh
./b2 -d1 -j${JOBS} --with-thread --with-filesystem --with-python --with-regex -sHAVE_ICU=1 --with-program_options --with-system link=shared release toolset=gcc stage
./b2 -d1 -j${JOBS} --with-thread --with-filesystem --with-python --with-regex -sHAVE_ICU=1 --with-program_options --with-system link=shared release toolset=gcc install
sudo bash -c "echo '/usr/local/lib' > /etc/ld.so.conf.d/boost.conf"
sudo ldconfig

次に、boostを使用するmapnikをビルドしてみます。マップニック./bootstrap.shと を実行します./configure。「boost ファイルシステムに必要なヘッダーまたは共有ライブラリが見つかりません」というエラーが表示されます。configure の boost セクションは次のとおりです。

Searching for boost libs and headers... (cached) 
Found boost libs: mason_packages/.link/lib
Found boost headers: mason_packages/.link/include
Checking for C++ header file boost/version.hpp... yes
Checking for Boost version >= 1.61... yes
Found boost lib version... 
Checking for C++ library boost_system... no
Could not find required header or shared library for boost system
Checking for C++ library boost_filesystem... no
Could not find required header or shared library for boost filesystem
Checking for C++ library boost_regex... yes
Checking for C++ library boost_program_options... yes
ValueError: invalid literal for int() with base 10: '':
  File "/root/src/mapnik/SConstruct", line 1600:
    boost_version = [int(x) for x in env.get('BOOST_LIB_VERSION_FROM_HEADER').split('_')]

(ビルド手順は けいさん

なぜシステムは boost ライブラリ 1.67 を見つけられないのでしょうか? boost 1.63 をインストールした覚えはありません。1.67 をコンパイルしてインストールしましたが、ビルド システムはそれを使用しません。システムはシステム上のどこで boost を探すのでしょうか? /usr/local/lib と /usr/lib64 にある libboost_* ファイルをすべて削除しましたが、システムが boost を探す場所がまだわかりません。新しくコンパイルされたソフトウェアについてシステムに通知する方法について、ヒントを教えていただけませんか?

答え1

Cent OS 7 ユーザーです。Mapnik をオプションの依存関係でビルドしようとしていますが、私の場合は更新された Boost ビルドを認識しないようです。おそらくすでにこの問題を克服したか、回避したか、忘れてしまったと思いますが、あなたや他の誰かの役に立つかもしれないので、一応言及しておきます。

私が読んだところによると、Mapnik は、make/install ステップで依存関係を認識するために、同じコンパイラを使用して依存関係を構築することを望んでいる/必要としているようです。ただし、このアプローチを使用すると、実際には代替の非デフォルトのコンパイラが作成され、デフォルトのコンパイラの代わりに使用するには、シェル セッションでそのコンパイラを指定する必要があります。

私はこの方法を使用してコンパイラを更新し、Boost をビルドし、Mapnik を構成しました。そのため、あなたにも効果があるかもしれません。

重要export CC=2 番目のステップで表示されるおよび の指示に特に注意してくださいexport CXX=。ここでデフォルトのコンパイラをオーバーライドし、依存関係のほとんど/すべてをこのコンパイラでビルドする必要があるようです。

まず、c++14 をサポートする gcc6 シリーズから更新された gcc/g++ コンパイラを入手します。

## Instructions modified from here, I just changed the gcc version.. 
## https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/
## 
cd /root/downloads
screen -U -S gcc
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-6.5.0/gcc-6.5.0.tar.gz
tar zxf gcc-6.5.0.tar.gz
cd gcc-6.5.0
## Install bzip2 if you don't have it yet..
yum install bzip2
## Install gcc prereqs..
./contrib/download_prerequisites
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install

次に、Boost をソースからビルドしてインストールします。この方法では、Boost が 2 度目にインストールされる可能性があります。ただし、Mapnik の構成手順で指定するには、インストール場所を知っておく必要があります。

## Create temporary links to the new gcc/g++ compiler resources.
## These disappear with your shell session but need to be in effect for both the Boost and Mapnik builds.
## 
export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++

cd /root/downloads
wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz
tar -xzf boost_1_*
cd boost_1_*
## This prefix variable sets the install location for boost, knowing this location is important. 
## This was the location suggested by the instructions I followed, which I've lost, but this seems to be a standard alternative location.
./bootstrap.sh --prefix=/opt/boost
./b2 install --prefix=/opt/boost --with=all

これで Boost がインストールされ、ここに保存されます:/opt/boost/

この時点で、Mapnik をビルドしてインストールするときに、以下のように構成手順で更新された Boost バージョンを指定できます。

これは重要-再起動した場合、またはログアウトして再度ログインした場合は、 Boost のビルドに使用したのと同じコンパイラを使用して Mapnik がビルドされるように、2 番目の手順の上部に表示される とexport CC=export CXX=手順を繰り返す必要があります。

./configure BOOST_LIBS=/opt/boost/lib BOOST_INCLUDES=/opt/boost/includes

これが誰かの役に立つことを願います!

関連情報