Skip to content

Commit

Permalink
Fix cross compiled aarch64 nightly Linux builds
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Mar 24, 2024
1 parent 27dbbf6 commit 400e1e7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions tools/build/linux/Dockerfile-aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
8 changes: 4 additions & 4 deletions tools/build/linux/Dockerfile-cross-aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tools/build/linux/Dockerfile-libs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tools/build/linux/Dockerfile-libs-aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tools/build/linux/Makevars-aarch64
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 400e1e7

Please sign in to comment.