[ros-users] rosmake doesn't wait for rosbuild_gensrv to complete

Brian Gerkey gerkey at willowgarage.com
Mon Apr 18 16:16:23 UTC 2011


On Mon, Apr 18, 2011 at 8:50 AM, Mike Vande Weghe <vandeweg at cmu.edu> wrote:
> I've noticed that for a package that defines a single ROS service and
> that builds a single shared library, the compilation fails the first
> time through because the header file for the service has not yet been
> completed.  When I do a second rosmake the compilation succeeds.  Do
> service generation and code compilation happen in parallel, and if so is
> there a way to order them?
>
> My CMakeLists.txt looks like this:
> -------------------------------------------------------
> cmake_minimum_required(VERSION 2.4.6)
> include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
>
> rosbuild_init()
> rosbuild_gensrv()
>
> add_library(mytraj SHARED MyTraj.cpp)
> -------------------------------------------------------

You're calling CMake's `add_library()` directly, which doesn't offer
rosbuild the opportunity to set up dependencies.  It also doesn't
bring in ROS-related build flags, e.g., from packages that your
package depends on.

I recommend calling `rosbuild_add_library()` instead:
  rosbuild_add_library(mytraj MyTraj.cpp)
You don't need to supply the SHARED flag.  Building of static and
shared libs for rosbuild is controlled via the `ROS_BUILD_STATIC_LIBS`
and `ROS_BUILD_SHARED_LIBS` variables (but note that static libs are
not well-exercised).

	brian.



More information about the ros-users mailing list