ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Undefined reference with tf and rospy

asked 2014-06-11 21:33:35 -0500

bjem85 gravatar image

updated 2014-06-11 22:09:11 -0500

Hi All,

I am having a problem with an undefined reference when attempting to use tf with rospy.

The error message is:

[imu_cmp_sync_stick-16] process has died [pid 8677, exit code 1, cmd /home/mech801/catkin_ws/src/ros_opto22/src/imu_cmp.py imu1:=/imu_sync/stick_imu __name:=imu_cmp_sync_stick __log:=/home/mech801/.ros/log/6aec55c6-f1d8-11e3-a955-0002b333179f/imu_cmp_sync_stick-16.log].
log file: /home/mech801/.ros/log/6aec55c6-f1d8-11e3-a955-0002b333179f/imu_cmp_sync_stick-16*.log
Traceback (most recent call last):
  File "/home/mech801/catkin_ws/src/ros_opto22/src/imu_cmp.py", line 46, in <module>
    import tf
  File "/home/mech801/catkin_ws/devel/lib/python2.7/dist-packages/tf/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 28, in <module>
ImportError: /home/mech801/catkin_ws/devel/lib/python2.7/dist-packages/tf/_tf.so: undefined symbol: _ZN3ros7console13g_initializedE

Clearly there is a problem with the linking of the function ros::console::g_initialized(). However, I am not sure how to fix it, as this is a Python program and I am getting a C++ linker error.

catkin_make works fine, even on a 100% clean catkin_ws directory (i.e. devel and build directories deleted before running catkin_make again).

The python code segment that causes the error is an import tf directive. This can be proved by running python and attempting to import tf at the command prompt.

>>> import tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mech801/catkin_ws/src/geometry/tf/src/tf/__init__.py", line 28, in <module>
    from _tf import *
ImportError: No module named _tf

Note that the tf package has been installed and its directory tree exists as /opt/ros/groovy/lib/python2.7/dist-packages/tf. I am not sure why it's trying to read it form my local catkin_ws directory tree.

Thanks, Bart

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-06-12 02:17:06 -0500

ahendrix gravatar image

updated 2014-06-13 12:16:32 -0500

It looks like you have the geometry stack (which contains tf) checked out into you local workspace, and you have your local workspace set up as an overlay on the system install, which is why it's preferring your local copy over the system install of tf.

The tf python module is implemented in C++, which is why you can get dynamic linker errors when trying to load it.

There are two things that could be causing this linking error, both related to ABI problems:

  • You've upgraded some of your ROS packages, but not all of them, and somewhere along the way an ABI problem crept in. This should go away if you do an apt-get update and apt-get dist-upgrade to install the latest versions of everything.
  • You've upgraded your ROS packages since building tf, and the ABI of one of the packages it depends on has changed. You can try removing the build and devel folders in your workspace and rebuilding everything.
edit flag offensive delete link more

Comments

Thanks, I'll have to check on the workspace overlays. To cut a long story short another package had defined its own implementation of `tf` which was being used ahead of the system one. Cleaning out the `catkin_ws/src` directory tree of all but essential modules fixed the problem.

bjem85 gravatar image bjem85  ( 2014-06-12 21:39:02 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-06-11 21:33:35 -0500

Seen: 1,549 times

Last updated: Jun 13 '14