Symbol Lookup Error in Example 1a and 3.1

In example 1a and 3.1, in lesson 3 ros bridge, when running the bridge to route the “hello world” message from ROS1->ROS2, I got a symbol lookup error. The commands are run in separate terminals in the order:

1

. /home/user/.bashrc_bridge
ros2 run ros1_bridge dynamic_bridge

2

. /home/user/.bashrc_ros1
rosrun rospy_tutorials talker

3

. /home/user/.bashrc_ros2
ros2 run demo_nodes_cpp listener

where the output in the third terminal is

user:~$ ros2 run demo_nodes_cpp listener
/opt/ros/foxy/lib/demo_nodes_cpp/listener: symbol lookup error: /opt/ros/foxy/lib/demo_nodes_cpp/listener: undefined symbol: _ZNK12class_loader11ClassLoader14getLibraryPathB5cxx11Ev

I tried the method mentioned in https://get-help.robotigniteacademy.com/t/symbol-lookup-error-in-example-3-1/12536, but it didn’t work.

Any help is appreciated.

This is the wrong course to be posting about this, notice it is a ROS course, not ROS2

Let’s try to isolate the issues, so a few questions:

  1. Have you tried running the ros2 node by itself? If you get the same error by publishing a message that the subscriber will catch, then we can assume that the issue is not with the ros1 bridge, but with the listener node

  2. Do you see an output from the terminal where you launched the bridge? If not, then that means that it isn’t working properly

  3. Do you understand what you are doing by using the commands . /home/user/.bashrc_bridge, . /home/user/.bashrc_ros1 and . /home/user/.bashrc_ros2? You are setting up the terminals in the same way that if you were to source workspaces directly from the terminal. There is extra sourcing happening in those, so here is the minimal that you should do without those scripts and have that example running.

  • As you know from the course, you must source both ROS1 and ROS2 in order in the terminal where you launch the bridge. To source both installations, you should do the following, as well as specifying that you want all topics to be bridged. You should see an output in that terminal indicating that the bridge is working:
source /opt/ros/noetic/setup.bash
source /opt/ros/foxy/setup.bash
ros2 run ros1_bridge dynamic_bridge --bridge-all-topics
  • For the talker/listener examples, they are installed in binary in both ROS installation (these are packages that you did not create, but are installed already in the system). That is why you should be able to only source the installations and have them working. If the autocomplete works with tab, then you know the system can find them, so:
source /opt/ros/noetic/setup.bash
rosrun rospy_tutorials talker

for the talker. Make sure you are actually talking by doing an echo. For the listener:

source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp listener

Thank you for your answer. I think the issue is in the ROS2 environment. There is no output after I “source /opt/ros/foxy/setup.bash”. I tried using Tab and the system can auto-complete the command of launching demo_node_cpp listener. However, the error still appear when I enter the command “ros2 run demo_nodes_cpp listener”, which gives me the following error:

Above is the output I tried running ros2 node by itself. That’s why I think there are some issues with ROS 2 environment.

Hi roalgoal, after 5 months I revisited this chapter and the issue persists. I think there is something wrong with the workspace associated with my account. Maybe a reset could make this right.

ros2 run image_tools showimage and ros2 run demo_nodes_cpp listener give me errors but ros2 run demo_nodes_cpp add_two_ints_client works fine, not sure why