Linking error libtf.so

asked 2020-05-02 16:28:15 -0500

ROS__ROS gravatar image

updated 2022-05-28 17:09:16 -0500

lucasw gravatar image

Hi all,

I'm linking the TF library, but somehow I get a linking error in the TF library. I already tried to reinstall the TF package but somehow i can't get it working. This is the error I get:

/opt/ros/melodic/lib/libtf.so: undefined reference to `tf2_ros::TransformListener::TransformListener(tf2::BufferCore&, ros::NodeHandle const&, bool)'
collect2: error: ld returned 1 exit status
edit retag flag offensive close merge delete

Comments

Hello, I have the same problem! Have you managed to solve this issue?

bboylevi89@gmail.com gravatar image bboylevi89@gmail.com  ( 2020-07-19 18:48:53 -0500 )edit

Yes, somehow it was linking against the wrong TF library which was inside of my repo. I removed them from my own repository and got it working.

ROS__ROS gravatar image ROS__ROS  ( 2020-07-21 06:17:20 -0500 )edit

Did u mean the "libtf.so" is the wrong one and the correct one is "libtf2.so"? Thanks!

bboylevi89@gmail.com gravatar image bboylevi89@gmail.com  ( 2020-07-21 06:32:19 -0500 )edit

First test the TF library in a new project and see if it works. In case it works, there is nothing wrong with your ROS installation. In my case it worked in another project, so I knew the fault was in my repository. I'm not really sure what you mean, but in my case I had to remove a lot of TF files which were in my local repository and I linked them from my installation instead.

ROS__ROS gravatar image ROS__ROS  ( 2020-07-29 06:52:31 -0500 )edit

hello, I am having this issue but still do not know how to solve it?

sal gravatar image sal  ( 2022-04-12 15:23:13 -0500 )edit

Can you please elaborate? Where were the additional TF files in your repository? Which files did you delete? Which TF library was in your project to begin with?

I am having a similar issue while trying to transfer a project from melodic to noetic.

TankyFranky gravatar image TankyFranky  ( 2023-02-09 19:02:21 -0500 )edit

My Setup and Solution: Moving from Melodic to Noetic, I originally had the geometry2 source package in my workspace. This is the package I assume the above comments are talking about. Geometry2 contains tf2 and many other tf related packages.

The problem is the order of operations. Before ever calling catkin_make, be sure to first remove the geometry2 package and be sure you have it installed as a rospkg sudo apt install ros-noetic-geometry2. The you can catkin_make as you would normaly.

Probable cause: libtf.so links to the wrong geometry2 package and cant be changed using catkin_make even after deleting the source geometry2 package. My solution was to restore my workspace from a backup, then delete the geometry2 source package, then call catkin_make. In that order specifically. I'm guessing you can just copy your files into a new workspace if you don't have a backup.

TankyFranky gravatar image TankyFranky  ( 2023-02-09 19:29:32 -0500 )edit