ros2 / ros2

The Robot Operating System, is a meta operating system for robots.
https://docs.ros.org
3.46k stars 659 forks source link

Could not find a package configuration file provided by "ament_cmake" #1236

Closed nikboy111 closed 2 years ago

nikboy111 commented 2 years ago

Required Info:

Expected behavior

Successful build of turtlebot3 packages.

Actual behavior

After building the package I'm having the following error:

Starting >>> dynamixel_sdk
Starting >>> turtlebot3_msgs
Starting >>> turtlebot3_description
Starting >>> dynamixel_sdk_custom_interfaces
--- stderr: dynamixel_sdk                                          
CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "ament_cmake", but CMake did not find one.

  Could not find a package configuration file provided by "ament_cmake" with
  any of the following names:

    ament_cmakeConfig.cmake
    ament_cmake-config.cmake

  Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
  "ament_cmake_DIR" to a directory containing one of the above files.  If
  "ament_cmake" provides a separate development package or SDK, be sure it
  has been installed.

---
Failed   <<< dynamixel_sdk [0.11s, exited with code 1]
Aborted  <<< dynamixel_sdk_custom_interfaces [0.10s]
Aborted  <<< turtlebot3_description [0.10s]
Aborted  <<< turtlebot3_msgs [0.10s]

After this section i couldn't build the package:

git clone -b foxy-devel https://github.com/ROBOTIS-GIT/DynamixelSDK.git git clone -b foxy-devel https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git git clone -b foxy-devel https://github.com/ROBOTIS-GIT/turtlebot3.git cd ~/turtlebot3_ws colcon build --symlink-install

Searching lots of different troubleshoot like this always got me the advice of having to source the /opt/ros/foxy/setup.bash or */setup.sh, but this doesn't help me fix the problem. If I source the setup.sh I'm getting this error:

Starting >>> dynamixel_sdk
Starting >>> turtlebot3_msgs
Starting >>> turtlebot3_description
Starting >>> dynamixel_sdk_custom_interfaces
--- stderr: turtlebot3_msgs                                        
CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "Findaction_msgs.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "action_msgs", but CMake did not find one.

  Could not find a package configuration file provided by "action_msgs" with
  any of the following names:

    action_msgsConfig.cmake
    action_msgs-config.cmake

  Add the installation prefix of "action_msgs" to CMAKE_PREFIX_PATH or set
  "action_msgs_DIR" to a directory containing one of the above files.  If
  "action_msgs" provides a separate development package or SDK, be sure it
  has been installed.

---
Failed   <<< turtlebot3_msgs [0.11s, exited with code 1]
Aborted  <<< turtlebot3_description [0.10s]
Aborted  <<< dynamixel_sdk [0.12s]
Aborted  <<< dynamixel_sdk_custom_interfaces [0.10s]

I don't know what else to do. Thank you so much in advance! Regards Nik

Update: I placed the turtlebot workspace inside the source folder of the ROS2 workspace. When building the whole ROS2 workspace it seems to work fine and I get no errors, but as soon as I run colcon build in the turtlebot workspace i get the same error like before.

clalancette commented 2 years ago

@nikboy111 Please open a question on https://answers.ros.org, which is our central question and answer site. You should be able to get help there.

admajors00 commented 1 year ago

I had the exact same problem I found the answer here that worked.

https://www.reddit.com/r/ROS/comments/vrvyim/errno_13/[Reddit](https://www.reddit.com/r/ROS/comments/vrvyim/errno_13/)

"This will happen mostly because you do not have permissions to edit the workspace directory. Try giving read/write permission of the workspace to all users using

cd <your workspace>
 sudo chmod 777 -R .

Then build using colcon build in the current directory."

Magendreh commented 1 year ago

I had the same issue with ROS2 humble on Windows 10. The directory of my humble installation was the set to read-only. After changing it, the error was gone.

RocketFramework commented 7 months ago

Oh, I encountered a similar issue and spent a good two days troubleshooting, only to realize that the install directory can be modified only by the root user. It was quite a revelation, and I ended up double-checking the permissions just to confirm.

  1. su (move to super user mode) on the terminal where ever thing is set
  2. issue the colcon build as "su"
  3. everything start working like charm
  4. Now I have to go and configure permission which is lesser problem than what I had before

admajors00 is right about permission..

Thanks ALL!!