[C++-sig] Boost Python Wrong Python Version macOS

Mortimer Hemmit mortimer.hemmit at gmail.com
Sun Sep 6 12:54:35 EDT 2020


Hi Stefan,

Apologies for breaking the reply chain; I wasn't subscribed to the
list earlier, so this is the only message I could reply to. Now I
should be able to reply to other messages.

Thanks for your email. I don't think that ./b2 has the option to
specify the python version within --with-python - I think only
./bootstrap does. When I tried

./b2 --with-python=3.7

I got;

*****BEGIN OUTPUT*****
error: wrong library name 'python=3.7' in the --with-<library> option.
*****END OUTPUT*****

Then, I tried invoking ./b2 with option python=3.7.

sudo ./b2 python=3.7 --with-python

*****BEGIN OUTPUT*****
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/feature.jam:491:
in feature.validate-value-string from module feature
error: "3.7" is not a known value of feature <python>
error: legal values: "2.7"
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/property.jam:333:
in validate1 from module property
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/property.jam:359:
in property.validate from module property
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/build-request.jam:271:
in convert-command-line-element from module build-request
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build/build-request.jam:222:
in build-request.convert-command-line-elements from module
build-request
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/build-system.jam:774:
in load from module build-system
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/kernel/modules.jam:295:
in import from module modules
/Users/Mort/Downloads/boost_1_74_0/tools/build/src/kernel/bootstrap.jam:139:
in boost-build from module
/Users/Mort/Downloads/boost_1_74_0/boost-build.jam:17: in module scope
from module
*****END OUTPUT*****

Either way, it seems like the ./b2 program doesn't recognize version
3.7, only 2.7.

Let me know if you need any more information. Any help is greatly appreciated.

Thanks,
Mortimer



On Thu, Sep 3, 2020 at 2:19 PM Mortimer Hemmit
<mortimer.hemmit at gmail.com> wrote:
>
> Hello,
>
> I am trying to build the Python library for Boost 1.74.0 on macOS
> Catalina 10.15.8 with the default Clang 11.0.3. I also installed
> Python 3.7.9 from python.org
>
> I am following the instructions located at
> <https://www.boost.org/doc/libs/1_74_0/more/getting_started/unix-variants.html#easy-build-and-install>
> and <https://www.boost.org/doc/libs/1_74_0/libs/python/doc/html/building/installing_boost_python_on_your_.html>
>
> I untar the archive and then execute this command in the boost directory:
>
> ./bootstrap.sh --with-python=python3.7 --with-libraries=python
>
> This gives me output saying that it detected python 3.7.
>
> *****BEGIN OUTPUT*****
> Building Boost.Build engine with toolset clang... tools/build/src/engine/b2
> Detecting Python version... 3.7
> Detecting Python root... /Library/Frameworks/Python.framework/Versions/3.7
> Unicode/ICU support for Boost.Regex?... not found.
> Backing up existing Boost.Build configuration in project-config.jam.1
> Generating Boost.Build configuration in project-config.jam for clang...
>
> Bootstrapping is done. To build, run:
>
> ./b2
>
> To generate header files, run:
>
> ./b2 headers
>
> To adjust configuration, edit 'project-config.jam'.
> Further information:
>
> - Command line help:
> ./b2 --help
>
> - Getting started guide:
> http://www.boost.org/more/getting_started/unix-variants.html
>
> - Boost.Build documentation:
> http://www.boost.org/build/
> *****END OUTPUT*****
>
> Then, I run
>
> sudo ./b2 --with-python
>
> However, when it builds the libraries, it saves it with a folder path
> that has 2.7, and I get files such as libboost_python27.dylib.
>
> *****BEGIN OUTPUT*****
> In file included from
> /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/numpy/ufuncobject.h:327:
> *****END OUTPUT*****
>
> /System/Library is where the default macOS Python 2.7 is stored.
>
> How can I convince Boost to use the Python 3.7 that I installed,
> instead of the default Python 2.7? It looked like it detected it in
> bootstrap, but it doesn't use it later. Is the way that I specified
> the desired python executable correct?
>
> Any help or guidance is greatly appreciated.
>
> Thank you,
> Mortimer


More information about the Cplusplus-sig mailing list