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, bb0811e353) - it also runs just fine on real musl hardware
This commit is contained in:
Tianon Gravi 2025-06-17 14:52:33 -07:00
parent 8ffde125c6
commit 6930d60e10
13 changed files with 28 additions and 4 deletions

View File

@ -1,10 +1,9 @@
# explicitly use Debian for maximum cross-architecture compatibility
FROM debian:bookworm-slim
FROM debian:trixie-slim
RUN set -eux; \
apt-get update; \
dpkgArch="$(dpkg --print-architecture)"; \
apt-get install -y --no-install-recommends \
apt-get install --update -y --no-install-recommends \
ca-certificates \
gnupg \
wget \
@ -37,8 +36,9 @@ RUN set -eux; \
\
arch-test \
file \
patch \
; \
rm -rf /var/lib/apt/lists/*
apt-get dist-clean
# https://musl.libc.org/releases.html
ENV MUSL_VERSION 1.2.5
@ -59,6 +59,9 @@ RUN set -eux; \
WORKDIR /usr/src/hello
COPY . .
# https://bugs.debian.org/1050429: error: unrecognized command-line option '-EL' (on mips64le specifically/only)
RUN patch --input="$PWD/musl-gcc-mips64le.patch" /usr/local/src/musl/tools/musl-gcc.specs.sh
# 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
RUN set -ex; \

View File

@ -20,6 +20,8 @@ $(MUSL_GCC):
mkdir -p '$(MUSL_DIR)'
cd '$(MUSL_DIR)' && '$(MUSL_SRC)/configure' --disable-shared --prefix='$(MUSL_PREFIX)' > /dev/null
$(MAKE) -C '$(MUSL_DIR)' -j '$(shell nproc)' install > /dev/null
.PHONY: musl
musl: $(MUSL_GCC)
$(C_TARGETS): hello.c $(MUSL_GCC)
$(MUSL_GCC) $(CFLAGS) -Wl,--gc-sections -static \

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

19
musl-gcc-mips64le.patch Normal file
View File

@ -0,0 +1,19 @@
Origin: https://bugs.debian.org/1050429#64
--- tools/musl-gcc.specs.sh 2024-03-01 02:07:33.000000000 +0000
+++ tools/musl-gcc.specs.sh.new 2025-06-17 21:19:01.669504848 +0000
@@ -3,12 +3,13 @@
ldso=$3
cat <<EOF
%rename cpp_options old_cpp_options
+%rename cc1 old_cc1
*cpp_options:
-nostdinc -isystem $incdir -isystem include%s %(old_cpp_options)
*cc1:
-%(cc1_cpu) -nostdinc -isystem $incdir -isystem include%s
+-nostdinc -isystem $incdir -isystem include%s %(old_cc1)
*link_libgcc:
-L$libdir -L .%s

Binary file not shown.

Binary file not shown.

Binary file not shown.