From 400e1e74d18f31e8cbbfd29024bd549f961ae388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sun, 24 Mar 2024 12:57:10 +0100 Subject: [PATCH] Fix cross compiled aarch64 nightly Linux builds --- tools/build/linux/Dockerfile-aarch64 | 1 + tools/build/linux/Dockerfile-cross-aarch64 | 8 ++++---- tools/build/linux/Dockerfile-libs | 4 ++-- tools/build/linux/Dockerfile-libs-aarch64 | 5 +++-- tools/build/linux/Makevars-aarch64 | 3 +++ 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tools/build/linux/Dockerfile-aarch64 b/tools/build/linux/Dockerfile-aarch64 index a084eab8a..fcce86720 100644 --- a/tools/build/linux/Dockerfile-aarch64 +++ b/tools/build/linux/Dockerfile-aarch64 @@ -55,6 +55,7 @@ RUN cp /etc/apk/repositories $AARCH64_ROOT/etc/apk/ RUN apk add \ ./packages/main/x86_64/binutils-aarch64-*apk \ ./packages/main/x86_64/gcc-aarch64-*.apk \ + ./packages/main/x86_64/libstdc++-dev-aarch64-*.apk \ ./packages/main/x86_64/g++-aarch64-*.apk RUN apk add --arch aarch64 --root $AARCH64_ROOT \ diff --git a/tools/build/linux/Dockerfile-cross-aarch64 b/tools/build/linux/Dockerfile-cross-aarch64 index 39341a0fb..7b85dfda2 100644 --- a/tools/build/linux/Dockerfile-cross-aarch64 +++ b/tools/build/linux/Dockerfile-cross-aarch64 @@ -15,11 +15,11 @@ # TODO: make the arch a build arg, so it is easy to create cross compilers # for other architectures. -# We use Alpine 3.16, because that's what r-minimal uses currently. +# We use Alpine 3.19, because that's what r-minimal uses currently. # When we update r-minimal, this image needs an update as well. # (We could probably use some r-minimal image as the base image, that's # slightly larger, but then we don't need to manually match versions.) -FROM alpine:3.16 AS build +FROM alpine:3.19 AS build RUN apk add alpine-sdk sudo git @@ -35,7 +35,7 @@ WORKDIR /home/csardi # /home/csardi/sysroot-aarch64 but gcc commands have command line # options to change that. RUN abuild-keygen -a -i -n -RUN git clone -b 3.16-stable https://github.com/alpinelinux/aports --depth 1 +RUN git clone -b 3.19-stable https://github.com/alpinelinux/aports --depth 1 # We don't want to build the whole small Alpine system that is the default # in `bootstreap.sh`, so we bail out before. We just need a fully @@ -52,7 +52,7 @@ RUN CBUILDROOT=~/sysroot-$BARCH ~/aports/scripts/bootstrap.sh $BARCH # host system, anyway, as ultimately we'll use r-minimal as base, not # this image. So we might as well do that for the cross packages as well.) -FROM alpine:3.16 +FROM alpine:3.19 USER root WORKDIR /root COPY --from=build /home/csardi/packages /root/packages diff --git a/tools/build/linux/Dockerfile-libs b/tools/build/linux/Dockerfile-libs index 9116db5b3..4e5bbfed5 100644 --- a/tools/build/linux/Dockerfile-libs +++ b/tools/build/linux/Dockerfile-libs @@ -4,7 +4,7 @@ # /usr/local/. Dockerfiles can then build on this container by copying # over /usr/local/. -FROM alpine:3.16 AS build +FROM alpine:3.19 AS build WORKDIR /root @@ -47,7 +47,7 @@ RUN cd curl-* && \ # We don't need to keep the compilation artifacts, so copy the results # to a clean image -FROM alpine:3.16 +FROM alpine:3.19 COPY --from=build /usr/local /usr/local/ # Some of this info is shown on the GH packages pages diff --git a/tools/build/linux/Dockerfile-libs-aarch64 b/tools/build/linux/Dockerfile-libs-aarch64 index d2bb3511e..9a0cc0a1f 100644 --- a/tools/build/linux/Dockerfile-libs-aarch64 +++ b/tools/build/linux/Dockerfile-libs-aarch64 @@ -13,7 +13,7 @@ FROM ghcr.io/r-lib/pak-cross-aarch64:latest AS cross -FROM alpine:3.16 AS build +FROM alpine:3.19 AS build USER root WORKDIR /root @@ -31,6 +31,7 @@ RUN cp /etc/apk/repositories $AARCH64_ROOT/etc/apk/ RUN apk add \ ./packages/main/x86_64/binutils-aarch64-*apk \ ./packages/main/x86_64/gcc-aarch64-*.apk \ + ./packages/main/x86_64/libstdc++-dev-aarch64-*.apk \ ./packages/main/x86_64/g++-aarch64-*.apk RUN apk add --arch aarch64 --root $AARCH64_ROOT \ @@ -103,7 +104,7 @@ RUN cd curl-* && \ # TODO: create a multi-arch pak-libs image -FROM --platform=linux/arm64 alpine:3.16 +FROM --platform=linux/arm64 alpine:3.19 COPY --from=build /usr/local /usr/local/ # Some of this info is shown on the GH packages pages diff --git a/tools/build/linux/Makevars-aarch64 b/tools/build/linux/Makevars-aarch64 index 0dbb5638d..baa851b92 100644 --- a/tools/build/linux/Makevars-aarch64 +++ b/tools/build/linux/Makevars-aarch64 @@ -1,5 +1,8 @@ CC=aarch64-alpine-linux-musl-gcc LD=aarch64-alpine-linux-musl-ld +AR=aarch64-alpine-linux-musl-ar +STRIP_STATIC_LIB = aarch64-alpine-linux-musl-strip --strip-debug +STRIP_SHARED_LIB = aarch64-alpine-linux-musl-strip --strip-unneeded LIBR= PKG_LIBS+=-static-libgcc $(AARCH64_ROOT)/usr/lib/libc.a CFLAGS+=-static-libgcc -static