Ask Your Question

source won't change the package path

asked 2017-06-21 12:03:23 -0600

Arnold gravatar image

updated 2017-06-22 07:12:55 -0600

Hi, I'm trying to run the pcl tutorial, since i need it for an university project.

Unfortunately when I try to run the exaple

arnold@arnold-UX31E:~/catkin_ws$ rosrun my_pcl_tutorial example input:=/camera/depth/points

I get the error back:

[rosrun] Couldn't find executable named example below /home/arnold/catkin_ws/src/my_pcl_tutorial

The executable crated with catkin_make is in the build folder, not in src (this seams to be correct). But rosrun trys to run it from the src folder. A little research came to the conclusion that it isn't sourced right. When I run arnold@arnold-UX31E:~/catkin_ws$ source devel/ I get no response (no error or approval) and nothing changes.

I already deleted the workspace 3 times and just followed the instructions from this Tutorials. and

Running Ros Indigo under Ubuntu 14.04 LTS

Answer to the first Comments, My Input: image description

Return of a fresh catkin_make build:

arnold@arnold-UX31E:~$ printenv | grep ROS

arnold@arnold-UX31E:~/catkin_ws$ catkin_make
Base path: /home/arnold/catkin_ws
Source space: /home/arnold/catkin_ws/src
Build space: /home/arnold/catkin_ws/build
Devel space: /home/arnold/catkin_ws/devel
Install space: /home/arnold/catkin_ws/install
#### Running command: "cmake /home/arnold/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/arnold/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/arnold/catkin_ws/install -G Unix Makefiles" in "/home/arnold/catkin_ws/build"
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CATKIN_DEVEL_PREFIX: /home/arnold/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/arnold/catkin_ws/devel;/opt/ros/indigo
-- This workspace overlays: /home/arnold/catkin_ws/devel;/opt/ros/indigo
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/arnold/catkin_ws/build/test_results
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.19
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - my_pcl_tutorial
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'my_pcl_tutorial'
-- ==> add_subdirectory(my_pcl_tutorial)
-- Using these message generators: gencpp;genlisp;genpy
-- Configuring done
-- Generating done
-- Build files have been written to: /home/arnold/catkin_ws/build
#### Running command: "make ...
edit retag flag offensive close merge delete


When I run arnold@arnold-UX31E:~/catkin_ws$ source devel/ I get no response (no error or approval) and nothing changes.

That is expected, as it only updates your environment variables.

Please post the output of echo $ROS_PACKAGE_PATH and tell us how you created your workspace.

gvdhoorn gravatar imagegvdhoorn ( 2017-06-22 04:23:48 -0600 )edit

And the exact order in which you source, catkin_make and rosrun things.

gvdhoorn gravatar imagegvdhoorn ( 2017-06-22 04:24:15 -0600 )edit

And just noticed this:

if you are using bash as your shell, you should use the setup.bash file, not the

gvdhoorn gravatar imagegvdhoorn ( 2017-06-22 04:24:51 -0600 )edit

Ok, I'm going to edit the exact order and results into the first post. I created the workspace how it was shown in the catkin create_a_workspace tutorial.

Arnold gravatar imageArnold ( 2017-06-22 05:03:46 -0600 )edit

Can you first try to source devel/setup.bash? It might be that is all you did 'wrong'.

gvdhoorn gravatar imagegvdhoorn ( 2017-06-22 05:11:11 -0600 )edit

posted my log as picture in the first post.

Arnold gravatar imageArnold ( 2017-06-22 05:20:19 -0600 )edit

Please don't use images for what is essentially text - you can just copy-paste from a terminal into your question text.

As to the output: I don't see any CMake output indicating that it's building any executable binaries. Can you include the CMakeLists.txt of the pkg you created?

gvdhoorn gravatar imagegvdhoorn ( 2017-06-22 06:20:35 -0600 )edit

Thats because the pkg was already build. If i delete the build folder and rerun catkin_make. It returns another text where it build a hack of more stuff. I'm wondering because the last last line Linking CXX executable example is red for me. I can't upload a file because i don't have 5 karma.

Arnold gravatar imageArnold ( 2017-06-22 07:03:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-22 07:17:04 -0600

gvdhoorn gravatar image

add_executable(example src/example.cpp)
target_link_libraries(example ${catkin_LIBRARIES})



Please move the add_executable(..) and target_link_libraries(..) lines below the catkin_package(..) line. Delete your build and devel folders and rebuild your workspace. That should make things work.

This is slightly unintuitive, but it is documented. See wiki/catkin - CMakeLists.txt - Overall Structure and Ordering on the ROS wiki.

edit flag offensive delete link more


Thanks, this worked.

Now I'm getting another error, when I rosrun my_pcl_tutorial example input:=/camera/depth/points

[ERROR] [1498134195.591725742]: [registerPublisher] Failed to contact master at [localhost:11311].  Retrying...

but this is another error and I'm trying it on my own first.

Arnold gravatar imageArnold ( 2017-06-22 07:30:18 -0600 )edit

Good to hear that resolved it.

As to your next problem: you simply need to start a roscore first.

gvdhoorn gravatar imagegvdhoorn ( 2017-06-22 07:36:02 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2017-06-21 12:00:28 -0600

Seen: 506 times

Last updated: Jun 22 '17