Hi Aurelien,

On Sun, Feb 04, 2024 at 09:43:53PM +0100, Aurelien Jarno wrote:
> No, it is actually needed. For instance using the arm64 cross-compiler
> on amd64:
> 
> $ rm /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1
> $ arch64-linux-gnu-gcc -o test test.c
> /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: 
> cannot find /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1: No such file or 
> directory
> collect2: error: ld returned 1 exit status

Right. For one thing this is not exactly the case where we're after.
This is the plain architecture case where the rtld link will just be
there by virtue of being there in the multiarch libc package.

The case where we're after is running a cross compiler with multilib. Say
I install i686-linux-gnu-gcc and pass -mx32:
$ i686-linux-gnu-gcc -mx32 test.c -o test
$ rm /usr/i686-linux-gnu/libx32/ld-linux-x32.so.2
$ i686-linux-gnu-gcc -mx32 test.c -o test
/usr/lib/gcc-cross/i686-linux-gnu/13/../../../../i686-linux-gnu/bin/ld: cannot 
find /usr/i686-linux-gnu/libx32/ld-linux-x32.so.2: No such file or directory
collect2: error: ld returned 1 exit status
$

So this confirms your initial suspicion on the actually affected case.
Thank you.

c-t-b has repacking code with arch-specific mangling (of slibdir)
already.
https://sources.debian.org/src/cross-toolchain-base/68/debian/rules/#L563
Adding to that wouldn't be the worst. A relatively easy measure would be
running the libc-alt.postinst manually with DPKG_ROOT set to have it
create the symlink that way. Do you think this is too much of a hack?

Helmut

Reply via email to