Ask Your Question

Shared libraries with catkin

asked 2015-02-17 15:16:01 -0500

Pototo gravatar image


I have a folder called "lib" inside my ROS package. The "lib" folder has two .so libraries (one is named "") that my package needs (the libraries inside "lib" are not part of any other ROS package). I am trying to add them to my CMakeList.txt in the next way:


But when I do something like this inside my CMakeList.txt:

set(EXTRALIB_BIN robotsdk)

then I get the following error:

/usr/bin/ld: cannot find -lrobosdk

How can I include a library (in this case shared libraries) to my ROS path so tha cakin_make can compile it?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-17 15:39:08 -0500

Pototo gravatar image seems that if I do this (without linking directories):


and add it to my target libraries list like this:

target_link_libraries(executable ${catkin_LIBRARIES} ${EXTRALIB_BIN})

then catkin_make does not throw an error any more (program has not been tested yet, just compiled).

Is this the right way to add an external shared library?

edit flag offensive delete link more



Note that catkin is just cmake, and your question should really be "How do I link a shared library without a CMake config file or find script?". What you propose in your answer is one acceptable way (cmake prefers to use absolute paths to libraries).

gvdhoorn gravatar image gvdhoorn  ( 2015-02-18 05:27:14 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-02-17 15:16:01 -0500

Seen: 2,420 times

Last updated: Feb 17 '15