I've been struggling for days to get image_proc
for ROS2 going. It links to vision_opencv
which in turn links to libboost_python3
.
Now trying to run this I get the familiar:
dyld: Symbol not found: _PyBaseObject_Type
Referenced from: /usr/local/opt/boost-python3/lib/libboost_python37.dylib
Expected in: flat namespace
in /usr/local/opt/boost-python3/lib/libboost_python37.dylib
Further investigation using the nm
tool yields:
nm -u /usr/local/opt/boost-python3/lib/libboost_python37.dylib | grep _PyBaseObject_Type
_PyBaseObject_Type
That _PyBaseObject_Type
is indeed undefined in libboost_python37.
Let's take a look at what libraries are linked to libboost_python37:
otool -L /usr/local/opt/boost-python3/lib/libboost_python37.dylib
usr/local/opt/boost-python3/lib/libboost_python37.dylib:
/usr/local/opt/boost-python3/lib/libboost_python37.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
It is missing any dynamic link to Python which leads me to my first question:
- Is
python
supposed to be linked tolibboost_python37
?
I've seen on other places online, an old question where someone posted their output from otool -L
where it was included (although it is for the -mt file, my mt does not have it either.)
otool -L libboost_python-mt.dylib
libboost_python-mt.dylib:
/opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
(Their output)
My second question:
- Does anyone know what the problem is or how to solve this?
Things gets a bit more complicated since I'm using the ROS2 build tool colcon
and not just straight up compiling.
Some additional information: Some people suggests that this error solved by linking libboost_python37.dylib to libboost_python3.dylib because it can't be picked up. This is not the issue and it does not solve it.
I've also installed boost and boost-python3 from Brew, as well as compiled it myself, same both places. Python
command is latest python 3.7.3 and it's "default" as in python --version
gives 3.7.3.