ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
1

export a prebuilt library in catkin

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

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

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:

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

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

Comments

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 imageDirk Thomas ( 2013-11-06 07:09:50 -0500 )edit

The package in question can be found in https://github.com/kth-ros-pkg/kvaser_canlib.git 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 imageFrancisco Vina ( 2013-11-21 07:13:25 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

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

piyushk gravatar image

@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: http://answers.ros.org/question/66685/is-it-possible-to-create-a-catkin-package-to-provide-precompiled-libraries/

Example packages doing this a bit cleanly: https://github.com/ros-drivers/prosilica_gige_sdk https://github.com/utexas-bwi/rl_pursuit

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 1,845 times

Last updated: Dec 25 '13