Best way of compiling applications to run on older linux distros

Tom St Denis tstdenis@ellipticsemi.com
Tue Nov 4 12:58:00 GMT 2008


Tom Quarendon wrote:
>> 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.
>
> But is works just fine on Windows. You compile specifying the os level 
> you're targetting and all later APIs are #ifdeffed out so you can't 
> use them. The resulting executable then works quite happily on the 
> older version of the OS. All of the OS entry points have fixed IDs in 
> the run time library, so there's no API compatibility, or ABI 
> compatibility issues, only semantic ones, and generally they're pretty 
> careful about that.
>
> The issue we're having on linux seems to be to do with the dynamic 
> loading hash table incompatbility, and the level of libstdc++ shared 
> object.

Can't you just link statically?  Then it's just a matter of being 
syscall compatible. 

Here's a tip, go grab yourself VMware or Sun's VM, then make a slew of 
VMs and install the distros you want in those.  That way you don't need 
an actual box for each OS and you can build it natively.  If what you 
are doing is professional and not just some hobby project you should 
just do it properly from the get-go.

Best is Sun's VM is free and just as quick as VMware (both rely on 
kernel modules to help run as much as possible natively on the cpu).

Tom



More information about the Gcc-help mailing list