Ask Your Question

Backwards Compatible Ros Commands To Find System Headers (Fuerte -> Electric)

asked 2012-10-12 11:29:10 -0500

Constantin S gravatar image

updated 2012-10-12 11:50:57 -0500

joq gravatar image


I am trying to update some CMake files for a colleague since he is using Electric and I need to use Fuerte. I would like to update the CMake files using ROS's CMake macros, environment variables and console commands... Note these are not rosmake files but simple cmake files that use some of ROS's libraries.

However, some of the core headers (such as rosbag.h or ros.h) no longer follow a simple rospack find [package]. This call returns me to /opt/ros/fuerte/share directory.

Is it possible to somehow use rosbuild_find_ros_package and prefix /include in such a way that it works for all packages in Fuerte and Electric

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-10-12 21:59:02 -0500

Lorenz gravatar image

I do not really understand the actual problem. What do you mean with 'rosmake files'? I never had problems to build electric nodes under fuerte and vice versa apart of some tf related issues.

If your problem is that you cannot use the builtin rosbuild macros (which should definitely work in both distros), I guess it might be because you are using rospack find to generate cflags and ldflags. Use rospack export instead. For instance, to get the cflags, you can call:

rospack export --lang=cpp --attrib=cflags

and to get the linker flags:

rospack export --lang=cpp --attrib=lflags

Rosbuild uses exactly these commands to infer the correct flags, i.e. it does not use rospack find for generating compiler and linker flags.

edit flag offensive delete link more


Hi Lorenz, I am not build a node but a separate c++ program that happens to use ROS libraries... My colleague succeeded in this but he hardcoded a lot of paths. I would like to redo his CMake's with non hardcoded paths so both Electric and Fuerte could be used.

Constantin S gravatar image Constantin S  ( 2012-10-15 08:31:48 -0500 )edit

That's why I'm saying you should not use rospack find to get the path to a package and generate cflags and lflags from that path but you should use rospack export. In cmake, you can use execute_process and then add the output to your cmake flags. Btw. in fuerte you could also use pkgconfig.

Lorenz gravatar image Lorenz  ( 2012-10-15 20:52:32 -0500 )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


Asked: 2012-10-12 11:29:10 -0500

Seen: 849 times

Last updated: Oct 12 '12