[llvm-dev] Targeting old glibc

Alexandre Bique via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 12 01:44:57 PST 2020


On Wed, Nov 11, 2020 at 10:04 PM James Y Knight <jyknight at google.com> wrote:
> The correct way is to compile against a sysroot which has an old glibc (both headers and libraries!) installed in it, rather than the new glibc.
>
> Anything else you try -- such as everything being recommended in the rest of the thread -- is an unsupportable hack, and should not be done. Possibly you can get it to work, for some particular sets of glibc versions, but there can be no guarantee. (Also, this isn't really a llvm question, it's a glibc question).

Following your advice, I've tried to prepare a sysroot with various approaches:
 - debootstrap ubuntu xenial and use --sysroot pointing to that
chroot; it did not work because of absolute path and symbolic link
using absolute path. And if I were to chroot in it, it would mean that
I have to replicate all the tools and their configuration (jenkins,
...) and I'd need to do more work to get a recent clang.
 - use the oldest freedesktop sdk sysroot from flatpak, yet it did not
work for the same reason (absolute path and absolute symlink)
 - compiling and old glibc (they don't build because -Werror catches
more problems with recent compilers than they did at the time of gcc
5)
 - now I'm about to use crosstool-ng to prepare a sysroot, but I'm
afraid that I might have other surprises as it goes beyond providing a
libc.

You're correct it is now going beyond the scope of llvm-dev, so I'll
start a discussion in libc-help.
Yet I think it would be great to be able to build using a modern OS
with the latest tools and target and older OS. It is not a crazy
request isn't it?

Thank you very much,
Alexandre


More information about the llvm-dev mailing list