This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Building for older systems
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: Michael Eager <eager at eagerm dot com>, "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Mon, 30 Nov 2015 23:46:07 -0500
- Subject: Re: Building for older systems
- Authentication-results: sourceware.org; auth=none
- References: <565B0993 dot 7040202 at eagerm dot com> <565B1383 dot 90104 at redhat dot com> <CALoOobMX2T4gKO1-dOjJaKgEWZZFZAME9Syw03c-TweDnD_Uwg at mail dot gmail dot com>
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.