Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

Installing and use cmake 3.4.1 in Ubuntu 14.04 using alternatives
Thursday - Jan 7th 2016 - by - (5 comments)

Due to a developer request I needed to install the latest cmake 3.4.1 on an Ubuntu 14.04 LTS, however in trusty the cmake version is somewhat outdated (2.8.12) and there are no newer version in trusty-backports either.

On Ubuntu PPA I found a personal repository from Nathan Osman for cmake 3.x packages which sounds about the right source. Unfortunately this PPA does not contain the 3.4.1 version yet, so I had to go and compile cmake myself.

Compiling of cmake is pretty straight forward:

wget http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz
tar -xvzf cmake-3.4.1.tar.gz
cd cmake-3.4.1/
./configure
make

Make's install command installs cmake by default in /usr/local/bin/cmake, shared files are installed into /usr/local/share/cmake-3.4.

sudo make install

Now I wanted to tell Ubuntu that the cmake command is now being replaced by an alternative installation. This can be done using update-alternatives:

update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force

This tells Ubuntu to create a new alternative for /usr/bin/cmake by using /usr/local/bin/cmake. The name of this replacement/alternative is "cmake". In my case I needed to add --force because cmake was already installed and the /usr/bin/cmake binary wasn't replaced with the symlink otherwise.

Now cmake is available system wide and can be launched with the new 3.4.1 version:

cmake --version
cmake version 3.4.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

 

Add a comment

Show form to leave a comment

Comments (newest first):

alxcancado from Brazil wrote on Feb 3rd, 2018:
Thank you! I just installed in ethOS (ubuntu based)

Craig from USA wrote on Apr 4th, 2017:
Terrific write-up! Worked well for me, except the "update-alternatives" command gave me this error:

update-alternatives: using /usr/local/bin/cmake to provide /usr/bin/cmake (cmake) in auto mode
update-alternatives: error: error creating symbolic link `/etc/alternatives/cmake.dpkg-tmp': Permission denied

I just had to precede the command with "sudo" and the rest was fine. Not sure if everyone needs to, but thought I'd mention it. In my case, I was installing cmake 3.7.2 onto Ubuntu 14.04.

suek0 from Spain wrote on Feb 23rd, 2017:
Very useful!
Thanks a lot.

suek0 from Spain wrote on Feb 23rd, 2017:
Very useful!
Thanks a lot.

guar wrote on May 10th, 2016:
It was very useful, since I am total newbie with Ubuntu. It saved me a lot of time. Thank you!


Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7028 Days
until Death of Computers
Why?