[rosrun] Couldn't find executable
//www.ros.org/wiki/ROS/Tutorials/ExaminingPublisherSubscriber.
When I try to run rosrun beginner_tutorials talker. It tells me that: [rosrun] Couldn't find executable named talker below /home/MY_NAME/catkin_ws/src/beginner_tutorials
Additional information: When I ran find -executable -type f the output is given as below:
./src/beginner_tutorials/talker.cpp
./src/beginner_tutorials/listener.cpp
./devel/_setup_util.py
./devel/env.sh
./build/catkin_generated/stamps/Project/_setup_util.py.stamp
./build/catkin_generated/installspace/_setup_util.py
./build/catkin_generated/installspace/env.sh
./build/catkin_generated/setup_cached.sh
./build/catkin_generated/env_cached.sh
./build/CMakeFiles/feature_tests.bin
./build/CMakeFiles/3.5.1/CompilerIdC/a.out
./build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_CXX.bin
./build/CMakeFiles/3.5.1/CompilerIdCXX/a.out
./build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_C.bin
After using the env | grep ROS_PACKAGE_PATH I get:
ROS_PACKAGE_PATH=/home/MY_NAME/catkin_ws/src:/opt/ros/kinetic/share
and I have sourced the file using the following command: source ./devel/setup.bash
below is the CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
################################################
## Declare ROS messages, services and actions ##
################################################
## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
)
## * add "message_runtime" and every package in MSG_DEP_SET to
catkin_package(
...
CATKIN_DEPENDS message_runtime ...
...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder
add_message_files(
FILES
Num.msg
)
generate_messages()
## Generate services in the 'srv' folder
add_service_files(
FILES
AddTwoInts.srv
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_messages_cpp)
add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_messages_cpp)
add_executable(add_two_ints_server src/add_two_ints_server.cpp)
target_link_libraries(add_two_ints_server ${catkin_LIBRARIES})
add_dependencies(add_two_ints_server beginner_tutorials_gencpp)
add_executable(add_two_ints_client src/add_two_ints_client.cpp)
target_link_libraries(add_two_ints_client ${catkin_LIBRARIES})
add_dependencies(add_two_ints_client beginner_tutorials_gencpp)
thanks
as no executbale is found, seems that you did not build the node as described in this tutorial. What makes no sense, though, is that the
talker/listner.cpp
are executable. This is not python :-)I took the liberty of reformatting the question and get rid of a lot of the comments.
Two things are strange.
CMakeLists.txt
: you callfind_package
twice. I'm not sure if this is even possible or what the effects are.talker
executable is found ..in
devel
, the compilation was not succesfull. You did callcatkin_make
again after adding the respective*.cpp
files, right? You have to call those every time you change something.@mgruhler wrote:
It won't work.
It needs to be removed / the second call needs to be merged with the first.
Thanks for clarifying.
I suspected as much but have not tested it and didn't have the time to investigate.
Well to be fair it does "work", but almost never does what the user expects. It's infinitely better and more intuitive to not have two
find_package(catkin ..)
statements in there.Has this been solved yet?