[CMake] How to build CMake so it works on an older Linux?

Stephen McDowell sjm324 at cornell.edu
Thu Apr 5 09:01:18 EDT 2018


Hi Suzuki,

(Note: to other CMake mailing list readers, this pertains very little to CMake itself.  I’m sending it to the mailing list so that future users with this issue may also have a possible solution).

Getting a newer version of GCC is quite challenging by yourself indeed, but you may be interested in the Spack package manager: http://spack.readthedocs.io/en/latest/getting_started.html <http://spack.readthedocs.io/en/latest/getting_started.html>

It’s designed for high performance computing, but has a special emphasis on supporting older distributions (since updating HPC cluster operating systems is the devil).

Some quick tips:

1. Once you start installing things, you cannot move the spack directory.  So decide where you want it and clone it there.  For example, I keep all of my installations in /opt/spack

    cd /opt
    sudo git clone https://github.com/spack/spack.git

    Assuming you are `user` on this system (echo $USER)
    sudo chown -R user spack/

Then proceed with the getting started tutorial.

2. You have many possible newer versions of GCC available, by default `spack install gcc` installs the newest one.  Run `spack info gcc` to see the versions available.  Suppose you installed gcc at 6.4.0 (which will as you know take a while).  You will want to make this available as a compiler, so you `spack load gcc at 6.4.0` (it might tell you to source a script, so do that) and run `spack compiler find`.  When `spack compiler list` shows your shiny new GCC compiler, you can now `spack install cmake %gcc at 6.4.0` to use GCC 6.4.0 to compile Cmake!  Note you don’t need to install GCC 6.4.0, that was purely an example.  I know there have been some issues with really old GCC versions compiling newer versions, but I think we fixed the underlying problem that caused that.  AKA my hope is this works seamlessly, but you may run into trouble.  If you do, you might try installing an older version of GCC (in this example, say 6.4.0 didn’t work, maybe try GCC 5.5.0).

I hope this is helpful for you!  There’s a lot more to spack, but if you get stuck raise an issue on GitHub.  The spack user community is very helpful and friendly to newcomers :)

Good luck!

-Stephen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180405/d3e60b35/attachment-0001.html>


More information about the CMake mailing list