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

What is the correct usage of -rpath in manifest.xml?

asked 2011-06-13 10:20:32 -0600

I recently came across this error when running roswtf to try and diagnose the cause of a weird intermittent failure:

ERROR The following packages have rpath issues in manifest.xml: * flyer_controller: found flag "-L/home/bouffard/ros/starmac-ros-pkg/starmac_flyer/flyer_controller/lib", but no matching "-Wl,-rpath,/home/bouffard/ros/starmac-ros-pkg/starmac_flyer/flyer_controller/lib"

The manifest actually has this (note the -L after the rpath):

  <export>
    <nodelet plugin="${prefix}/flyer_controller_nodelets.xml"/>
    <cpp cflags="-I${prefix}/include" 
         lflags="-L${prefix}/lib -Wl,-rpath,-L${prefix}/lib -lros"/>
  </export>

.. and the package (and others which depend on it and use the library) does build and seems to work.

If I remove that -L then the roswtf error goes away. However according to the example on the Manifest/XML wiki page the -L should be present; I don't actually know what all these flags do but the -L just seems out of place there to me. My guess is that the wiki page is incorrect, but I don't quite see how I never had build problems with the wrong syntax.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-06-13 10:56:05 -0600

Brian Gerkey gravatar image

The wiki page was incorrect. I just fixed it. You shouldn't supply the -L prefix when specifying a -rpath directory to the linker.

To parse out the incantation: -Wl,foo,bar,bat,bang tells the compiler to pass to the linker foo, bar, bat, and bang, in that order, as space-separated arguments. So when you say -Wl,-rpath,/path/to/my/lib, the linker will get -rpath /path/to/my/lib. And in that context, the linker doesn't want the -L prefix on the directory (not sure whether it would behave properly or not).

And in case you're curious, the whole rpath business is needed to allow ROS executables to depend on shared libraries that are sprinkled all throughout the package tree. Otherwise you'd have to put all the directories containing libraries in your LD_LIBRARY_PATH environment variable. With the forthcoming rosbuild2, we'll be moving away from explicit use of rpath arguments, and toward a more conventional way of organizing libraries (including allowing them to be installed into a common location).

Thanks for the report.

edit flag offensive delete link more

Comments

Thanks. Still puzzled why anything ever worked with that error in there, but I'm also content to leave it a mystery.
Patrick Bouffard gravatar image Patrick Bouffard  ( 2011-06-13 12:06:12 -0600 )edit

I love the ROS wiki... your wiki link links to an empty wiki page with a link to another documentation page... which now 404s. Awesome, folks!

Hendrik Wiese gravatar image Hendrik Wiese  ( 2018-01-11 01:55:51 -0600 )edit

Question Tools

Stats

Asked: 2011-06-13 10:20:32 -0600

Seen: 915 times

Last updated: Jun 13 '11