Ask Your Question
0

rosrun Error even when package compiles successfully

asked 2012-06-20 09:27:09 -0600

Nishant gravatar image

updated 2012-06-20 09:42:21 -0600

Hi all! As seen from my previous posts, its been only about a month since I started using ROS. So pardon me if I am making any newbie error here.

I am trying to run a node on ros, but I am unable to do so. Here are the details:

package name: robot_node

ros version: ROS electric

Ubuntu version: Ubuntu Oneiric 32-bit

1) I opened a terminal and said

roscore

2) I went to the folder of the package and said rosmake

roscd robot_node

rosmake

This works perfectly fine. I am able to compile with 0 failures.

3) My executable is called 'robot_node.cpp' so I do the following

rosrun robot_node robot_node

And then, I get this 'error':

[rosrun] Couldn't find executable named robot_node below ~/ros_workspace/ROS/robot_node [rosrun] Found the following, but they're either not files, [rosrun] or not executable: [rosrun] ~/ros_workspace/ROS/robot_node

There are a few things you should know that I already tried. These are

1) I checked the CMakeLists.txt for the package, and it does have the add_executable line.

2)I compiled all the first dependencies of the package separately, and they all compiled perfectly with 0 failures.

3) robot_node.cpp does have a int main() routine. :P

Any kind of help is greatly appreciated. Thanks for your time!

edit retag flag offensive close merge delete

Comments

Hey dornhege, here are your answers: 1)

Nishant gravatar imageNishant ( 2012-06-20 09:44:10 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2012-06-20 10:10:43 -0600

Lorenz gravatar image

The output of make obviously shows an error, that's why no binary file is generated. The problem probably is your call to ADD_CUSTOM_COMMAND where you depend on another library. Did you check that the file libABBInterpreter.a really exists?

edit flag offensive delete link more
0

answered 2012-06-20 09:52:35 -0600

Nishant gravatar image

updated 2012-06-20 10:08:05 -0600

Lorenz gravatar image

Hey dornhege, here are your answers: 1) This is the output when I say make

mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake  ..
[rosbuild] Building package robot_node
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/roslisp/cmake/roslisp.cmake
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/rospy/cmake/rospy.cmake
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
-- Configuring done
-- Generating done
CMake Warning:
 Manually-specified variables were not used by the project:

   CMAKE_TOOLCHAIN_FILE


-- Build files have been written to: /home/nishantabb/ros_workspace/ROS/robot_node/build
cd build && make 
make[1]: Entering directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[2]: Entering directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[3]: Entering directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[3]: Leaving directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[3]: Entering directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[3]: * No rule to make target `../../../ABBInterpreter/lib/libABBInterpreter.a', needed by `libABBInterpreter.a'.  Stop.
make[3]: Leaving directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[2]: * [CMakeFiles/makeABBLIB.dir/all] Error 2
make[2]: Leaving directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make[1]: * [all] Error 2
make[1]: Leaving directory `/home/nishantabb/ros_workspace/ROS/robot_node/build'
make: * [all] Error 2

2) This is the CMakeLists.txt

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

set(ABB_PATH ${PROJECT_SOURCE_DIR}/../../ABBInterpreter)


ADD_CUSTOM_COMMAND(
 OUTPUT libABBInterpreter.a
 COMMAND make -C ${ABB_PATH}
 DEPENDS ${ABB_PATH}/lib/libABBInterpreter.a
 )

ADD_CUSTOM_TARGET(makeABBLIB ALL DEPENDS libABBInterpreter.a)

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})

include_directories(${ABB_PATH}/include)
link_directories(${ABB_PATH}/lib)

rosbuild_add_executable(robot_node src/robot_node.cpp)
target_link_libraries(robot_node -lABBInterpreter)

3) I checked the bin/ folder of the robot_node package. There seems to be nothing in it.

Question: How can I comment on your answer on this forum? It would be much easier than just creating a new answer altogether. Thanks!

edit flag offensive delete link more

Comments

2

You can update your original post by editing it. Regarding your problem check Lorenz' answer. There is a compilation error and thus no binary.

dornhege gravatar imagedornhege ( 2012-06-20 10:13:03 -0600 )edit

Hey dornhege and Lorenz, So I was able to solve the problem. The primary error, as you guys pointed out, lied in this one line

ADD_CUSTOM_TARGET(makeABBLIB ALL DEPENDS libABBInterpreter.a)

It should have been

ADD_CUSTOM_TARGET(make ABBLIB ALL DEPENDS libABBInterpreter.a)

Nishant gravatar imageNishant ( 2012-06-21 10:44:12 -0600 )edit

Thanks for all your inputs! Also, just to make sure, I navigated to the ABBInterpreter folder and manually typed 'make' in the terminal just to make sure I had the libABBInterpreter.a file. Thank you guys once again :)

Nishant gravatar imageNishant ( 2012-06-21 10:46:50 -0600 )edit
1

answered 2012-06-20 09:38:42 -0600

dornhege gravatar image

My suspicion is that you are not compiling the program at all or as you think you do. So, answer the following questions:

  • What is the output when you compile with rosmake and make?
  • What is your CMakeLists.txt?
  • Is there a binary robot_node in your package (possibly in bin/)?
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-06-20 09:27:09 -0600

Seen: 1,850 times

Last updated: Jun 20 '12