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

export a prebuilt library in catkin

asked 2013-11-04 02:26:05 -0600

updated 2013-11-04 02:26:31 -0600

I am wondering how can I export an already built library within a package to make it available to other catkin packages.

Before with rosbuild this could be done by by using the cpp tag in the manifest. For instance:

<cpp lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -lmylib" cflags="-I${prefix}/include"/>

As far as I understand this functionality has been replaced by the catkin_package() command. However, I have not found a clear way to make a prebuilt library within a catkin package visible to other catkin packages.

I have tried setting the prebuilt library as an imported library, but then when I do cmake it does not set it as a target visible by other packages. In CMakeLists.txt I have:

catkin_package(LIBRARIES mylib)
add_library(mylib STATIC IMPORTED)
set_target_properties(mylib PROPERTIES IMPORTED_LOCATION /path/to/mylib)

Any suggestions?

edit retag flag offensive close merge delete


catkin_package(LIBRARIES ...) should be able to handle libraries build in your cmake project, absolute paths to an existing library as well as imported library targets. Please consider providing a link to the sources for further investigation.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-11-06 07:09:50 -0600 )edit

The package in question can be found in I managed to get it working, but I had to do a hard copy of the library to the devel/lib folder. Any suggestions on how to do this in a more clean way?

Francisco Vina gravatar image Francisco Vina  ( 2013-11-21 07:13:25 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-12-25 21:34:08 -0600

@Francisco Vina: As @Dirk Thomas mentioned, you can do so by providing the absolute path to the library so that you do not have to copy it to the devel space, and install it as usual to get it set up correctly in the install space.

Take a look at @William's answer here:

Example packages doing this a bit cleanly:

edit flag offensive delete link more

Question Tools



Asked: 2013-11-04 02:26:05 -0600

Seen: 3,707 times

Last updated: Dec 25 '13