Linking error libtf.so
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
Hello, I have the same problem! Have you managed to solve this issue?
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.
Did u mean the "libtf.so" is the wrong one and the correct one is "libtf2.so"? Thanks!
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.
hello, I am having this issue but still do not know how to solve it?
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.
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 rospkgsudo apt install ros-noetic-geometry2
. The you cancatkin_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.