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

roslz4 linking against the wrong python version #923

Closed
spaghetti- opened this issue Oct 31, 2016 · 5 comments
Closed

roslz4 linking against the wrong python version #923

spaghetti- opened this issue Oct 31, 2016 · 5 comments

Comments

@spaghetti-
Copy link

Something with the CMakeFiles.txt of roslz4 makes it disregard python overrides. On my most recent compilation os MacOS Sierra -

./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/kinetic -DSETUPTOOLS_DEB_LAYOUT=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo  -DCMAKE_PYTHON_EXECTUABLE=`which python` -DCMAKE_PYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib --pkg roslz4
❯ python -c "import rosbag"
Fatal Python error: PyThreadState_Get: no current thread
[1]    89264 abort      python -c "import rosbag"

Because

❯ otool -L _roslz4.so
_roslz4.so:
        _roslz4.so (compatibility version 0.0.0, current version 0.0.0)
        libroslz4.dylib (compatibility version 0.0.0, current version 0.0.0)
        /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
        /usr/local/opt/lz4/lib/liblz4.1.dylib (compatibility version 1.0.0, current version 1.7.1)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)

Fixed by

install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /usr/local/Frameworks/Python.framework/Versions/2.7/Python _roslz4.so

It shouldn't happen because I specified my python libs, so it could be a bug.

@dirk-thomas
Copy link
Member

The package is using the Python include dir as well as Python library detected in CMake (

find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
). I don't know if / how the CMake module takes your arguments into considerations. The code of the Python CMake module will show what is happening and if there is a way to pass a specific library dir.

@mikepurvis
Copy link
Member

In ros-install-osx, we set PYTHON_LIBRARY and PYTHON_INCLUDE_DIR; this has seemed to work consistently, at least when targeting brewed python:

https://github.com/mikepurvis/ros-install-osx/blob/fb9febdcfa9b965b0b6f347f4963d9277b1d1b26/install#L159-L160

@mikepurvis
Copy link
Member

Note that as of Trusty, there's an upstream lz4 package; as of Xenial, there's an upstream python-lz4 bindings package:

http://packages.ubuntu.com/source/trusty/lz4
http://packages.ubuntu.com/source/xenial/python-lz4

Potentially for Lunar+, the roslz4 package could be hollowed out and made to delegate to these system implementations.

@oliverlee
Copy link

In ros-install-osx, we set PYTHON_LIBRARY and PYTHON_INCLUDE_DIR; this has seemed to work consistently, at least when targeting brewed python:

This still links to the wrong Python (at least for me) since roslz4 uses (deprecated) PYTHON_INCLUDE_PATH instead of PYTHON_INCLUDE_DIR.

@alper111
Copy link

This is still an issue on MacOS Catalina, and the solution @spaghetti- mentioned works for me.

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

5 participants