Rust Segmentation fault in Amd64 Docker on Arm64 (Apple silicon)

⚓ Rust    📅 2025-08-22    👤 surdeus    👁️ 5      

surdeus

This is strange setup, I know, but anyways, I hope this is expected to work regardless.

I'm trying to build a mixed Rust / C application in a Docker image. Since the builder has to run on a CI infrastructure I'm building from a Amd64 image like this.

FROM --platform=linux/amd64 debian:bookworm

The funny part is: I do a double cross compile: The image runs on ARM64 (Apple silicon M1) and the compilation Target is a Raspberry Pi 5 (which is also Arm64). This is not a problem when compiling a Linux Kernel or other C/C++ applications. But Rust doens't seem to like it. And it fails even before setting the target:

root@39ffd1c178cb:/build/squeekboard# rustup toolchain list
nightly-x86_64-unknown-linux-gnu (active, default)
root@39ffd1c178cb:/build/squeekboard# rustc
error: rustc interrupted by SIGSEGV, printing backtrace

/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(+0x3c9564f)[0xffff7ec9564f]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0xffff7ae5b050]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc(realloc+0x941)[0x55555557bce1]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(+0x5402218)[0xffff80402218]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(_ZN5alloc3ffi5c_str7CString19_from_vec_unchecked17h2e6619e84d5fe257E+0x4b)[0xffff814fc669]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(_ZN118_$LT$std..thread..thread_name_string..ThreadNameString$u20$as$u20$core..convert..From$LT$alloc..string..String$GT$$GT$4from17h6ae244f1f57bb2c7E+0x49)[0xffff814fc767]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(_RNvCsdXQ5HUqDjE9_17rustc_driver_impl21install_ctrlc_handler+0x1da)[0xffff8152fb5a]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(_RNvCsdXQ5HUqDjE9_17rustc_driver_impl4main+0x15e)[0xffff8153049e]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc(+0x37b97)[0x55555558db97]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc(+0x37b83)[0x55555558db83]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc(+0x37b79)[0x55555558db79]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-f2568dfda593b617.so(_ZN3std2rt19lang_start_internal17hecb79513452c9f22E+0x491)[0xffff815671d1]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc(+0x74d47)[0x5555555cad47]
/lib/x86_64-linux-gnu/libc.so.6(+0x2724a)[0xffff7ae4624a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85)[0xffff7ae46305]
/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc(+0x74c54)[0x5555555cac54]

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

I'va also tried the nightly channel and the previous version 1.88. That won't work either. I've found some hints regarding the Kernel version:

uname -a
Linux 39ffd1c178cb 6.6.93-0-virt #1-Alpine SMP PREEMPT_DYNAMIC 2025-06-09 11:51:57 x86_64 GNU/Linux

I'm using Rancher desktop, which is using QEMU internally, this is the reason why the kernel version (Alpine) doesn't match the OS:

cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Any ideas?

6 posts - 2 participants

Read full topic

🏷️ Rust_feed