Ask Your Question

accidentally deleted build folder inside the catkin_ws folder

asked 2021-05-02 04:52:16 -0500

updated 2021-05-04 04:17:09 -0500

I accidentally deleted the build folder inside the catkin_ws directory by running rm -rf build inside the catkin_ws directory. It seems to have broken some things. I am not able to build any package by running catkin build <package_name>.

Is there a way I can fix the issue?

This is the terminal output -

Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/skpro19/catkin_ws
Build Space:        [exists] /home/skpro19/catkin_ws/build
Devel Space:        [exists] /home/skpro19/catkin_ws/devel
Install Space:      [unused] /home/skpro19/catkin_ws/install
Log Space:          [exists] /home/skpro19/catkin_ws/logs
Source Space:       [exists] /home/skpro19/catkin_ws/src
DESTDIR:            [unused] None
Devel Space Layout:          linked
Install Space Layout:        None
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
Whitelisted Packages:        None
Blacklisted Packages:        None
Workspace configuration appears valid.
[build] Found '105' packages in 0.0 seconds.
[build] Package table is up to date.
Starting  >>> controller_manager_msgs
Starting  >>> gazebo_dev
Starting  >>> geometry_msgs
Starting  >>> grid_map_core
Starting  >>> husky_description
Starting  >>> husky_msgs
Starting  >>> map_msgs
Starting  >>> my_turtlebot2_training
Finished  <<< my_turtlebot2_training                      [ 0.1 seconds ]
Starting  >>> roscpp
Finished  <<< gazebo_dev                                  [ 0.1 seconds ]
Starting  >>> tf
Finished  <<< grid_map_core                               [ 0.2 seconds ]
Finished  <<< husky_description                           [ 0.1 seconds ]
Finished  <<< geometry_msgs                               [ 0.2 seconds ]
Finished  <<< husky_msgs                                  [ 0.4 seconds ]
Starting  >>> grid_map_cv
Starting  >>> grid_map_octomap
Starting  >>> grid_map_sdf
Starting  >>> autonomous_mapping_package
Finished  <<< roscpp                                      [ 0.1 seconds ]
Starting  >>> exploration_msgs
Finished  <<< controller_manager_msgs                     [ 0.5 seconds ]
Starting  >>> gazebo_msgs
Finished  <<< tf                                          [ 0.1 seconds ]
Starting  >>> move_base_msgs
Finished  <<< grid_map_octomap                            [ 0.2 seconds ]
Starting  >>> teleop_twist_keyboard
Finished  <<< grid_map_sdf                                [ 0.2 seconds ]
Starting  >>> tf2_msgs
Errors     << map_msgs:cmake /home/skpro19/catkin_ws/logs/map_msgs/build.cmake.006.log
CMake Error at /home/skpro19/catkin_ws/build/map_msgs/cmake/map_msgs-genmsg.cmake:3 (message):
  Could not find messages which
  depends on.  Did you forget to specify generate_messages(DEPENDENCIES ...)?
  Cannot locate message [Pose] in package [geometry_msgs] with paths
Call Stack (most recent call first):
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  CMakeLists.txt:29 (generate_messages)
cd /home/skpro19/catkin_ws/build/map_msgs; catkin build --get-env map_msgs | catkin env -si  /usr/bin/cmake /home/skpro19/catkin_ws/src/navigation_msgs/map_msgs --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/skpro19/catkin_ws/devel/.private/map_msgs -DCMAKE_INSTALL_PREFIX=/home/skpro19/catkin_ws/install; cd -
Failed     << map_msgs:cmake                              [ Exited with code 1 ]
Failed    <<< map_msgs                                    [ 0.8 seconds ]
Abandoned <<< actionlib                                   [ Unrelated job failed ]
Abandoned <<< adhoc_communication                         [ Unrelated job failed ]
Abandoned <<< beginner_tutorials                          [ Unrelated job failed ]
Abandoned <<< display_point                               [ Unrelated job failed ]
Abandoned <<< grid_map_msgs                               [ Unrelated job failed ]
Abandoned <<< hardware_interface                          [ Unrelated job failed ]
Abandoned <<< map_stitch_package                          [ Unrelated job failed ]
Abandoned <<< multihusky_viz                              [ Unrelated job failed ]
Abandoned <<< voxel_grid                                  [ Unrelated job failed ]
Abandoned <<< rqt_controller_manager                      [ Unrelated job failed ]
Abandoned <<< gmapping                                    [ Unrelated job failed ]
Abandoned <<< husky_bringup                               [ Unrelated job failed ]
Abandoned <<< husky_control                               [ Unrelated job failed ]
Abandoned <<< husky_gazebo                                [ Unrelated job ...
edit retag flag offensive close merge delete


If I create a new catkin workspace and move the package files from inside the catkin_ws/src folder to the new catkin workspace's src folder, I am build to those packages. This is strange.

skpro19 gravatar image skpro19  ( 2021-05-02 07:15:17 -0500 )edit

@skpro19 well that's solved then haha....just use that new workspace.

TK27 gravatar image TK27  ( 2021-05-02 07:47:49 -0500 )edit

Actually, I am not able to build the packages in the new catkin_ws.

skpro19 gravatar image skpro19  ( 2021-05-02 07:54:50 -0500 )edit

I'm sorry to have to do this for something so seemingly unimportant, but please don't post screenshots of terminal text in question on ROS Answers. It's all text, so there is no need. Just copy-paste the text from the terminal into your question text. Do make sure to format it properly by selecting the text and pressing ctrl+k (or clicking the Preformatted Text button (the one with 101010 on it)).

You don't need to post a new question, just edit your curent one. You can use the edit button/link for this.

After you replace the screenshot with the error message itself, we can re-open your question.

And @skpro19: you've been around for some time now, so this should not be new to you.

gvdhoorn gravatar image gvdhoorn  ( 2021-05-02 08:17:38 -0500 )edit

@gvdhoom I have edited my question to make the changes suggested by you.

skpro19 gravatar image skpro19  ( 2021-05-02 08:28:06 -0500 )edit

All the errors pertain to geometry_msgs, which you appear to have built from source. Have you modified that package since it was last built? Also, can you please confirm whether you've tried catkin clean before building everything again?

tryan gravatar image tryan  ( 2021-05-02 18:55:07 -0500 )edit

Can you try to do catkin clean --all -y in your catkin_ws and try again to build the workspace.

aarsh_t gravatar image aarsh_t  ( 2021-05-02 21:01:17 -0500 )edit

@tryan I didn't modify that package. I did trying catkin clean before building everyting again.

skpro19 gravatar image skpro19  ( 2021-05-02 21:55:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-02 06:53:16 -0500

TK27 gravatar image

updated 2021-05-02 06:53:39 -0500

If you are building in catkin_ws, you don't need to include the <package_name>. Just catkin build will do. I would suggest you first execute catkin clean and then do catkin build.

edit flag offensive delete link more


This doesn't work. Most of the packages are producing an error on running catkin build.

skpro19 gravatar image skpro19  ( 2021-05-02 07:09:09 -0500 )edit

@skpro19 Was it working before you deleted the build folder? The error message seems like you have issues with generating messages and other stuff.

TK27 gravatar image TK27  ( 2021-05-02 07:44:45 -0500 )edit

Yes. It was working just fine.

skpro19 gravatar image skpro19  ( 2021-05-02 08:07:54 -0500 )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: 2021-05-02 04:52:16 -0500

Seen: 160 times

Last updated: May 04 '21