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

Execution error in 02-ExposingClasses example #17

Closed
vgauthier opened this issue Oct 21, 2017 · 3 comments
Closed

Execution error in 02-ExposingClasses example #17

vgauthier opened this issue Oct 21, 2017 · 3 comments

Comments

@vgauthier
Copy link

Hello,

Thank you for making public this repository

I have an issue with the following example "02-ExposingClasses". After a successful compilation when I executing the classes.py I have the following error:

Traceback (most recent call last):
  File "classes.py", line 5, in <module>
    t = classes.World()
TypeError: __init__() should return None, not 'NoneType'

I am using:

  • osx 10.13
  • python 3.6 anaconda
  • boost 1.65.1

in the build.sh I configured the following variables

  • PYTHON_VERSION="3.6m"
  • PYTHON_LIBRARY=/usr/local/anaconda/lib/libpython$PYTHON_VERSION.dylib
  • PYTHON_INCLUDE_DIR=/usr/local/anaconda/include/python$PYTHON_VERSION
  • BOOST_ROOT=/usr/local/anaconda

I checked that the classes.so was linked correctly

> otool -L classes.so
classes.so:
	@rpath/libboost_python3.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libpython3.6m.dylib (compatibility version 3.6.0, current version 3.6.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)

Thank

Best regards,
Vincent

@vgauthier vgauthier changed the title 02-ExposingClasses Execution error in 02-ExposingClasses example Oct 21, 2017
@Achimh3011
Copy link
Member

I can reproduce the problem with boost-python installed by homebrew.

@Achimh3011
Copy link
Member

Can you run otool -Lon your libboost_python3.dylib? Most of the internet thinks that a library version mismatch is responsible for this kind of error.

@Achimh3011
Copy link
Member

I came across this problem again and this time I could solve it: make sure that you use exactly matching python interpreter, python library and boost library.

It's not easy to get that working on OSX, but that's the key. I'll try to improve build.sh, but feel free to set the necessary variabled yourself.

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

No branches or pull requests

2 participants