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

Why is --as-needed not explicitly set for ROS workspaces?

asked 2014-03-11 12:52:27 -0600

v4hn gravatar image

updated 2014-03-12 00:27:30 -0600

Hello everyone,

I'm using ROS with a non-Ubuntu linux distribution and hit unexpected bugs quite regularly. This is my newest discovery and it would be great to see this fixed one way or the other:

rosbuild automatically links all libraries of modules listed in manifest.xml to rosbuild targets. This is obviously bloated, but it's fine in ubuntu, because they decided to make their gcc linker default to --as-needed instead of the official --no-as-needed and only reachable libraries are actually linked.

Normally, this is not even a severe bug, but only adds more unwanted links.. However, gazebo decided to add a /usr/lib/gazebo-X.Y/plugins/ folder for some of their libs and this folder is only added to LD_LIBRARY_PATH when gazebo is actually used. In my case, we have a launch-file-only dependency to gazebo. This adds a lot of gazebo libs to all binaries of the module, but doesn't add the gazebo environment at build time. Without --as-needed this produces a linking error because the gazebo libs require libs in gazebo's plugin folder.

Long story short(er):

It seems like at least rosbuild assumes that gcc uses --as-needed which is a non-official default. Although I don't think these severe linking errors would appear with catkin, I'd say catkin assumes this as well (and it does make sense to do that!). Otherwise people should probably be more careful when using the catkin_LIBRARIES variable.

Is it possible to officially add this LDFLAG to the standard cmake framework for rosbuild/catkin?

-- EDIT -- I ask this question here instead of talking to a ROS package manager directly, because I got absolutely no idea in which package this would have to be added. Any ideas?

edit retag flag offensive close merge delete

Comments

I'm confused; are you using rosbuild or catkin?

ahendrix gravatar image ahendrix  ( 2014-03-11 13:42:53 -0600 )edit

The module which produces the gazebo error I explained is based on rosbuild. But the underlying problem of heavily overlinking things built within ROS also applies to catkin. There, one uses catkin_LIBRARIES, which usually gives you more than you need for a single target in a larger module.

v4hn gravatar image v4hn  ( 2014-03-11 14:23:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-08-29 16:37:02 -0600

tfoote gravatar image

Since it's the default behavior on most of our systems it hasn't been necessary during development. If we are relying on that behavior and it's not globally a default it's worth considering explicitly calling out that option. I suggest you open a ticket on catkin for this to be considered.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-03-11 12:52:27 -0600

Seen: 464 times

Last updated: Aug 29 '14