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

Use updated headers when building with catkin

asked 2012-10-26 02:10:17 -0500

Hi,

I started using the new catkin-based buildsystem for a recent project (currently with fuerte). It is working quite well and I see the advantages compared to rosbuild, but still there remain a couple of open questions:

  1. Whenever I update a header file in one of the packages I have to delete the include folders in the buildspace and installspace. Otherwise cmake uses the old incompatible header files found in these directories. Is there a way to force the compiler to prefer the source header files?

  2. Which setup.sh should be used when with catkin workspaces? Are the following (simplified) assumptions correct?

  • workspace/setup.sh basically sets the ROS_PACKAGE_PATH. This is required for tools like roscd and rospack. Catkin itself does not use the ROS_PACKAGE_PATH. ROS_MASTER_URI is also set here for whatever reason.
  • buildspace/setup.sh sets the PATH variable and sources further setup files in buildspace/etc/catkin/profile.d, which allows running binaries in buildspace/bin. I assume the libraries in buildspace/lib are found using the rpath mechanism.
  • installspace/setup.sh adds installspace/bin to the PATH and adds installspace/lib to the LD_LIBRARY_PATH, so that installed binaries can be run from there.
  • As the installspace is also part of my workspace as it is shared between multiple workspaces, sourcing workspace/setup.sh would also load the runtime configuration for the installspace.
  • If I want tools like roscd to find the correct source directory of a package, I have to take care that the installspace entries in my workspace/.rosinstall come first and the workspace entries overwrite the package path. The buildspace/setup.sh script has to be sourced separately after workspace/setup.sh, so that the buildspace runtime configuration is used instead of the installspace.

    1. Is it possible to mimic the old in-source build behavior e.g. by setting some cmake variables (use no dedicated buildspace)?
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-10-26 02:38:41 -0500

KruseT gravatar image

The headers issue seems to be a bug, please report on https://github.com/ros/catkin/issues.

Generally using catkin for fuerte may not be a great idea, because catkin for groovy is very different, and supporting both is undesired. So expect better support for catkin with groovy.

In general a workspace should be either a rosbuild workspace with a setup.sh at its root, or a catkin workspace with a CMakeLists.txt at its root. Combining both is just confusing. rosws/rosinstall have a --catkin option used in fuerte to avoid generating a setup.sh and generate a CMakeLists.txt instead.

In a rosbuild workspace, the setup.sh does indeed set the ROS_PACKAGE_PATH. ROS_MASTER_URI should not be set there, that seems like a change that you made yourself (not recommended, because the file may be overwritten).

With catkin you get a setup.sh in the buildspace (soon to be called devel space), and the install space. You should use just one of those, never both. Which one to chose depends on your workflow. The buildspace setup.sh has references to the source space (meaning you can change things in src for immediate effect, e.g. Python files). The installspace setup.sh is independent of the source space.

For roscd to work, your catkin workspace would also need to be in the ROS_PACKAGE_PATH, for which you must currently manually change the variable, and your catkin "packages" would need a manifest.xml. Note that the order in the .rosinstall file are the inverse of the ROS_PACKAGE_PATH, so later entries are preferred for roscd and such.

The buildfiles generally go where you call cmake. If you call cmake for each project individually, you can control where build files will go. This works best with a shared install space and a standard cmake install-to-run workflow.

And again, you can save yourself some trouble if you wait for groovy and learn only the new version of catkin, once it is ready (in a few weeks maybe).

edit flag offensive delete link more

Comments

Thanks for clarification! The header issue was already reported by mirzashah: https://github.com/ros/catkin/issues/200. The setup files in my workspace folder must be some remainings from rosinstall invocations without --catkin. So I am looking forward to the groovy release of catkin...

Johannes Meyer gravatar image Johannes Meyer  ( 2012-10-26 04:35:52 -0500 )edit

Question Tools

Stats

Asked: 2012-10-26 02:10:17 -0500

Seen: 303 times

Last updated: Oct 26 '12