c++boostboost-python

How to build libboost-python.so in Boost 1.74


Boost build not generate libboost_python38.so.1.74.0 for python modules in my project.

I tried build boost libraries like this, but libboost_python38.so.1.74.0 not appears for me:

wget https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz && \
tar -zxvf boost_1_74_0.tar.gz && \
cd boost_1_74_0 && \
./bootstrap.sh --with-python=/usr/bin/python3 --with-python-version=3.8 --with-python-root=/usr/local/lib/python3.8 --prefix=/opt/boost && \
./b2 && \
./b2 --prefix=/opt/boost --with-python install

/opt/boost/lib

Build console output result show no error


Solution

  • If you look closely, you'll see this in the output:

    warning: No python installation configured and autoconfiguration
    note: failed.  See http://www.boost.org/libs/python/doc/building.html
    note: for configuration instructions or pass --without-python to
    note: suppress this message and silently skip all Boost.Python targets
    

    In my ubuntu 22.04 docker container, installing the Python dev package was enough:

    apt install python3-all-dev
    

    It does default to 3.10 on that distro, but that's probably not a problem you have since you already know you have 3.8? Double check the python root path matches the installed location. For me, it was enough to bootstrap without the --with-python-root= option.