Open
Description
Current diff is tiny:
--- Dockerfile.x86_64 2024-02-27 19:26:58.125640186 +0000
+++ Dockerfile.arm64 2024-02-27 19:26:58.125640186 +0000
@@ -1,3 +1,4 @@
+# syntax=docker/dockerfile:1
FROM ubuntu:jammy
LABEL maintainer="Eirik Albrigtsen <[email protected]>"
@@ -38,14 +39,14 @@
# Install rust using rustup
ARG CHANNEL
ENV RUSTUP_VER="1.26.0" \
- RUST_ARCH="x86_64-unknown-linux-gnu" \
+ RUST_ARCH="aarch64-unknown-linux-gnu" \
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN curl "https://static.rust-lang.org/rustup/archive/${RUSTUP_VER}/${RUST_ARCH}/rustup-init" -o rustup-init && \
chmod +x rustup-init && \
./rustup-init -y --default-toolchain ${CHANNEL} --profile minimal --no-modify-path && \
rm rustup-init && \
- ~/.cargo/bin/rustup target add x86_64-unknown-linux-musl
+ ~/.cargo/bin/rustup target add aarch64-unknown-linux-musl
# Allow non-root access to cargo
RUN chmod a+X /root
@@ -66,7 +67,7 @@
# Install a more recent release of protoc (protobuf-compiler in jammy is 4 years old and misses some features)
RUN cd /tmp && \
- curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VER}/protoc-${PROTOBUF_VER}-linux-x86_64.zip -o protoc.zip && \
+ curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VER}/protoc-${PROTOBUF_VER}-linux-aarch_64.zip -o protoc.zip && \
unzip protoc.zip && \
cp bin/protoc /usr/bin/protoc && \
rm -rf *
@@ -75,10 +76,10 @@
# Primarily for the benefit of postgres.
# Lastly, link some linux-headers for openssl 1.1 (not used herein)
RUN mkdir $PREFIX && \
- echo "$PREFIX/lib" >> /etc/ld-musl-x86_64.path && \
- ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/x86_64-linux-musl/asm && \
- ln -s /usr/include/asm-generic /usr/include/x86_64-linux-musl/asm-generic && \
- ln -s /usr/include/linux /usr/include/x86_64-linux-musl/linux
+ echo "$PREFIX/lib" >> /etc/ld-musl-aarch64.path && \
+ ln -s /usr/include/aarch64-linux-gnu/asm /usr/include/aarch64-linux-musl/asm && \
+ ln -s /usr/include/asm-generic /usr/include/aarch64-linux-musl/asm-generic && \
+ ln -s /usr/include/linux /usr/include/aarch64-linux-musl/linux
# Build zlib (used in openssl and pq)
RUN curl -sSL https://zlib.net/zlib-$ZLIB_VER.tar.gz | tar xz && \
@@ -92,7 +93,7 @@
# TODO: fix so that it works
RUN curl -sSL https://www.openssl.org/source/openssl-$SSL_VER.tar.gz | tar xz && \
cd openssl-$SSL_VER && \
- ./Configure no-zlib no-shared -fPIC --prefix=$PREFIX --openssldir=$PREFIX/ssl linux-x86_64 && \
+ CFLAGS="-mno-outline-atomics" ./Configure no-zlib no-shared -fPIC --prefix=$PREFIX --openssldir=$PREFIX/ssl linux-aarch64 && \
env C_INCLUDE_PATH=$PREFIX/include make depend 2> /dev/null && \
make -j$(nproc) && make all install_sw && \
cd .. && rm -rf openssl-$SSL_VER
@@ -138,12 +139,13 @@
# See https://github.com/sgrif/pq-sys/pull/18
ENV PATH=/root/.cargo/bin:$PREFIX/bin:$PATH \
RUSTUP_HOME=/root/.rustup \
- CARGO_BUILD_TARGET=x86_64-unknown-linux-musl \
+ CARGO_BUILD_TARGET=aarch64-unknown-linux-musl \
+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld -Ctarget-feature=+crt-static" \
PKG_CONFIG_ALLOW_CROSS=true \
PKG_CONFIG_ALL_STATIC=true \
- PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=true \
+ PQ_LIB_STATIC_AARCH64_UNKNOWN_LINUX_MUSL=true \
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
- PG_CONFIG_X86_64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \
+ PG_CONFIG_AARCH64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \
OPENSSL_STATIC=true \
OPENSSL_DIR=$PREFIX \
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
strategy (i expect) will be:
- evars and values re-using values; pass in
ARG arch
asx86_64
oraarch64
and similar - symlink area, same as above ^
-
CARGO_TARGET_XXX_
+PQ_LIB_STATIC_XXX
evars variants at the end -> just add all of them? Noops to have in wrong arch. - CFLAGS for openssl. uhhh, not sure. huge inline arg str? 😬 templating? big if arch == X statement gating the RUN statement somehow?
Metadata
Assignees
Labels
No labels
Activity