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

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

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

Constantin S gravatar image

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

joq gravatar image

All,

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
0

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

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

Comments

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 -0600 )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 -0600 )edit

Question Tools

Stats

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

Seen: 1,844 times

Last updated: Oct 12 '12