Building for older systems

Carlos O'Donell carlos@redhat.com
Tue Dec 1 04:46:00 GMT 2015


On 11/29/2015 11:34 AM, Paul Pluzhnikov wrote:
> On Sun, Nov 29, 2015 at 7:02 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>> On 11/29/2015 09:20 AM, Michael Eager wrote:
>>> Any solutions to building for an older glibc?
>>
>> There is only one supported way to do what you want.
>>
>> You need to build against an old sysroot e.g. --sysroot option
>> in gcc.
> 
> Using --sysroot often requires building your own binutils (because
> system/native ld defaults to no sysroot support, or at least did in
> the past).

This is the case in Fedora, but I'm fixing it.
 
> The other ways to achieve "building against old glibc" are obviously
> build on an old system, or build in a chroot.

This is the safest way.

Particularly when you do anything that involves interfaces in libgcc.so
et. al. which are tied to the compiler you are using, and if they don't
match exactly with what you have in your sysroot, then you will break the
expectations of the compiler (given your runtime).

For example if new compiler helper routines were added, then you might
generate code that can't run in the sysroot.

> In past life I used to build Linux binaries that would run
> *everywhere* by building inside a VM running RedHat 6.2.

That works. I would like to point out to our readers that you said
Red Hat 6.2, not Red Hat Enterprise Linux 6.2 ;-)

Cheers,
Carlos.



More information about the Libc-help mailing list