4

I am currently trying to install some executable files in the cluster supported by my academic institution. When running the installation for a particular executable, I am asked to update my CMake version to at least 3.1 (the cluster currently has CMake 2.7). However, I am not a sudoer in the system and can't use 'sudo' or 'apt-get'.

Thus, I am trying to install CMake from source, and the cluster runs on Linux. I've search online on how to do this, but I always run into the trouble of having to use 'sudo', 'apt-get' or './bootstap' which I do not have and can't get without the 'sudo' command. What is the easiest way to install CMake on my home directory and instruct the cluster to run the new CMake version without using sudo?

  • 1
    Hi Oscar and welcome to askubuntu! You will find a solution on this link: https://askubuntu.com/a/350/790920 . – abu_bua Jul 08 '18 at 20:49

1 Answers1

5

CMake appears to follow the convention of allowing an installation prefix to be defined at build time. If you run

./bootstrap --help

or consult the provided README.rst file

You need to have a C++ compiler (supporting C++11) and a make installed. Run the bootstrap script you find in the source directory of CMake. You can use the --help option to see the supported options. You may use the --prefix=<install_prefix> option to specify a custom installation directory for CMake. You can run the bootstrap script from within the CMake source directory or any other build directory of your choice. Once this has finished successfully, run make and make install.

The choice of directory is up to you, but for example you could run

./bootstrap --prefix=$HOME/opt/cmake3.12.0
make
make install

to install everything under the root $HOME/opt/cmake3.12.0 without requiring elevated permissions.

steeldriver
  • 136,215
  • 21
  • 243
  • 336
  • Further information can be found on https://cmake.org/install/ – abu_bua Jul 08 '18 at 21:17
  • Well, so I've tried this by getting the binary online, untaring it and then moving to the cmake-version directory. However, it returns the error './bootstrap command not found'. – Oscar Araiza Bravo Jul 08 '18 at 21:27
  • 1
    @OscarAraizaBravo this answer is about how to "install CMake from source", as per the text of your question – steeldriver Jul 08 '18 at 21:29