Ask Your Question
0

How can I update/remove cmake without partially deleting my ROS distribution?

asked 2018-06-04 00:10:56 -0500

M@t gravatar image

Problem (TL;DR)

I need to update my cmake from version 2.8.12.2 to version 3.1 or higher. However this requires removing the previous version with the command: sudo apt remove cmake. This identifies several ROS files and deletes them. Having done this before, I can confirm that this command will completely break your ROS distribution, requiring a full reinstall to fix. So my question is: Is there a way to update cmake without removing the previous version or by avoid deleting the ROS files?

Problem (detailed)

According to other forums on the internet, updating cmake requires deleting the previous version with the command sudo apt remove cmake. The problem is that this command identifies many files from my ROS distribution and marks them for deletion e.g:

matt@matt:~$ sudo apt remove cmake
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:

  ... lots of miscellaneous packages ...

Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  cmake ros-indigo-actionlib ros-indigo-actionlib-msgs
  ros-indigo-actionlib-tutorials ros-indigo-amcl ros-indigo-base-local-planner
  ros-indigo-bond ros-indigo-bond-core ros-indigo-bondcpp ros-indigo-bondpy

  ... many, many more ROS files ...

  ros-indigo-visualization-tutorials ros-indigo-viz ros-indigo-voxel-grid
  ros-indigo-xacro
0 upgraded, 0 newly installed, 244 to remove and 347 not upgraded.
After this operation, 159 MB disk space will be freed.
Do you want to continue? [Y/n]

The full message is very long, so I have provided it in a text file here: cmake_warning.txt

I ran this command last time I needed to update cmake, and it completely broke my ROS distribution, requiring a full reinstall to fix. I'd prefer to avoid that happening again, either by updating cmake without deleting the old version, or by somehow preventing the command from deleting ROS files. Any help or advice would be greatly appreciated.

I also realize that this is more of a general-Linux type question rather than one specific to ROS. However, because it affects ROS users, and has surely affected several people before me, I thought I would be more likely to find an answer here, and that any answer I do find will be more relevant here than on another forum like StackOverflow. Having said that, if anyone thinks that is where this question should be asked, I can certainly move it.

System details

  • OS: Ubuntu 14.04
  • ROS version: 1.11.21 (Indigo Igloo)
  • GCC version: 4.8.4
  • Cmake version: 2.8.12.2
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
6

answered 2018-07-16 08:17:21 -0500

I don't think you should remove the system cmake. This will only lead to the problems you described. Instead, you could simply install your own version of cmake and let it override the system cmake.

cd ~/Downloads/cmake-3.12.0-rc3/   # or wherever you downloaded cmake
./bootstrap --prefix=$HOME/cmake-install
make 
make install
export PATH=$HOME/cmake-install/bin:$PATH
export CMAKE_PREFIX_PATH=$HOME/cmake-install:$CMAKE_PREFIX_PATH

The two export lines make sure that your updated cmake is used instead of the system cmake. You have to make sure that those lines are executed whenever you want to use the updated cmake. It's probably a good idea to put them into your .bashrc.

edit flag offensive delete link more

Comments

Thanks for the answer Martin! I've manage to avoid having to update cmake for now, but if it becomes unavoidable I'll definitely come back and give your solution a try.

M@t gravatar imageM@t ( 2018-07-18 22:15:01 -0500 )edit

thanks, worked like a charm for me on Ubuntu 16.04.05

volume_8091 gravatar imagevolume_8091 ( 2019-02-11 02:52:59 -0500 )edit

I tried this today. I was trying to update my cmake from 2.8.2 to 3.1.5. For me, cmake --version now gives me 3.1.5. But when I do catkin_make, it still shows some package requires minimum 3.1.2 and i am runing on 2.8.2. It seems somewhere in catkin_make in overwriting the PATH in terminal. Any thoughts? thanks

LucasGoei gravatar imageLucasGoei ( 2019-08-20 03:04:36 -0500 )edit

You need to clean and rebuild your catkin workspace after you update CMake

imgeorgiev gravatar imageimgeorgiev ( 2019-10-09 10:54:19 -0500 )edit
0

answered 2018-06-04 01:34:59 -0500

mgruhler gravatar image

Well, this is, in general, a thing which can lead to pretty undefined behaviour. Your package manager is trying to do the right thing, which is: "if I uninstall something other packages need, they won't work, so I'll remove those as well".

You are right, this is a general Linux/Ubuntu question. apt does not allow you to do this. But I once read about the dpkg --force-XXXX flags, which lead me to this post on ubuntuforums. Maybe this helps?

(Disclaimer, directly copied from the guy answering the original question: WARNING:: Doing this will probably make your system unusable, DO NOT ATTEMPT UNLESS YOU UNDERSTAND THIS. Don't blame me if your system breaks. ;-) )

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-06-04 00:10:56 -0500

Seen: 2,615 times

Last updated: Jul 16 '18