Ask Your Question

How to change glibc linked to?

asked 2020-01-18 16:04:06 -0600

bionade24 gravatar image

updated 2020-01-20 02:32:56 -0600

gvdhoorn gravatar image

Hi, I always get this error:

/usr/bin/ld: CMakeFiles/mechanum_steering_node.dir/__/drive/interface/SocketCAN.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'

When I add Thread as REQUIRED_COMPONENTS and target_link_libraries it works again for this specific package. How can I solve this globally?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-19 07:57:21 -0600

bionade24 gravatar image

updated 2020-01-24 11:48:18 -0600

This happened because all ROS packages link against the libc version roscpp was linked against. You have to recompile roscpp and cpp_common, afterwards try again. If you use the official binaries for Debian/Ubuntu by Open Robotics, this probably isn't the same issue, if you think so, please contact the maintainers. As I use ROS on Archlinux simply had to recompile rostime, cpp-common and roscpp, now everything works again. If the binaries on Arch are linking to wrong libc and I didn't already ran into it, please contact me.

edit flag offensive delete link more


What sort of platform/OS/cpu arch are you doing this for/on?

gvdhoorn gravatar image gvdhoorn  ( 2020-01-19 08:00:26 -0600 )edit

I'm using Arch Linux, packages are built with makepkg.

bionade24 gravatar image bionade24  ( 2020-01-19 14:04:59 -0600 )edit

That is quite important information for (future) readers. It would have been nice if you'd included that in your OP and/or tags.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-20 02:32:33 -0600 )edit

I think that's something that can appear on every Linux Distribution. The libc change, and ROS packages use roscpp to link against the libc, so if roscpp links against the old version, ROS packages will try to link against the old version if you not specify needed libs manually in cmake.

bionade24 gravatar image bionade24  ( 2020-01-24 11:14:24 -0600 )edit

On Debian/Ubuntu it's not that common to build ROS from source. On-top of that, glibc changes are relatively rare on these platforms, and if there are changes, they are guaranteed to be bw-compatible wrt ABI. I'm not 100% certain, but I would be really surprised if I would run into the error message that you posted on those platforms.

Rebuilding a workspace is something that is done on every OS/platform, but what you experienced is something I expect users on non-Debian/Fedora (and derived) platforms to run into sooner.

Hence the request to mention it.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-24 11:37:54 -0600 )edit

But if you for example use, Gentoo, Fedora or an older version of debian/ubuntu or maybe debian unstable, you can run into this issue. Maybe I'll can put the explanation from the comments up to the answer and add that this won't be a solution if you have the latest official binaries.

bionade24 gravatar image bionade24  ( 2020-01-24 11:42:43 -0600 )edit

Fedora or an older version of debian/ubuntu or maybe debian unstable, you can run into this issue

only if you deliberately try to install binary packages that are from another distribution I would say.

Could you give an example of how this could happen if you install the binary packages from the ROS buildfarm that target the same OS (ie: buildfarm provides pkgs for 18.04, user has 18.04)? ABI compatibility is guaranteed for Debian/Ubuntu. They can change glibc, but only in an ABI bw-compatible manner.

Even if roscpp hasn't been rebuilt with a newer glibc version in that case, it should still work, as breaking ABI during the lifetime of a Debian distribution is not allowed afaik.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-24 12:00:25 -0600 )edit

Sorry, I didn't explained my thoughts well. I ment if you for example compile ROS melodic on 16.04 you could probably run into this issue, too. And debian unstable or fedora users using a self-compiled version, too.

bionade24 gravatar image bionade24  ( 2020-01-24 12:28:20 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-01-18 16:04:06 -0600

Seen: 171 times

Last updated: Jan 24 '20