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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Boost - Build mailing list

Hi Mortimer,

let me forward your message to the Boost.Build list, where I hope someone will take appropriate action.

Thanks,

On 2020-09-10 9:24 p.m., Mortimer Hemmit wrote:
Hi Stefan,

Thanks for the advice and the link; they were really helpful.
Just by itself, the line "using python : 3.7 ;" still returned an
error. However, upon reading the link, I could also specify the path
that leads to Python. So, I tried:

using python : 3.7 :
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7

Now, even without explicitly saying the python version,

sudo ./b2 install

began to use the right Python version. However, now the compiler
complained about not finding the file pyconfig.h. Looking at the
output, it seems like the build was specifying the following
nonexistent directory as an include path
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7/".
Actually, pyconfig.h is located inside
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/".
Note the extra "m" at the end (I don't know what the m means though).
Anyway, as per the link you sent, I could add another path to the .jam
file to specify an include directory, so the final line was

using python : 3.7 :
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" :
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/"

Now it compiled relatively smoothly :)

Now, I tried getting it to work without making a user-specific file. I
looked at the boost folder and saw that inside "project-config.jam",
there was a section that said

if ! [ python.configured ]
{
    using python : 3.7 : "/Library/Frameworks/Python.framework/Versions/3.7"
}

When I ran it just like this, it still failed. However, when I edited
"project-config.jam" to go to the exact python executable (not just
the parent directory), it started working, but this time with the
header problem again.

using python : 3.7 :
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7"

So, I added the whole include line from my user file, and now it worked.

using python : 3.7 :
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7" :
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/"

Ultimately, my prediction is that there are two problems:
1) The script ./bootstrap.sh, which generates the project-config.jam,
should print the full path to the python3.7 executable instead of just
the parent directory when given a --with-python=[executable] flag.
2) Somewhere in the build process, an include flag is missing an "m"
at the end which specifies the following nonexistent directory as an
include path "/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7/".
This prevents the compiler from finding pyconfig.h, causing an error.
Actually, pyconfig.h is located inside
"/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/".

However, I'm not sure if these are specific to the version 3.7, or in general.

You have helped me a lot to get this working, and I hope this
information helps you (or someone else) find (and fix!) some of them.

Thank you very much,
Mortimer


On Mon, Sep 7, 2020 at 2:47 PM Stefan Seefeld [hidden email] wrote:
Hi Mortimer,

On 2020-09-06 12:54 p.m., Mortimer Hemmit wrote:

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"

you are entirely right, there is no `--with-python` option to `b2`. Sorry for sending you down a wrong route.

I think what you need is described in https://www.boost.org/doc/libs/1_74_0/libs/python/doc/html/building/configuring_boost_build.html

Create a ~/user-config.jam file containing the line "using python : 3.7 ;"

This informs Boost.Build of the availability of that Python version (depending on your system you may want to add more parameters to specify paths, library name, etc.). You could define multiple versions (one per line), in which case the option `./b2 python=<python-version>` will allow you to select one.

Hope this helps,

--

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________
Cplusplus-sig mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/cplusplus-sig

Stefan
--

      ...ich hab' noch einen Koffer in Berlin...
    

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build