Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This list of officially supported platforms is available in the Node.js [BUILDIN
* **linux-armv6l**: Linux ARMv6 binaries, cross-compiled on Ubuntu 22.04 with a [custom GCC 12 toolchain](https://github.com/rvagg/rpi-newer-crosstools) (for Node.js 16 and later) in a similar manner to the official linux-armv7l binaries. Binaries are optimized for `armv6zk` which is suitable for Raspberry Pi devices (1, 1+ and Zero in particular). ARMv6 binaries were dropped from Node.js 12 and ARMv6 support is now considered "Experimental".
* **riscv64**: Linux riscv64 (RISC-V), cross compiled on Ubuntu 20.04 with the toolchain which the Adoptium project uses (for now...). Built with --openssl-no-asm (Should be with --with-intl=none but that gets overriden)
* **loong64**: Linux loong64 (LoongArch64), cross compiled on Ubuntu 20.04 with the toolchain.
* **linux-arm64-musl**: Linux arm64 binaries compiled against [musl libc](https://www.musl-libc.org/). Primarily useful for users of Alpine Linux on arm64 hardware (e.g. Apple M1 machines). Linux arm64 with musl is considered "Experimental" by Node.js but the Node.js test infrastructure includes some Alpine test servers so support is generally good.

"Experimental" status for Node.js is defined as:
> Experimental: May not compile or test suite may not pass. The core team does not create releases for these platforms. Test failures on experimental platforms do not block releases. Contributions to improve support for these platforms are welcome.
Expand Down
1 change: 1 addition & 0 deletions bin/_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ recipes=(
"riscv64"
"loong64"
"x64-debug"
"arm64-musl"
)


Expand Down
57 changes: 57 additions & 0 deletions recipes/arm64-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM alpine:3.22

ARG GID=1000
ARG UID=1000

RUN addgroup -g $GID node \
&& adduser -u $UID -G node -s /bin/sh -D node

RUN apk add --no-cache \
libstdc++ \
&& apk add --no-cache --virtual .build-deps \
bash \
binutils-gold \
curl \
g++ \
gcc \
gnupg \
libgcc \
linux-headers \
make \
python3 \
ccache \
xz \
patch \
# extra packages required for creating the musl based cross-compiler
rsync make gcc g++ bzip2 git

COPY <<-EOF /config/config.mak
# We only set the variables that are really needed, others are the sane defaults from the repo itself
TARGET = aarch64-linux-musl
GCC_VER = 14.2.0
OUTPUT = /opt/aarch64-linux-musl-cross
EOF

# set the version we want do use.
# This is currently set to the last known working commit sha, as the lastest tag (v0.9.11) is not working
# We specifically don't use the master branch as protection against rougue changes.
# see following link for more context of what archives are available.
# https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives#source-code-archive-urls
RUN RELEASE="3635262e4524c991552789af6f36211a335a77b3" && \
wget https://github.com/richfelker/musl-cross-make/archive/${RELEASE}.tar.gz && \
tar -xzf ${RELEASE}.tar.gz && \
cd /musl-cross-make-${RELEASE} && \
make -I /config -j$(getconf _NPROCESSORS_ONLN) && \
make -I /config install && \
cd / && \
rm -rf /musl-cross-make-${RELEASE}/ ${RELEASE}.tar.gz

COPY --chown=node:node run.sh /home/node/run.sh

VOLUME /home/node/.ccache
VOLUME /out
VOLUME /home/node/node.tar.xz

USER node

ENTRYPOINT [ "/home/node/run.sh" ]
36 changes: 36 additions & 0 deletions recipes/arm64-musl/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e
set -x

release_urlbase="$1"
disttype="$2"
customtag="$3"
datestring="$4"
commit="$5"
fullversion="$6"
source_url="$7"
source_urlbase="$8"
config_flags=""

cd /home/node

tar -xf node.tar.xz
cd "node-${fullversion}"

export CC_host="ccache gcc"
export CXX_host="ccache g++"
export CC="ccache /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc"
export CXX="ccache /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ -static-libstdc++"

make -j$(getconf _NPROCESSORS_ONLN) binary V= \
DESTCPU="arm64" \
ARCH="arm64" \
VARIATION="musl" \
DISTTYPE="$disttype" \
CUSTOMTAG="$customtag" \
DATESTRING="$datestring" \
COMMIT="$commit" \
RELEASE_URLBASE="$release_urlbase" \
CONFIG_FLAGS="$config_flags"

mv node-*.tar.?z /out/