Can I target older linux with newer gcc/clang? C++
c++, glibc, linux
Solution
Build with the newer gcc. Either install the new compiler on the old machine or comile on your new machine and install the necessary dynamic libraries on the old machine.
Note that multiple versions of libc (and also libstdc++) are supported on a single machine since they are typically versioned (i.e. libc.so.5, libc.so.6, etc)
Problem
Right now I compile my C++ software on a certain old version of linux (SLED 10) using the provided gcc and it can run on most newer versions as they have a newer glibc. Problem is, that old gcc doesn't support C++11 and I'd really like to use the new features. Now I have some ideas, but I'm sure others have the same need. What's actually worked for you? Ideas: - Build on a newer system, static link to newer glibc. (Not possible, right?) - Build on a newer system, compile and link against an older glibc. - Build on an older system using an updated gcc, link against older glibc. - Build on a newer system, dynamic link to newer glibc, set RPath and provide our glibc with installer. As a bonus, my software also support plugins and has an SDK. I'd really prefer that my customers could compile against my libraries without a huge hassle. Thanks in advance. Ideas welcome, proven solutions preferred.