[C++-sig] Compiling boost python

Andrew Voelkel jandyman.voelkel at gmail.com
Wed Apr 29 10:41:14 EDT 2020


Have you considered using pybind11? It’s the same basic idea as boost.python, but it is cleaner, much better supported and documented, and has a large user community. I just discovered this lately, have been using it, and I’m thrilled with it. The only catch is that you need to be compiling with at least a C++11 compiler, but that is a pretty low bar these days.


  *   Andy

From: Cplusplus-sig <cplusplus-sig-bounces+jandyman.voelkel=gmail.com at python.org> on behalf of Torsten Knüppel <brumfessor at gmx.net>
Reply-To: Development of Python/C++ integration <cplusplus-sig at python.org>
Date: Wednesday, April 29, 2020 at 7:34 AM
To: "cplusplus-sig at python.org" <cplusplus-sig at python.org>
Subject: [C++-sig] Compiling boost python

Dear all,

I'm trying to compile boost.python with a version of python, that I've downloaded and built myself.
Is the "No-install quickstart"-page (https://www.boost.org/doc/libs/1_73_0/libs/python/doc/html/building/no_install_quickstart.html) still updated, because some of the links are broken and
I honestly don't understand what is going on there.
Some questions that I have:
 - What is the bjam "build driver"? When I go to Section 5 of the boost Getting Started page - they mention something about an easy install option and another one for custom binaries.
  The entire page mentions neither bjam, nor "build driver".
 - I manage to build boost, by first running the bootstrap script and then calling b2 - if I select e.g. graph - it is built and copied into the correct directory, that I've specified. However,
   it doesn't work with my own Python folder.
  I wrote a small script to automate all steps:

#wget https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.gz
#tar -xvf boost_1_73_0.tar.gz
cd boost_1_73_0
./bootstrap.sh --prefix=../build_boost --with-libraries=python -with-python-root=../Python-3.6.10 --with-python-version=3.6
./b2 install -d+2
echo "using python : : ../Python-3.6.10/python ;" > user-config.jam

My folder structure is as follows:

buildBoost.sh (the script above)
     /Python-3.6.10 (contains the python source code and binaries that I've build myself)
     /boost_1_73_0 (boost source code as downloaded by the script)
     /build_boost (output folder as specified by prefix)

When do I need to write this user-config.jam file? What are the compilation scripts looking for - can this process be debugged?
I also have boost installed via apt - now I think that everytime I call b2 or bjam it uses
the global versions of these programs, instead of the ones contained in the boost-directory I'm compiling - is that an issue?

Thanks in advance.
torsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20200429/2a397f95/attachment.html>


More information about the Cplusplus-sig mailing list