cross
cross copied to clipboard
ldconfig issue on Apple Silicon M1 in Docker
Possibly due to not having support yet, https://github.com/rust-embedded/cross/issues/508
Some packages (for example gcc-arm-linux-gnueabihf crossbuild-essential-armhf) fail to install because ldconfig does not execute properly in the Docker image, it gives the error:
/sbin/ldconfig: 1: /sbin/ldconfig: Syntax error: word unexpected (expecting ")")
Using a Macbook Air M1.
It (ldconfig) does run fine on x86 Macs and Windows (x86).
I ran into this issue today also, and tried to figure out what's going on. I'm very new to how cross-compilation setups are usually done, but I think I've found the issue: /sbin/ldconfig in the container is an ARM binary, while the container otherwise seems to be x86_64.
✗ docker run -it ghcr.io/cross-rs/arm-unknown-linux-gnueabihf:0.2.4
root@d5f2a7211e2d:/# uname -a
Linux d5f2a7211e2d 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@d5f2a7211e2d:/# file `which file`
/usr/bin/file: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=2b26928f841d92afa31613c2c916a3abc96bbed8, stripped
root@d5f2a7211e2d:/# file /sbin/ldconfig
/sbin/ldconfig: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 4.19.21, with debug_info, not stripped
I don't really get why this would work on x86, but I only have a M1 Mac to try this on now, and it definitely fails there.