2

I tried to get the latest version of CMake, as OpenSUSE is stuck to 3.5.2.

version=3.10
build=2
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
tar -xzvf cmake-$version.$build.tar.gz
cd cmake-$version.$build/
./bootstrap
make -j3
sudo make install

But something went silently wrong:

VM-LINUX:~/temp/cmake-3.10.2 # cmake --version
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake
cmake version 3.5.2

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

So I tried another way: change the version in the update repositories! And then I discovered that che CMake package is stuck at version 3.5.2 in OpenSUSE 42.3.

How can I add a repository so that I always have the latest version?

I'm a total newbie of Linux.

arrowd
  • 33,231
  • 8
  • 79
  • 110
Ernesto_Che
  • 67
  • 2
  • 8

3 Answers3

1

I had the same error regarding CMAKE_ROOT when installing CMake 3.12 from Git. The solution for me was to run:

sudo ln -s /usr/local/share/cmake-3.12 /usr/local/share/cmake

as it had installed in cmake-3.12 directory instead of cmake directory for some reason.

Nathan Mills
  • 2,243
  • 2
  • 9
  • 15
0

I assume you were following "How do I install the latest version of cmake from the command line?".

I had the same problem and your problem/solution is to be found in the comments:

When I ran this, I got an error CMake Error: Could not find CMAKE_ROOT !!! and it failed to update cmake. – Timothy Swan Dec 25 '17 at 21:47

This is not a solution to UPDATE but to INSTALL cmake. Try this command or google it to find a solution: sudo apt-get remove cmake cmake-data - Teocci Dec 26 '17 at 2:18

Community
  • 1
  • 1
Florian
  • 39,996
  • 9
  • 133
  • 149
  • I uninstalled CMake and then launched the commands in the question. Now the situation has worsened: `$ cmake -version` `bash: /usr/bin/cmake: is a directory` I lost my CMake. Furthermore: [1] should I need both the new and the old version, how should I get the old one back? [2] How to configure a repository in Package Manager that always keeps me updated? – Ernesto_Che Mar 15 '18 at 20:57
  • @Ernesto_Che On Linux you don't need a `cmake` version installed to build `cmake` (see [here](https://cmake.org/install/): `If there is no existing CMake installation, a bootstrap script is provided`). Since you now have uninstalled your "old" version of `cmake`, first try to do `sudo make install` on the CMake source project again. If that's not working, remove/delete the `cmake-3.10.2` folder again and start with the steps again from scratch. Probably you also need to remove the half finished installation of the "new" version of `cmake` under `/usr/local/bin/cmake` first. – Florian Mar 16 '18 at 21:11
  • @Ernesto_Che And - if you always want to have the latest version of `cmake` - there is no Package Manager server that will automatically keep you up to the latest version. Some more possibilities and alternative servers are described [here](https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu) or [here](https://askubuntu.com/questions/610291/how-to-install-cmake-3-2-on-ubuntu). – Florian Mar 16 '18 at 21:19
0
Opensuse has provided Tumbleweed and Leap for us. Tumbleweed always includes the newest packages.
 Leap has the most stable version packages.

Regards

ztdep
  • 343
  • 1
  • 4
  • 17