catkin_make install binary not found with rosrun

asked 2015-05-28 08:18:26 -0600

SailAvid gravatar image

I have a ros package which I compile with catkin_make install and then I move the install folder to a remote PC. On this PC the binary within the package isn't found with rosrun.

The ROS package has the following CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(my_app)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  roslib
  std_msgs
)

catkin_package(CATKIN_DEPENDS roscpp rospy roslib std_msgs)

include_directories(${catkin_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/src)

SET(HDRS  src/main.h)

SET(SRCS  src/main.cpp)

add_executable(my_app_node
                ${HDRS}
                ${SRCS}
)

target_link_libraries(my_app_node
   ${catkin_LIBRARIES}
)

install(TARGETS my_app_node
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Now I run catkin_make install which compiles the package and copies the binary to the install dir ./install/lib/my_app/my_app_node:

~/catkin_ws $ ls
build  devel  install  src
~/catkin_ws $ ls install
include  lib  share  env.sh  setup.bash  setup.sh  _setup_util.py  setup.zsh
~/catkin_ws $ ll install/lib/my_app
total 2.0M
-rwxr-xr-x 1 user user 2.0M Mai 28 10:58 my_app_node

To execute the app on a remote PC without recompiling it, I only copy the install directory to this PC which already includes the required binary. (Should work, right?)

Until here everything works fine. So here is where the problems start:

1. ROS_PACKAGE_PATH

On the remote PC I have to source the setup.bash: source /home/remote/install/setup.bash

Unfortunately the ROS_PACKAGE_PATH doesn't get set by the setup script. Why? (rospack find doesn't find the package my_app

To circumvent this problem I set it manually: ROS_PACKAGE_PATH=/home/remote/install:$ROS_PACKAGE_PATH. Now rospack can find the package.

2. Binary not found with rosrun

Trying to start the node fails:

~/install$ rospack find my_app
/home/remote/install/share/my_app
~/install$ rosrun my_app my_app_node
[rosrun] Couldn't find executable named my_app_node below /home/remote/install/share/my_app

rosrun can't find the binary in the path: /home/remote/install/lib/my_app/my_app_node. Why?

edit retag flag offensive close merge delete