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

Eric Wing ewmailing at gmail.com
Thu Apr 5 03:09:34 EDT 2018


Thanks for the responses. Yes, I just need this to run on Ubuntu 12.04
(and some other old Linux's in that era). Yes, I think the probably is
the libstdc++ dependency.

As pointed out, it is really hard to get a newer compiler on Ubuntu
12.04. I've been down this road before, and if memory serves, the gcc
bootstrapping process to get a newer compiler doesn't seem to work
with a compiler older than gcc 4.8. Same goes for clang, which also
weirdly relies on gcc 4.8 to bootstrap itself.

Anyway, CMake seems to already know how to ship binaries that work
across Linux distros. I'm pretty sure they just statically linked
libstdc++ and libgcc. In fact, I just built it with -static-libstdc++
-static-libgcc on a newer Linux and tested it on 12.04 and it seemed
to work.

But I wanted to know for sure how CMake is building their own binaries
in case there are subtle problems with what I did, and they have a
completely different way of building it, e.g. statically libmusl for C
and libc++ for C++, avoiding gcc entirely.

Also, I did not take care of the libssl, libcrypto, and libz
dependencies. I'm curious in practice how much trouble these are. (My
recollection with zlib is that it is extremely stable and they care a
great deal about not breaking backwards compatibility. I don't know
about the others.)

Thanks,
Eric


More information about the CMake mailing list