Best way of compiling applications to run on older linux distros

Andrew Haley
Tue Nov 4 11:24:00 GMT 2008

Tom Quarendon wrote:
>>> Obvisously one solution is to compile on Centos 4, using a gcc such
>>> as 3.4.
>>> However I'd like to use the latest gcc is I can.
>> Don't.  if you want to run on Centos 4, build on Centos 4.
> I don't just want to run on Centos4. I want to produce an application
> that will run on a wide variety of linux without having one version
> compiled for each disto. Much like I'd do on, say, Windows.

Right.  Like most systems, it's backwards compatible but not forwards.
Forwards compatibility is in general impossible since APIs are added
from time to time.

> Seems remarkable to me that if I want my application to run on Centos 4
> (which isn't exactly old), then I'm forced to use the vintage of
> compiler that was around at the time. Or is the point that I can use gcc
> 4.3, I've just got to build it up and then run it on Centos4 for the
> results to work.

That should work too, assuming you satisfy gcc's build dependencies and
install your own copies of the gcc runtime libraries on the target machines.


More information about the Gcc-help mailing list