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

could not source the setup.bash in ROS 2?

asked 2019-04-12 06:16:00 -0600

Abirami_Ravi gravatar image

Step 1: I have Ubuntu 18.04 system on which Crystal ROS 2 installation has been done with the binaries.

Step 2: A workspace has been created and inside which I have the package containing publisher and talker node. (~/ros2_ws/src/pub_sub2/src/talker.cpp)

Step 3: In order to generate the executable, following changes have been done in the CMakeLists.txt.

add_executable(talker src/talker.cpp)
ament_target_dependencies(talker rclcpp std_msgs)

add_executable(listener src/listener.cpp)
ament_target_dependencies(listener rclcpp std_msgs)


Step 4: Build command colcon build --symlink-install was given. Build was successful and terminated without any errors. Executables could be run from the install folder using ./talker or ./listener

Step 5: On sourcing the setup.bash file inside the install folder, following errors were observed:

not found: "/home/user/ros2_ws/install/pub_sub2/share/pub_sub2/"
not found: "/home/user/ros2_ws/install/pub_sub2/share/pub_sub2/local_setup.bash"
edit retag flag offensive close merge delete


Can you post the output of colcon version-check.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-04-12 08:40:31 -0600 )edit

Following is the output of colcon version-check command:

colcon-argcomplete 0.3.2: up-to-date
colcon-bash 0.3.1: newer version available (0.3.2)
colcon-cmake 0.2.8: newer version available (0.2.9)
colcon-core 0.3.17: newer version available (0.3.20)
colcon-defaults 0.2.1: newer version available (0.2.2)
colcon-devtools 0.2.1: up-to-date
colcon-library-path 0.2.1: up-to-date
colcon-metadata 0.2.1: newer version available (0.2.2)
colcon-notification 0.2.6: newer version available (0.2.7)
colcon-output 0.2.3: up-to-date
colcon-package-information 0.2.2: up-to-date
colcon-package-selection 0.2.3: newer version available (0.2.4)
colcon-parallel-executor 0.2.3: newer version available (0.2.4)
colcon-pkg-config 0.1.0: up-to-date
colcon-powershell 0.3.3: newer version available (0.3.4)
colcon-python-setup-py 0.2.1: up-to-date
colcon-recursive-crawl 0.2.0: up-to-date
colcon-ros 0.3.7: newer version available (0.3.9)
colcon-test-result 0 ...
Abirami_Ravi gravatar image Abirami_Ravi  ( 2019-04-12 09:39:45 -0600 )edit

I would suggest updating your system and then trying it again.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-04-12 09:43:06 -0600 )edit

I removed the following lines of code in the CMakeLists.txt and the problem is resolved.

      find_package(ament_lint_auto REQUIRED)

Could you please explain what is the issue with these two lines?

Abirami_Ravi gravatar image Abirami_Ravi  ( 2019-04-12 09:45:02 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-11-09 11:21:31 -0600

I just tried to port some package to ROS2 and ran into this same issue while copy-pasting CMakeLists.txt content. It seems that an


was missing at the end of the file.

edit flag offensive delete link more

Question Tools



Asked: 2019-04-12 06:15:01 -0600

Seen: 4,724 times

Last updated: Apr 12 '19