When cross compiling for a 2011 Raspberry Pi 1 (armv6) using docker, if the program includes libatomic.a then when the program is run on the target architecture it outputs "Illegal Instructions" and stops.
Looking through the past issues, there are a number that have similar symptoms, but in this case the root cause seems to be this library. Only libatomic.a and libatomic.so seem to include armv7 instructions. My work-around is to replace libatomic.a from the Raspberry Pi distribution: https://downloads.raspberrypi.org/raspios_lite_armhf/root.tar.xz
Perhaps, the docker file could include a check of the sysroot contents.
$ docker run --rm -it ghcr.io/cross-rs/arm-unknown-linux-gnueabihf:0.2.5 bash
root@e1eb3b13927c:/# readelf -A /x-tools/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot/lib/libatomic.a | grep 'Tag_CPU_arch: v7' | head -1
Tag_CPU_arch: v7
root@e1eb3b13927c:/# readelf -A /x-tools/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot/lib/libatomic.so | grep 'Tag_CPU_arch: v7' | head -1
Tag_CPU_arch: v7
Hello.
When cross compiling for a 2011 Raspberry Pi 1 (armv6) using docker, if the program includes libatomic.a then when the program is run on the target architecture it outputs "Illegal Instructions" and stops.
Looking through the past issues, there are a number that have similar symptoms, but in this case the root cause seems to be this library. Only libatomic.a and libatomic.so seem to include armv7 instructions. My work-around is to replace libatomic.a from the Raspberry Pi distribution: https://downloads.raspberrypi.org/raspios_lite_armhf/root.tar.xz
Perhaps, the docker file could include a check of the sysroot contents.