ros2 / rosbag2_bag_v2

rosbag2 plugin for replaying ros1 version2 bag files
Apache License 2.0
24 stars 4 forks source link

Import Error: Class Loader undefined symbol #31

Closed togaen closed 4 years ago

togaen commented 4 years ago

I am getting undefined symbol errors trying to get info on a ROS 1 bag file. I am on ROS 2 Foxy and I installed everything using apt. The bag file has no custom messages, only std_msgs/Header and std_msgs/Float32 messages.

The README states that ROS 1 must be sourced first in order to avoid problems with the class loader. The relevant section of my bashrc looks like this:

source /opt/ros/noetic/setup.bash                                               
source /opt/ros/foxy/setup.bash

Even so, I get the below error:

$ ros2 bag info -s rosbag_v2 bag.bag
Traceback (most recent call last):
  File "/opt/ros/foxy/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.9.7', 'console_scripts', 'ros2')()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2bag/command/bag.py", line 38, in main
    return extension.main(args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2bag/verb/info.py", line 40, in main
    from rosbag2_transport import rosbag2_transport_py
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosbag2_transport/__init__.py", line 38, in <module>
    rosbag2_transport_py = _import('._rosbag2_transport_py')
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosbag2_transport/__init__.py", line 27, in _import
    return importlib.import_module(name, package='rosbag2_transport')
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /opt/ros/foxy/lib/librosbag2_storage.so: undefined symbol: _ZNK12class_loader11ClassLoader15isLibraryLoadedEv
The C extension '/opt/ros/foxy/lib/python3.8/site-packages/rosbag2_transport/_rosbag2_transport_py.cpython-38-x86_64-linux-gnu.so' failed to be imported while being present on the system. Please refer to 'https://index.ros.org/doc/ros2/Troubleshooting/#import-failing-even-with-library-present-on-the-system' for possible solutions

Also, the link given in the error message doesn't seem to point to an existing section anymore: https://github.com/ros2/rosbag2/issues/458

Karsten1987 commented 4 years ago

Could you please verify that you source first noetic followed by foxy? Make sure you have a fresh terminal and no modifications in your bashrc. I can reproduce your error when sourcing foxy before noetic. However, when noetic is sourced first, it works just fine for me.

Karsten1987 commented 4 years ago

I am going to close this issue as I think this issue is solved by sourcing noetic before foxy. @togaen Please don't hesitate to re-open this ticket in case your problem still persists.

togaen commented 4 years ago

@Karsten1987 Sorry I missed your reply, somehow I had notifications turned off. I am still seeing this error even in a fresh terminal with a bashrc containing the following:

source /opt/ros/noetic/setup.bash                                               
source /opt/ros/foxy/setup.bash

If it's relevant, I also get this message every time I open a terminal:

ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
ROS_DISTRO was set to 'noetic' before. Please make sure that the environment does not mix paths from different distributions.

Would have any ideas what else might be going on?

togaen commented 3 years ago

In case anyone else has this issue, it turned out for me to just be that the ROS paths had be set session-wide instead of just per shell session. Setting the right source order then logging out and back in fixed it for me.

dringlourious commented 1 year ago

any update now?

dra2494 commented 1 year ago

Hello all,

having the same error, even if noetic is sourced first in the fresh terminal. Any help would be much appreciated

doraemon96 commented 1 year ago

Hi! I'm having the same issue, working from a fresh docker (FROM osrf/ros:foxy-desktop)

If anyone was able to find a solution and can provide a Dockerfile with steps I'd be more than grateful!

Madhav2133 commented 1 year ago

Hi all, I am facing same issue. I use ros2-galactic

ImportError: /opt/ros/galactic/lib/librosbag2_storage.so: undefined symbol: _ZNK12class_loader11ClassLoader15isLibraryLoadedEv

Please let me know if there's any resolve for this issue. Thanks

OlgaMatykina commented 10 months ago

If you use docker and into.sh, you should check that foxy isn't sourced in into.sh