catkin_make install fails to install the executable correctly
Hi there, we are using the below attached CMakeLists.txt to build a simple executable. Building works OK and we can also successfully run it from the devel folder (devel/lib/lawnmower_intrudor_detector/intrudor_detector_node). However after we install the executable using the "catkin_make install" command into the install/lib/lawnmower_intrudor_detector/intrudor_detector_node, the shared libraries the executable is linking against are not found anymore:
./intrudor_detector_node: error while loading shared libraries: libpcl_common.so.1.7: cannot open shared object file: No such file or directory
We verified and the 2 executables (in devel and install) indeed have different checksums - which to the best of our knowledge should not happen, right?
Using: ROS Groovy, Ubuntu 12.04
CMakeLists.txt is below. Please note that the install macro does not work when passed in the name of the package, hence only executable.
cmake_minimum_required(VERSION 2.8.3)
project(lawnmower_intrudor_detector)
find_package(catkin REQUIRED COMPONENTS laser_geometry roscpp sensor_msgs tf)
## System dependencies are found with CMake's conventions
#find_package(PCL 1.6.1 REQUIRED)
find_package(PCL 1.7.0 REQUIRED)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS laser_geometry roscpp sensor_msgs tf
DEPENDS eigen
)
## Specify additional locations of header files
include_directories(include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
## Declare a cpp executable
add_executable(intrudor_detector_node src/intrudor_detector.cpp)
## Add dependencies to the executable
# add_dependencies(lawnmower_intrudor_detector_node ${PROJECT_NAME})
target_link_libraries(intrudor_detector_node
${catkin_LIBRARIES}
${PCL_LIBRARIES}
)
install(TARGETS intrudor_detector_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
Update: PCL_LIBRARIES are as follows: http://pastebin.com/cWTf0cjr . The weird thing about it is that there is no semicolons delimiting the respective library.
Update 2: ldd output for both executables in devel and install workspaces as follows: http://pastebin.com/ZpQBhUdJ . In install workspace pcl_common* is not found anymore.
Does it also not work if you cd into the build directory and run
make install
?To clarify,
catkin_make
doesn't install the file,catkin_make
just runs CMake and Make together as a convenience. You can reproduce this withoutcatkin_make
with 'mkdir build && cd build && cmake ../src -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel && make <target>'These are unrelated to your question, but your CMakeLists.txt
find_package(...)
's PCL but does not export it incatkin_package(...)
(this may or may not be desired), and you DEPEND on eigen, but neverfind_package(...)
it, which is likely not desired behavior.@Jon: yes, it does NOT work with cd-ing into build and running make install as well.
Jon, we found out that it works if append the path to the PCL libraries before: "export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}". Note that we compilled PCL ourselves and make installed it into /usr/local.
@dejanpan can you output
PCL_LIBRARIES
and post it here? It seems like the only way the above comment fixes it is if PCL does not return absolute path libraries.@William: I updated the question with the PCL_LIBRARIES message status. Weird thing is that the libraries are not delimited by the semicolon. Is that a problem?
@dejanpan No, that is a side effect of printing a list in CMake: http://stackoverflow.com/questions/7172670/best-shortest-way-to-join-a-list-in-cmake