could not source the setup.bash in ROS 2?
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)
install(TARGETS
talker
listener
DESTINATION lib/${PROJECT_NAME}
)
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/local_setup.sh"
not found: "/home/user/ros2_ws/install/pub_sub2/share/pub_sub2/local_setup.bash"
Can you post the output of
colcon version-check
.Following is the output of colcon version-check command:
(more)I would suggest updating your system and then trying it again.
I removed the following lines of code in the CMakeLists.txt and the problem is resolved.
Could you please explain what is the issue with these two lines?