rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
713 stars 343 forks source link

undefined symbol: _ZN5boost6system15system_categoryEv #678

Closed N3k4rk closed 5 years ago

N3k4rk commented 5 years ago

I have tried to install openrave 0.15, master branch, commit b1ebe13 from Jan 5. The installation went OK (barring issue #641 ). However, after installation, when trying to launch an example:

openrave.py --example graspplanning

I got the error complaining about undefined symbol: _ZN5boost6system15system_categoryEv.

Full text: $ python program_simple.py failed to import convexdecompositionpy /usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/convexdecompositionpy.so: undefined symbol: _ZN5boost6system15system_categoryEv Traceback (most recent call last): File "program_simple.py", line 2, in from openravepy import File "/usr/local/lib/python2.7/dist-packages/openravepy/init.py", line 33, in openravepy_currentversion = loadstable(openravepy_version) File "/usr/local/lib/python2.7/dist-packages/openravepy/init.py", line 14, in loadstable return _loadversion('openravepy'+ver.replace('.', '_')) File "/usr/local/lib/python2.7/dist-packages/openravepy/init__.py", line 19, in _loadversion mainpackage = import("openravepy", globals(), locals(), [targetname]) File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/init.py", line 41, in from . import databases File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/databases/init__.py", line 273, in import linkstatistics File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/databases/linkstatistics.py", line 72, in from .. import pyANN File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/pyANN.py", line 16, in from pyANN_int import ImportError: /usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/pyANN_int.so: undefined symbol: _ZN5boost6system15system_categoryEv

I have tried 3 different configurations. All ended with the same result.

  1. Fresh install Ubuntu 18.04 with Boost version 1.65 (googling hinted that the error might be boost-related)
  2. Fresh install Ubuntu 16.04 with Boost version 1.58
  3. Updating existing installation Ubuntu 16.04 with Boost 1.58 that has been already running Openrave fine (version 0.9, commit 7c5f5e2).

After installing the new version alongside the old one, I have added version selection to my python code. So the first two lines were: builtins.__openravepy_version__ = '0.15' from openravepy import *

When I set the version to 0.9, openrave launched correctly.

N3k4rk commented 5 years ago

Possible workaround: delete these 3 lines from python/bindings/CMakeLists.txt:

if(NOT OPENRAVE_DISABLE_ASSERT_HANDLER) add_definitions("-DBOOST_ENABLE_ASSERT_HANDLER") #turns segfault into exception endif()

then cmake, make, make install again.

Note: these lines were introduced in commit 0ae68c5a5d748e61eac4783625185482f0c98cb8 on 9th july 2018, if anyone wants to have a look and find an actual solution, rather than just commenting them out.

That allowed the example to run in my case. This was with boost 1.58 on ubuntu 18.04. Havent tested with other boost versions. Boost version installed as per instructions from https://github.com/crigroup/openrave-installation (commit c4d32c9) in install-dependencies.sh But it couldnt download from the address in that script, so I downloaded boost manually from https://sourceforge.net/projects/boost/files/boost/1.58.0/.

cielavenir commented 5 years ago

@N3k4rk could you check ldd /usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/pyANN_int.so? If libboost_system is not listed, could you try to change python/bindings/CMakeLists.txt?

before

        target_link_libraries(pyANN_int PUBLIC ${STDC_LIBRARY} ANN ${PYTHON_LIBRARIES} ${Boost_PYTHON_LIBRARY} ${Boost_THREAD_LIBRARY} ${extralibs}
                                        PRIVATE boost_assertion_failed)

after

        target_link_libraries(pyANN_int PUBLIC ${STDC_LIBRARY} ANN ${PYTHON_LIBRARIES} ${Boost_PYTHON_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${extralibs}
                                        PRIVATE boost_assertion_failed)
N3k4rk commented 5 years ago

Default state:

ldd /usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/pyANN_int.so
    linux-vdso.so.1 (0x00007ffe6e956000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f979c634000)
    libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f979c0b7000)
    libboost_python.so.1.58.0 => /usr/local/lib/libboost_python.so.1.58.0 (0x00007f979be6e000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f979bc56000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f979b865000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f979b4c7000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f979ccb1000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f979b2aa000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f979b08b000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f979ae87000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f979ac84000)

After adding boost system to target_link_libraries:

ldd /usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_15/pyANN_int.so
    linux-vdso.so.1 (0x00007ffe351ce000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb9c2e5b000)
    libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007fb9c28de000)
    libboost_python.so.1.58.0 => /usr/local/lib/libboost_python.so.1.58.0 (0x00007fb9c2695000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb9c247d000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb9c208c000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb9c1cee000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb9c34d8000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb9c1ad1000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb9c18b2000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb9c16ae000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fb9c14ab000)

So no difference it seems

cielavenir commented 5 years ago

Actually the bad guy is this:

root@ubuntu-xenial:/openrave/python/bindings# nm ../../src/libboost_assertion_failed.a|grep category
                 U _ZN5boost6system15system_categoryEv
                 U _ZN5boost6system16generic_categoryEv

so, please try adding #define BOOST_SYSTEM_NO_DEPRECATED at the top of src/boost_assertion_failed.cpp.

// -*- coding: utf-8 -*-
// Copyright (C) 2018 Rosen Diankov
#if !defined(OPENRAVE_DISABLE_ASSERT_HANDLER) && (defined(BOOST_ENABLE_ASSERT_HANDLER))

#define BOOST_SYSTEM_NO_DEPRECATED
#include <openrave/openrave.h>
#include <boost/format.hpp>

However why Debian does not require this fix is unknown yet.

# Well it was lucky that I had ubuntu provisioner in https://github.com/cielavenir/mujin_recruiting .

cielavenir commented 5 years ago

https://stackoverflow.com/questions/9723793/undefined-reference-to-boostsystemsystem-category-when-compiling

cielavenir commented 5 years ago

found the reason: https://www.google.com/search?q=as-needed+ubuntu

this roughly means openrave stopped working on ubuntu since boost_assertion_failed was introduced...

rdiankov commented 5 years ago

@cielavenir did you check that defining BOOST_SYSTEM_NO_DEPRECATED will fix the problem? thanks

cielavenir commented 5 years ago

@rdiankov I have already checked, but I confirmed just now. It will fix the problem.