Skip to content

Commit 6930d60

Browse files
committed
Update to Debian Trixie
I had two MIPS-related hiccups with this: - the musl-upstream `musl-gcc` wrapper script has a bug that drops compiler arguments (patch included here; hopefully we can remove in the future?) - QEMU couldn't run the resulting MUSL binaries until I applied an update to my binfmt magic/mask (https://bugs.debian.org/1041597, https://salsa.debian.org/qemu-team/qemu/-/commit/bb0811e353b757b3c4df1c0010e3a17a04a9ea9f) - it also runs just fine on real musl hardware
1 parent 8ffde12 commit 6930d60

File tree

13 files changed

+28
-4
lines changed

13 files changed

+28
-4
lines changed

Dockerfile.build

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# explicitly use Debian for maximum cross-architecture compatibility
2-
FROM debian:bookworm-slim
2+
FROM debian:trixie-slim
33

44
RUN set -eux; \
5-
apt-get update; \
65
dpkgArch="$(dpkg --print-architecture)"; \
7-
apt-get install -y --no-install-recommends \
6+
apt-get install --update -y --no-install-recommends \
87
ca-certificates \
98
gnupg \
109
wget \
@@ -37,8 +36,9 @@ RUN set -eux; \
3736
\
3837
arch-test \
3938
file \
39+
patch \
4040
; \
41-
rm -rf /var/lib/apt/lists/*
41+
apt-get dist-clean
4242

4343
# https://musl.libc.org/releases.html
4444
ENV MUSL_VERSION 1.2.5
@@ -59,6 +59,9 @@ RUN set -eux; \
5959
WORKDIR /usr/src/hello
6060
COPY . .
6161

62+
# https://bugs.debian.org/1050429: error: unrecognized command-line option '-EL' (on mips64le specifically/only)
63+
RUN patch --input="$PWD/musl-gcc-mips64le.patch" /usr/local/src/musl/tools/musl-gcc.specs.sh
64+
6265
# the following steps are grouped into "architecture families" and roughly ordered in a descending compatibility way such that we end up with the most accurate ".host-arch" symlink we can reasonably get
6366

6467
RUN set -ex; \

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ $(MUSL_GCC):
2020
mkdir -p '$(MUSL_DIR)'
2121
cd '$(MUSL_DIR)' && '$(MUSL_SRC)/configure' --disable-shared --prefix='$(MUSL_PREFIX)' > /dev/null
2222
$(MAKE) -C '$(MUSL_DIR)' -j '$(shell nproc)' install > /dev/null
23+
.PHONY: musl
24+
musl: $(MUSL_GCC)
2325

2426
$(C_TARGETS): hello.c $(MUSL_GCC)
2527
$(MUSL_GCC) $(CFLAGS) -Wl,--gc-sections -static \

amd64/hello-world/hello

0 Bytes
Binary file not shown.

arm32v5/hello-world/hello

-12 Bytes
Binary file not shown.

arm32v6/hello-world/hello

-12 Bytes
Binary file not shown.

arm32v7/hello-world/hello

-8 Bytes
Binary file not shown.

arm64v8/hello-world/hello

0 Bytes
Binary file not shown.

i386/hello-world/hello

0 Bytes
Binary file not shown.

mips64le/hello-world/hello

-32 Bytes
Binary file not shown.

musl-gcc-mips64le.patch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Origin: https://bugs.debian.org/1050429#64
2+
3+
--- tools/musl-gcc.specs.sh 2024-03-01 02:07:33.000000000 +0000
4+
+++ tools/musl-gcc.specs.sh.new 2025-06-17 21:19:01.669504848 +0000
5+
@@ -3,12 +3,13 @@
6+
ldso=$3
7+
cat <<EOF
8+
%rename cpp_options old_cpp_options
9+
+%rename cc1 old_cc1
10+
11+
*cpp_options:
12+
-nostdinc -isystem $incdir -isystem include%s %(old_cpp_options)
13+
14+
*cc1:
15+
-%(cc1_cpu) -nostdinc -isystem $incdir -isystem include%s
16+
+-nostdinc -isystem $incdir -isystem include%s %(old_cc1)
17+
18+
*link_libgcc:
19+
-L$libdir -L .%s

0 commit comments

Comments
 (0)