From d668b07d64ffc21268dfc1b98b60985d38e08203 Mon Sep 17 00:00:00 2001 From: Jean-Francois Roy Date: Mon, 26 May 2025 17:21:23 -0700 Subject: [PATCH] fix(glibc): use lib64 for better compatibility This patch changes the glibc extension to use the `lib64` directory for libraries instead of `lib`. This better reflects a standard Fedora/FHS/LSB distribution and fixes issues with a few containers, with the Nvidia Linux installer, and with the Nvidia container toolkit. The Nvidia container toolkit mounts libraries at the same path as the host system and runs `ldconfig` to update the cache. Mounting 64-bit libraries in `lib` is wrong on Fedora-like _and_ Ubuntu-like distributions. Signed-off-by: Jean-Francois Roy Signed-off-by: Noel Georgi --- misc/glibc/ld.so.conf | 1 + misc/glibc/pkg.yaml | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/misc/glibc/ld.so.conf b/misc/glibc/ld.so.conf index 7b8c1c9..7a13b24 100644 --- a/misc/glibc/ld.so.conf +++ b/misc/glibc/ld.so.conf @@ -1 +1,2 @@ +/usr/local/glibc/usr/lib64 /usr/local/glibc/usr/lib diff --git a/misc/glibc/pkg.yaml b/misc/glibc/pkg.yaml index 054761c..313a1bf 100644 --- a/misc/glibc/pkg.yaml +++ b/misc/glibc/pkg.yaml @@ -24,12 +24,16 @@ steps: mkdir build cd build + echo "libc_cv_slibdir=/usr/local/glibc/usr/lib64" > config.cache ../configure \ --prefix=/usr/local/glibc \ - --libdir=/usr/local/glibc/usr/lib \ - --libexecdir=/usr/local/glibc/usr/lib \ - --enable-stack-protection=strong \ - --disable-werror + --bindir=/usr/local/glibc/usr/bin \ + --sbindir=/usr/local/glibc/usr/sbin \ + --libdir=/usr/local/glibc/usr/lib64 \ + --libexecdir=/usr/local/glibc/usr/libexec \ + --enable-stack-protector=strong \ + --disable-werror \ + --cache-file=config.cache build: - | cd build @@ -39,24 +43,25 @@ steps: mkdir -p \ /rootfs/usr/local/glibc/usr/bin \ /rootfs/usr/local/glibc/usr/lib \ - /rootfs/usr/local/glibc/usr/lib32 \ + /rootfs/usr/local/glibc/usr/lib64 \ + /rootfs/usr/local/glibc/usr/libexec \ /rootfs/usr/local/glibc/usr/sbin - ln -s usr/bin/ /rootfs/usr/local/glibc/bin - ln -s usr/lib/ /rootfs/usr/local/glibc/lib - ln -s usr/lib/ /rootfs/usr/local/glibc/lib64 - ln -s usr/sbin/ /rootfs/usr/local/glibc/sbin - ln -s lib/ /rootfs/usr/local/glibc/usr/lib64 + ln -s usr/bin /rootfs/usr/local/glibc/bin + ln -s usr/lib /rootfs/usr/local/glibc/lib + ln -s usr/lib64 /rootfs/usr/local/glibc/lib64 + ln -s usr/sbin /rootfs/usr/local/glibc/sbin cd build make install DESTDIR=/rootfs cp /pkg/ld.so.conf /rootfs/usr/local/glibc/etc/ld.so.conf + # Talos has /lib{64} -> /usr/lib, /{s}bin -> /usr/bin. + # Need to make '/sbin/ldconfig' and '/lib64/ld-linux-x86-64.so.2' work for compatibility. mkdir -p /rootfs/usr/lib /rootfs/usr/bin - ln -s /usr/local/glibc/usr/lib/ld-linux-x86-64.so.2 /rootfs/usr/lib/ld-linux-x86-64.so.2 + ln -s /usr/local/glibc/usr/lib64/ld-linux-x86-64.so.2 /rootfs/usr/lib/ld-linux-x86-64.so.2 ln -s /usr/local/glibc/usr/sbin/ldconfig /rootfs/usr/bin/ldconfig - # cleanup rm -rf /rootfs/usr/local/glibc/include rm -rf /rootfs/usr/local/glibc/share rm -rf /rootfs/usr/local/glibc/var