Merge pull request #217 from infosiftr/fix-i386-redux

Fix i386 again, but correctly
This commit is contained in:
yosifkit 2025-02-19 17:04:49 -08:00 committed by GitHub
commit 984ae62e47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 70 additions and 21 deletions

View File

@ -15,8 +15,6 @@ RUN set -eux; \
tzdata \ tzdata \
# busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility) # busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility)
tar \ tar \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev dpkg \
; ;
{{ ) else ( -}} {{ ) else ( -}}
FROM debian:bookworm-slim FROM debian:bookworm-slim
@ -30,8 +28,6 @@ RUN set -eux; \
gnupg \ gnupg \
make \ make \
patch \ patch \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev \
; \ ; \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
{{ ) end -}} {{ ) end -}}
@ -350,7 +346,20 @@ RUN set -eux; \
export CROSS_COMPILE="$CROSS_COMPILE-"; \ export CROSS_COMPILE="$CROSS_COMPILE-"; \
{{ ) else ( -}} {{ ) else ( -}}
# we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture # we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture
ARCH="$(dpkg-architecture --query DEB_HOST_ARCH_CPU)"; \ # see https://git.busybox.net/busybox/tree/arch?h=1_37_stable#n145 for the only important values this *has* to match (everything else is best-effort, and needs to match the munging in https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n185)
distroArch="$({{ if env.variant == "musl" then "apk --print-arch" else "dpkg --print-architecture" end }})"; \
case "$distroArch" in \
amd64 | x86_64) ARCH='x86_64' ;; \
arm64 | aarch64) ARCH='aarch64' ;; \
armhf | armel | armv*) ARCH='arm' ;; \
i386 | x86) ARCH='i386' ;; \
mips*) ARCH='mips' ;; \
ppc*) ARCH='powerpc' ;; \
riscv64) ARCH='riscv64' ;; \
s390x) ARCH='s390' ;; \
*) echo >&2 "error: unknown architecture: '$distroArch'"; exit 1 ;; \
esac; \
[ -n "$ARCH" ]; \
export ARCH; \ export ARCH; \
{{ ) end -}} {{ ) end -}}
make -j "$nproc" busybox; \ make -j "$nproc" busybox; \

View File

@ -15,8 +15,6 @@ RUN set -eux; \
gnupg \ gnupg \
make \ make \
patch \ patch \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev \
; \ ; \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
@ -114,7 +112,20 @@ RUN set -eux; \
nproc="$(nproc)"; \ nproc="$(nproc)"; \
# https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145 # https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145
# we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture # we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture
ARCH="$(dpkg-architecture --query DEB_HOST_ARCH_CPU)"; \ # see https://git.busybox.net/busybox/tree/arch?h=1_37_stable#n145 for the only important values this *has* to match (everything else is best-effort, and needs to match the munging in https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n185)
distroArch="$(dpkg --print-architecture)"; \
case "$distroArch" in \
amd64 | x86_64) ARCH='x86_64' ;; \
arm64 | aarch64) ARCH='aarch64' ;; \
armhf | armel | armv*) ARCH='arm' ;; \
i386 | x86) ARCH='i386' ;; \
mips*) ARCH='mips' ;; \
ppc*) ARCH='powerpc' ;; \
riscv64) ARCH='riscv64' ;; \
s390x) ARCH='s390' ;; \
*) echo >&2 "error: unknown architecture: '$distroArch'"; exit 1 ;; \
esac; \
[ -n "$ARCH" ]; \
export ARCH; \ export ARCH; \
make -j "$nproc" busybox; \ make -j "$nproc" busybox; \
./busybox --help; \ ./busybox --help; \

View File

@ -20,8 +20,6 @@ RUN set -eux; \
tzdata \ tzdata \
# busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility) # busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility)
tar \ tar \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev dpkg \
; ;
# pub 1024D/ACC9965B 2006-12-12 # pub 1024D/ACC9965B 2006-12-12
@ -124,7 +122,20 @@ RUN set -eux; \
nproc="$(nproc)"; \ nproc="$(nproc)"; \
# https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145 # https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145
# we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture # we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture
ARCH="$(dpkg-architecture --query DEB_HOST_ARCH_CPU)"; \ # see https://git.busybox.net/busybox/tree/arch?h=1_37_stable#n145 for the only important values this *has* to match (everything else is best-effort, and needs to match the munging in https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n185)
distroArch="$(apk --print-arch)"; \
case "$distroArch" in \
amd64 | x86_64) ARCH='x86_64' ;; \
arm64 | aarch64) ARCH='aarch64' ;; \
armhf | armel | armv*) ARCH='arm' ;; \
i386 | x86) ARCH='i386' ;; \
mips*) ARCH='mips' ;; \
ppc*) ARCH='powerpc' ;; \
riscv64) ARCH='riscv64' ;; \
s390x) ARCH='s390' ;; \
*) echo >&2 "error: unknown architecture: '$distroArch'"; exit 1 ;; \
esac; \
[ -n "$ARCH" ]; \
export ARCH; \ export ARCH; \
make -j "$nproc" busybox; \ make -j "$nproc" busybox; \
./busybox --help; \ ./busybox --help; \

View File

@ -15,8 +15,6 @@ RUN set -eux; \
gnupg \ gnupg \
make \ make \
patch \ patch \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev \
; \ ; \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*

View File

@ -15,8 +15,6 @@ RUN set -eux; \
gnupg \ gnupg \
make \ make \
patch \ patch \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev \
; \ ; \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
@ -115,7 +113,20 @@ RUN set -eux; \
nproc="$(nproc)"; \ nproc="$(nproc)"; \
# https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145 # https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145
# we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture # we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture
ARCH="$(dpkg-architecture --query DEB_HOST_ARCH_CPU)"; \ # see https://git.busybox.net/busybox/tree/arch?h=1_37_stable#n145 for the only important values this *has* to match (everything else is best-effort, and needs to match the munging in https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n185)
distroArch="$(dpkg --print-architecture)"; \
case "$distroArch" in \
amd64 | x86_64) ARCH='x86_64' ;; \
arm64 | aarch64) ARCH='aarch64' ;; \
armhf | armel | armv*) ARCH='arm' ;; \
i386 | x86) ARCH='i386' ;; \
mips*) ARCH='mips' ;; \
ppc*) ARCH='powerpc' ;; \
riscv64) ARCH='riscv64' ;; \
s390x) ARCH='s390' ;; \
*) echo >&2 "error: unknown architecture: '$distroArch'"; exit 1 ;; \
esac; \
[ -n "$ARCH" ]; \
export ARCH; \ export ARCH; \
make -j "$nproc" busybox; \ make -j "$nproc" busybox; \
./busybox --help; \ ./busybox --help; \

View File

@ -20,8 +20,6 @@ RUN set -eux; \
tzdata \ tzdata \
# busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility) # busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility)
tar \ tar \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev dpkg \
; ;
# pub 1024D/ACC9965B 2006-12-12 # pub 1024D/ACC9965B 2006-12-12
@ -125,7 +123,20 @@ RUN set -eux; \
nproc="$(nproc)"; \ nproc="$(nproc)"; \
# https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145 # https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n145
# we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture # we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture
ARCH="$(dpkg-architecture --query DEB_HOST_ARCH_CPU)"; \ # see https://git.busybox.net/busybox/tree/arch?h=1_37_stable#n145 for the only important values this *has* to match (everything else is best-effort, and needs to match the munging in https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n185)
distroArch="$(apk --print-arch)"; \
case "$distroArch" in \
amd64 | x86_64) ARCH='x86_64' ;; \
arm64 | aarch64) ARCH='aarch64' ;; \
armhf | armel | armv*) ARCH='arm' ;; \
i386 | x86) ARCH='i386' ;; \
mips*) ARCH='mips' ;; \
ppc*) ARCH='powerpc' ;; \
riscv64) ARCH='riscv64' ;; \
s390x) ARCH='s390' ;; \
*) echo >&2 "error: unknown architecture: '$distroArch'"; exit 1 ;; \
esac; \
[ -n "$ARCH" ]; \
export ARCH; \ export ARCH; \
make -j "$nproc" busybox; \ make -j "$nproc" busybox; \
./busybox --help; \ ./busybox --help; \

View File

@ -15,8 +15,6 @@ RUN set -eux; \
gnupg \ gnupg \
make \ make \
patch \ patch \
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
dpkg-dev \
; \ ; \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*