[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#958544: arm-linux-gnueabi-gcc does not use glibc in specified sysroot



Package: gcc-arm-linux-gnueabi
Version: 4:8.3.0-1

When I compile a program with `arm-linux-gnueabi-gcc --sysroot
/path/to/sysroot foo.c -o foo' , the output `foo' linked to the glibc
from libc6-armel-cross, rather than that in `/path/to/sysroot'

Steps to reproduce:
1. Prepare dummy.c:
`int main() {return 0;}'
2. Prepare a armel sysroot with OLDER glibc version, like Debian jessie:
`mkdir /tmp/jessie && cdebootstrap-static -a armel --foreign
--include libc6-dev jessie /tmp/jessie
http://archive.debian.org/debian'
3. Compile. Here is a transcript:
$ arm-linux-gnueabi-gcc --sysroot /tmp/jessie dummy.c -o dummy
$ file dummy
dummy: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux
3.2.0, BuildID[sha1]=a6c587dc6a3faa87e2b128af7c1ed208d0a9807a, not
stripped
$

The existance of `for GNU/Linux 3.2.0' is an evidence that
`arm-linux-gnueabi-gcc' linked the executable to the glibc from
libc6-armel-cross.
I suppose that the `dummy' executable, should be linked to glibc in
`/tmp/jessie'.

A temporary solution that works for me:
Just remove `libc6-armel-cross' and `libc6-dev-armel-cross', then
`arm-linux-gnueabi-gcc' uses the glibc I expected.
Here is a transcript:

$ sudo dpkg -r --force-depends libc6-armel-cross libc6-dev-armel-cross
dpkg: libc6-armel-cross: dependency problems, but removing anyway as
you requested:
 libubsan1-armel-cross depends on libc6-armel-cross (>= 2.28).
 libstdc++6-armel-cross depends on libc6-armel-cross (>= 2.28).
 libgomp1-armel-cross depends on libc6-armel-cross (>= 2.28).
 libgcc1-armel-cross depends on libc6-armel-cross (>= 2.28).
 libc6-dev-armel-cross depends on libc6-armel-cross (= 2.28-7cross1).
 libatomic1-armel-cross depends on libc6-armel-cross (>= 2.28).
 libasan5-armel-cross depends on libc6-armel-cross (>= 2.28).

(Reading database ... 231756 files and directories currently installed.)
Removing libc6-armel-cross (2.28-7cross1) ...
dpkg: libc6-dev-armel-cross: dependency problems, but removing anyway
as you requested:
 libstdc++-8-dev-armel-cross depends on libc6-dev-armel-cross (>= 2.13-5).

Removing libc6-dev-armel-cross (2.28-7cross1) ...
$ arm-linux-gnueabi-gcc --sysroot /tmp/jessie dummy.c -o dummy
$ file dummy
dummy: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV),
dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux
2.6.32, BuildID[sha1]=ddaee43603d60ae8044d4850001b464cf10b433a, not
stripped
$

I am using Debian GNU/Linux 10(buster), kernel 4.19.0-8-amd64 and
libc6-armel-cross 2.28-7cross1 .


Reply to: