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

Shared libraries with catkin

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

Pototo gravatar image

Folks,

I have a folder called "lib" inside my ROS package. The "lib" folder has two .so libraries (one is named "librobotsdk.so") 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:

include_directories(${PROJECT_SOURCE_DIR}/lib)
#link_directories(${PROJECT_SOURCE_DIR}/lib)

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?

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

Pototo gravatar image

hhmm...it seems that if I do this (without linking directories):

set(EXTRALIB_BIN ${PROJECT_SOURCE_DIR}/lib/librobosdk.so)

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

Comments

1

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 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 3,021 times

Last updated: Feb 17 '15