Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boost::python v1.63 mangles py2 for py3 build with numpy #96

Closed
abemammen opened this issue Jan 3, 2017 · 12 comments
Closed

boost::python v1.63 mangles py2 for py3 build with numpy #96

abemammen opened this issue Jan 3, 2017 · 12 comments

Comments

@abemammen
Copy link

with the integration of numpy into v1.63, it appears there is mangling of python2 libs for python3 environments.
Run time error:
Symbol not found: _PyClass_Type
Referenced from: /usr/local/opt/boost-python/lib/libboost_python.dylib

built on mac with brew:
brew install boost
brew install boost-python --with-python3

@stefanseefeld
Copy link
Member

I just tried

$ brew install boost-python --with-python3 

which resulted in a command

./bootstrap.sh --prefix=/usr/local/Cellar/boost-python/1.63.0 --libdir=/usr/local/Cellar/boost-python/1.63.0/lib --with-libraries=python --with-python=python --with-python-root=/System/Library/Frameworks/Python.framework/Versions/2.7
...

I don't know the brew tool and how it translates its own command-line arguments into sub-commands, but the above looks clearly wrong. I suggest you report this to the brew project instead.

@abemammen
Copy link
Author

abemammen commented Jan 3, 2017 via email

@stefanseefeld
Copy link
Member

Oh, now I see what you are reporting: while the boost_python library is built twice, once as libboost_python and once as libboost_python3, there is only libboost_numpy, i.e. presumably the python3-version of it should be named libboost_numpy3, rather than having the same name as the python-version. Correct ?

@abemammen
Copy link
Author

abemammen commented Jan 3, 2017 via email

@stefanseefeld
Copy link
Member

stefanseefeld commented Jan 3, 2017

OK, then I'm not quite sure what you are saying:
After the build, you have libboost_python.dylib and libboost_python3.dylib, as well as libboost_numpy.dylib and libboost_numpy3.dylib. But rather than having libboost_python3.dylib and libboost_numpy3.dylib referencing symbols in libpython3.x.dylib, they are referencing symbols in libpython2.x.dylib ? Is that what you are saying ?

In other words: could you please give a specific test case that should pass but fails ?

@abemammen
Copy link
Author

abemammen commented Jan 3, 2017 via email

@stefanseefeld
Copy link
Member

OK, I believe I see the problem. Can you try out this patch:

diff --git a/build/Jamfile b/build/Jamfile
index 313fdab..235c519 100644
--- a/build/Jamfile
+++ b/build/Jamfile
@@ -140,7 +140,7 @@ rule lib_boost_numpy ( is-py3 ? )
             [ cond [ python.numpy ] : <library>/python//python_for_extensions ]
             [ unless [ python.numpy ] : <build>no ]
            <include>$(numpy-include)
-           <library>boost_python
+           [ cond $(is-py3) : <library>boost_python3 : <library>boost_python ]
             <python-debugging>on:<define>BOOST_DEBUG_PYTHON
             [ cond $(is-py3) : <python>$(py3-version) ]
 

(to the libs/python/build/Jamfile file in the boost source tree) ?

@abemammen
Copy link
Author

abemammen commented Jan 3, 2017 via email

@abemammen
Copy link
Author

That worked. Can this change be rolled into the repo? I would like to get it from and build with brew. I have a linux version to configure and build as well so would prefer to get this change directly from source.

@stefanseefeld
Copy link
Member

Great, thanks for testing ! Yes, I will roll it into the develop branch (and eventually merge into master). Can you build from the github repo ?

Thanks for raising this and helping me understand !

@abemammen
Copy link
Author

I didn't build from the github repo but instead just grabbed the downloaded version that Brew had initiated via:
https://downloads.sourceforge.net/project/boost/boost/1.63.0/boost_1_63_0.tar.bz2.
But I did that for the Linux version so I can do the same - I just need to know the name of the develop branch.

@stefanseefeld
Copy link
Member

I just pushed the fix to the develop branch in https://github.com/boostorg/python/, so you should be able to build from there.
Thanks again !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants