Ask Your Question
0

How to fix a corrupted (boilerplate) toplevel.cmake file?

asked 2016-02-20 04:17:23 -0600

jsanch2s gravatar image

updated 2016-02-20 05:18:23 -0600

I accidentally replaced my CMakeLists.txt file in my catkin_ws/src directory and then ran catkin_make. This replaced the toplevel.cmake located in this directory /opt/ros/indigo/share/catkin/cmake. Resulting in the following error:


CMake Error: File /home/user/projects/catkin_ws/src/package.xml does not exist.
CMake Error at /opt/ros/indigo/share/catkin/cmake/stamp.cmake:10 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  /opt/ros/indigo/share/catkin/cmake/catkin_package_xml.cmake:61 (stamp)  
  /opt/ros/indigo/share/catkin/cmake/catkin_package_xml.cmake:39 (_catkin_package_xml)  
  /opt/ros/indigo/share/catkin/cmake/catkin_package.cmake:95 (catkin_package_xml)  
  CMakeLists.txt:37 (catkin_package)


CMake Error at /opt/ros/indigo/share/catkin/cmake/catkin_package.cmake:112 (message):
  catkin_package() 'catkin' must be listed as a buildtool dependency in the
  package.xml
Call Stack (most recent call first):  
  /opt/ros/indigo/share/catkin/cmake/catkin_package.cmake:98 (_catkin_package)
  CMakeLists.txt:37 (catkin_package)

This is the same question asked here, however I'm not able to follow the answer given. I tried of replacing the toplevel.cmake located in the directory the /opt/ros/indigo/share/catkin/cmake, however I couldn't find the original one (or how to generate it again).

To be more specific, I would like to know what the best way to proceed is (should I reinstall ROS or is there a better solution?).

edit retag flag offensive close merge delete

Comments

For future questions: please use the Preformatted text button (the one with 101010 on it) for console copy/pastes instead of Block quote. As the name suggests, it preserves the formatting better (Block quote rearranges things in sometimes unpredictable ways).

gvdhoorn gravatar imagegvdhoorn ( 2016-02-20 04:50:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-02-20 04:47:45 -0600

gvdhoorn gravatar image

updated 2016-02-20 04:50:39 -0600

First try to unlink / rm the src/CMakeLists.txt in your workspace.

Then try building your workspace again (just run catkin_make in /home/user/projects/catkin_ws). That should work, provided you did not actually edit the file in /opt/ros/indigo/.. (that would have required sudo, so you should know / remember that).

If you did change toplevel.cmake itself, then you can just re-install the ros-$DISTRO-catkin package using apt-get:

sudo apt-get install --reinstall ros-indigo-catkin

for Indigo.

That should replace the edited file with the original version. Building your workspace should now work again.

edit flag offensive delete link more

Comments

Thank you very much! That worked perfectly!

jsanch2s gravatar imagejsanch2s ( 2016-02-20 05:13:21 -0600 )edit

Good to hear you got it fixed. Can you tell us which of the two possible fixes worked for you?

gvdhoorn gravatar imagegvdhoorn ( 2016-02-20 07:35:24 -0600 )edit

I had to do the re-install of catkin (i.e. sudo apt-get install --reinstall ros-indigo-catkin), since the toplevel.cmake file in the /opt directory was indeed the wrong one.

jsanch2s gravatar imagejsanch2s ( 2016-02-20 08:21:23 -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

Stats

Asked: 2016-02-20 04:17:23 -0600

Seen: 1,338 times

Last updated: Feb 20 '16