0
$\begingroup$

Rosanswers logo

Hi all,

I compiled some packages using catkin. Now on installation ($ catkin_make install) all the files are installed to the catkin_ws/install folder. But there they are not found. I think they should be copied to different systems paths, right?

Do I need to source a file in the workspace to use the compiled and installed files there? How can I get all the files in the right system folders?

Thanks!


Originally posted by obsti on ROS Answers with karma: 63 on 2013-03-30

Post score: 2


Original comments

Comment by joq on 2013-03-30:
Did you configure the CMAKE_INSTALL_PREFIX? Did your CMakeLists.txt invoke the CMake install() macro?

Comment by obsti on 2013-03-30:
No I didn't especially set the CMAKE_INSTALL_PREFIX. To which path do I need to set it? And in the top-level CMakeLists.txt I didn't find any command for the install() macro. How can I set it?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Unfortunately, the default CMake install location is /usr/local, not a good destination for ROS packages. So, you need to configure your catkin workspace, somewhat like this example:

$ cd ~/catkin_ws/build
$ cmake ../src -DCMAKE_INSTALL_PREFIX=../install

Then, you need to add CMake install() commands to your CMakeLists.txt.

For example, if you need to install C++ headers where they can be found by other packages:

install(DIRECTORY include/
   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

Similarly, if there is a shared libraries needed by other packages at runtime:

install(
  TARGETS your_shared_library
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)

Note that catkin library names have system-wide scope, so make sure they clearly describe their role. Include names are less of an issue, since they are usually in a subdirectory under your package name.


Originally posted by joq with karma: 25443 on 2013-03-30

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by obsti on 2013-03-30:
What I missed was sourcing the setup.bash in the install directory. Doing this the files are found and the nodes are launching correctly! Thanks a lot joq!

Comment by joq on 2013-03-30:
That is easy to miss. Glad it's working now.

Comment by Kevin on 2013-06-13:
Is there a way to embed -DCMAKE_INSTALL_PREFIX=../install in CMakeLists.txt so I don't have to remember it on the command line?

Comment by Dirk Thomas on 2013-06-13:
When you call catkin_make that is always the default location for the install prefix.

Comment by Kevin on 2013-06-13:
Ah yes, sorry ... that is not exactly what I meant. Is there a way to embed -DCMAKE_INSTALL_PREFIX=/some/place/else in CMakeLists.txt so I don't have to remember it on the command line?

Comment by William on 2013-06-13:
You might could do something like this: https://gist.github.com/wjwwood/5779223 (I haven't tried this, might need different syntax or logic)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.