0

I'm having issues getting cmake installed onto my machine. Here is what I am running:

sudo apt-get -f install cmake

And here is the output:

Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 cmake : Depends: libjsoncpp1 but it is not installable

I have tried running apt-get update but it doesn't seem to help. Please let me know what I should try. Would be happy to provide more information.

Thanks! :)

Edit: The output of "apt-cache policy cmake" is as follows:

    cmake:
  Installed: (none)
  Candidate: 3.5.2-2ubuntu1~ubuntu16.04.1~ppa1
  Version table:
     3.5.2-2ubuntu1~ubuntu16.04.1~ppa1 0
        500 http://ppa.launchpad.net/thomas-schiex/blender/ubuntu/ trusty/main amd64 Packages
     3.2.2-2~ubuntu14.04.1~ppa1 0
        500 http://ppa.launchpad.net/george-edison55/cmake-3.x/ubuntu/ trusty/main amd64 Packages
     2.8.12.2-0ubuntu3 0
        500 http://ca.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

Thanks!

Update: Thanks! I was able to install cmake. However, I can't seem to make anything with it. I'm running

cmake ../

in an empty directory which I created inside the project I'm trying to make. Here is the output:

CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.

Would anybody have any idea on what to do next? I have tried uninstalling and reinstalling as well as apt-get update. Again, I can post more information on here if needed.

Thanks!

3
  • 3
    You must have made some unusual changes to your sources.list* files, as libjsoncpp1 is only available for Xenial and later (refer packages.ubuntu.com/…). That package is not a requirement for Trusty's [14.04] version of cmake (refer packages.ubuntu.com/trusty/cmake-curses-gui & packages.ubuntu.com/source/trusty/cmake)
    – guiverc
    Mar 9, 2018 at 21:49
  • What is the output of apt-cache policy cmake? On normal Trusty cmake installs normally, you have PPA or third-party repositories.
    – N0rbert
    Mar 10, 2018 at 10:08
  • @N0rbert I add the output to the question - thanks for your help!
    – ellen
    Mar 12, 2018 at 2:02

3 Answers 3

0

You can install cmake from main repository by specifying its version:

sudo apt-get install cmake=2.8.12.2-0ubuntu3

If it fails, try one of the following methods:

  • remove PPAs from system with their packages and then install version from main repository

    sudo ppa-purge ppa:thomas-schiex/blender
    sudo ppa-purge ppa:george-edison55/cmake-3.x
    sudo apt-get install cmake
    
  • temporary disable PPAs, install cmake then enable PPAs:

    sudo add-apt-repository -r ppa:thomas-schiex/blender
    sudo add-apt-repository -r ppa:george-edison55/cmake-3.x
    sudo apt-get update
    sudo apt-get install cmake
    sudo add-apt-repository ppa:thomas-schiex/blender
    sudo add-apt-repository ppa:george-edison55/cmake-3.x
    

Then you can try to build simple cmake example. Fast googling gave me the cmake-example.git repository. I do not know what is this, but it compiles fast and runs normally:

sudo apt-get install cmake git build-essential gfortran
git clone https://github.com/bast/cmake-example.git
cd cmake-example/
mkdir build
cd build
cmake ..
make

You can test it by executing compiled programs:

./hello.x
./main.x
./unit_tests

If it fails then you have other problems in your system.

3
  • Thanks! I was able to install cmake version 2.8 but now I'm having problems using it...I will update my post.
    – ellen
    Mar 12, 2018 at 18:51
  • I updated my answer - added cmake-example.
    – N0rbert
    Mar 12, 2018 at 20:14
  • Thanks @N0rbert - I had already cloned the repository I wanted to make, but I didn't have build-essential gfortran installed. I tried installing gfortran and running cmake but I got the same error as before. Do I need to clone the repository again?
    – ellen
    Mar 12, 2018 at 23:20
0

Cmake 3.16.5 installation from sources for Ubuntu 18.04 and 19.10:

  • wget https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5.tar.gz
  • tar vxzv cmake-3.16.5.tar.gz
  • cd cmake-3.16.5
  • ./bootstrap
  • make
  • sudo make install

I have two cmake versions installed on my Ubuntu 18.04 VM:

whereis cmake
cmake: /usr/bin/cmake /usr/lib/x86_64-linux-gnu/cmake /usr/local/bin/cmake /usr/share/cmake /usr/share/man/man1/cmake.1.gz

user@u1804:~$ /usr/local/bin/cmake --version
cmake version 3.16.5

user@u1804:~$ cmake --version
cmake version 3.16.5

user@u1804:~$ /usr/bin/cmake --version
cmake version 3.10.2

Older version of cmake have been installed by sudo apt install cmake.

But current the latest stable release of cmake 3.16.5 could also be installed using snap:

sudo snap install cmake
-1

There is an unofficial repository that has a version for 14.04.

sudo add-apt-repository ppa:mantid/mantid
sudo apt-get update

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .