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

Rosrun executable not found

asked 2014-05-19 05:28:29 -0500

updated 2014-05-25 07:45:36 -0500

ahendrix gravatar image

Hello,

I'm trying to run a node from rosrun (it works when I manually enter ./program inside build directory). Yet it doesn't work when called by rosrun - it finds the directory by tab completion, but not the executable. How can I help it? I need it to use it in launch files.

[rosrun] Found the following, but they're either not files,
[rosrun] or not executable:
[rosrun]   /home/user/ros_ws/catkin_ws/src/ros_programme
edit retag flag offensive close merge delete

Comments

did you run the setup script for your catkin workspace?

LikeSmith gravatar image LikeSmith  ( 2014-05-19 05:56:59 -0500 )edit

Yes. The problem lies in the location of the executables. They're in catkin_ws/build/package_name and they should be somewhere in devel/lib I think. I guess it's something with the CMake file inside package source, but no idea what exactly.

delta785 gravatar image delta785  ( 2014-05-19 08:32:54 -0500 )edit

What is the exact command line of your rosrun? What is that package setup and ROS_PACKAGE_PATH?

dornhege gravatar image dornhege  ( 2014-05-19 08:49:40 -0500 )edit

rosrun ros_programme ros_programme - doesn't work ./ros_programme (build/ros_programme directory) works I'm not sure what you mean by package setup, I'm a little bit green here. After sourcing many things, this is the ROS_PACKAGE_PATH. /home/user/ros_ws/catkin_ws/install/share:/home/omikron/ros_ws/catkin_ws/install/stacks:/home/user/ros_ws/catkin_ws/src:/opt/ros/hydro/share:/opt/ros/hydro/stacks

delta785 gravatar image delta785  ( 2014-05-19 09:36:52 -0500 )edit

Where is your code and "sourcing many things" would be the package setup. Is the binary in any of the paths in your package path? e.g. .../install

dornhege gravatar image dornhege  ( 2014-05-19 09:40:47 -0500 )edit

Additionally, the packages I put inside catkin_ws (downloaded from miscellaneous locations) usually allow me to easily use rosrun. This is the CMakeLists.txt of my package (also downloaded, but clearly somehow incomplete) http://pastebin.com/XNkxU93i

delta785 gravatar image delta785  ( 2014-05-19 09:43:48 -0500 )edit

The binary is only in build directory (catkin_ws/build/ros_programme).

delta785 gravatar image delta785  ( 2014-05-19 09:46:09 -0500 )edit

did you type ($source devel/setup.bash) in your catkin_ws before typing rosrun ...

Hamid Didari gravatar image Hamid Didari  ( 2014-05-19 22:05:05 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
4

answered 2014-05-19 09:48:31 -0500

ahendrix gravatar image

updated 2014-05-26 10:29:14 -0500

EDIT

The final solution to this was to make sure to call catkin_package() in the CMakeLists.txt, and to make sure to call it before any add_executable() or add_library() calls.

Original answer

Looking at your CMakeLists.txt, you've named your executables ros_aruco and subpose. The correct way to run them is with:

rosrun ros_programme ros_aruco

Or

rosrun ros_programme subpose

The relevant lines in your CMakeLists.txt that set these names are:

add_executable(ros_aruco src/ros_aruco.cpp)
add_executable(subpose src/subpose.cpp)

I would also expect the final binaries to be generated into devel/lib/ros_aruco rather than build/ros_aruco; are you passing any extra flags to catkin_make that might be changing this behavior?

edit flag offensive delete link more

Comments

Nah, I've just modified the names for some clarity. The real package name is ros_aruco and I want to call it by running rosrun ros_aruco ros_aruco. So still nothing. ;/ Sorry for confusing things.

delta785 gravatar image delta785  ( 2014-05-19 10:01:05 -0500 )edit

No, just "catkin_make".

delta785 gravatar image delta785  ( 2014-05-19 19:45:20 -0500 )edit
1

catkin_package() did the trick for me! Thanks!

ai-shwarya gravatar image ai-shwarya  ( 2016-10-19 07:44:14 -0500 )edit
2

answered 2017-02-11 07:56:11 -0500

lucasw gravatar image

I ran across the same error when trying to rosrun after doing a catkin_make install, it turned out I had the install TARGETS set to CATKIN_GLOBAL_BIN_DESTINATION instead of CATKIN_PACKAGE_BIN_DESTINATION (because I had copied that from somewhere else?), and the executables were going into install/bin rather than install/lib/my_package.

edit flag offensive delete link more

Comments

Thanks! This solved my problem! I mistook adding my executable to the part for library installation. The default RUNTIME DESTINATION for libraries and executable are different.

cmkayjc gravatar image cmkayjc  ( 2019-10-25 03:43:38 -0500 )edit
0

answered 2014-05-24 05:37:40 -0500

The correct answer to this problem is to add

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

at the beginning of CMakeLists.txt.

edit flag offensive delete link more

Comments

1

You should NOT do this with catkin; the build and install process expects your executables to be placed in the devel directory, and it violates the concept of out-of-source builds.

ahendrix gravatar image ahendrix  ( 2014-05-24 13:21:55 -0500 )edit

I'm open to any new suggestions that works AND will place the exe in the devel directory. So far I couldn't find any.

delta785 gravatar image delta785  ( 2014-05-24 21:22:20 -0500 )edit

Looking at your ROS_PACKAGE_PATH, it looks like you're sourcing the install directoy, but you don't have any install rules for your executable in your CMakeLists. Have you tried sourcing the setup.bash in the devel directory instead?

ahendrix gravatar image ahendrix  ( 2014-05-25 08:00:47 -0500 )edit

You mean source devel/setup.bash in my catkin_ws? That's the first thing I do, always. I think I should add it to bashrc. :P Anyway, my ugly line of code is the only thing so far that allows me to run my node from rosrun.

delta785 gravatar image delta785  ( 2014-05-25 09:07:41 -0500 )edit

The ROS_PACKAGE_PATH in your comment contains catkin_ws/install/... paths instead of catkin_ws/devel/... paths. Can you confirm that that is still the case? Can you list the exact commands you're using to build and source your workspace?

ahendrix gravatar image ahendrix  ( 2014-05-25 09:12:11 -0500 )edit

http://pastebin.com/rRKEQCXp

delta785 gravatar image delta785  ( 2014-05-25 09:31:59 -0500 )edit

If you do a build without set(EXECUTABLE_OUTPUT_PATH...), where does your binary end up: `find . -name ros_aruco` ?

ahendrix gravatar image ahendrix  ( 2014-05-25 10:11:32 -0500 )edit

catkin_ws/build/ros_aruco

delta785 gravatar image delta785  ( 2014-05-25 10:24:58 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-05-19 05:28:29 -0500

Seen: 10,978 times

Last updated: Feb 11 '17