cannot find libroscpp.so if installed node started as root
Hello,
I have a node that I am supposed to start as root.
Before I was using catkin_make
to compile and I was sourcing devel/setup.bash and everything was working perfeclty.
But today I tried to use catkin_make install
and to source install/setup.bash` and this time my node is crashing.
it says:
error while loading shared libraries: libroscpp.so: cannot open shared object file: No such file or directory
I also tried with another node (a dummy one) with the same CmakeLists. And this is really the combination between install and root that seems to be the problem.
my launchfile:
<launch>
<node name="bb_pigpio_node" pkg="bb_pigpio" type="bb_pigpio_node" launch-prefix="sudo -E">
<rosparam command="load" file="$(find bb_pigpio)/config/bb_encoder.yaml" />
</node>
</launch>
My CmakeLists:
cmake_minimum_required(VERSION 2.8.3)
project(bb_pigpio)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)
###################################
## catkin specific configuration ##
###################################
catkin_package(
INCLUDE_DIRS include
LIBRARIES bb_pigpio
CATKIN_DEPENDS roscpp std_msgs
)
###########
## Build ##
###########
## Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
)
## Declare a C++ executable
add_executable(${PROJECT_NAME}_node src/encoder_node.cpp
src/encoder.cpp)
add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_node
${catkin_LIBRARIES}
pigpio
)
#############
## Install ##
#############
install(TARGETS ${PROJECT_NAME}_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp"
)
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
install(DIRECTORY config/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
)
Thanks for your help