Skip to content

Commit 14fccda

Browse files
committed
feat: add riscv64 clang build with pointer compression enabled
Signed-off-by: Stewart X Addison <sxa@ibm.com>
1 parent 88ca193 commit 14fccda

5 files changed

Lines changed: 88 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This list of officially supported platforms is available in the Node.js [BUILDIN
3535
* **linux-x64-pointer-compression**: Linux x64 binaries compiled with V8 pointer compression enabled (`--experimental-enable-pointer-compression`).
3636
* **linux-armv6l**: Linux ARMv6 binaries, cross-compiled on Ubuntu 22.04 with a [custom GCC 12 toolchain](https://github.com/rvagg/rpi-newer-crosstools). Binaries are optimized for `armv6zk` which is suitable for Raspberry Pi devices (1, 1+ and Zero in particular).
3737
* **linux-riscv64**: Linux RISC-V 64-bit, cross-compiled on Ubuntu 24.04 with GCC 14.
38+
* **linux-riscv64-pointer-compression**: Linux RISC-V 64-bit, cross-compiled on Ubuntu 24.04 with clang-19 and --experimental-pointer-compression enabled to reduce RAM usage.
3839
* **linux-loong64**: Linux LoongArch64, cross-compiled with the Loongson toolchain.
3940
* **linux-x86**: Linux x86 (32-bit) binaries compiled against libc 2.17. 32-bit Linux binaries were dropped for Node.js 10 and 32-bit support is now considered "Experimental".
4041
* **linux-x64-usdt**: Linux x64 binaries compiled with DTrace/USDT support.
@@ -56,6 +57,7 @@ Builds are published at <https://unofficial-builds.nodejs.org/download/release/>
5657
| linux-arm64-musl | All | Added in [#189] |
5758
| linux-loong64 | >= v23; also v20.10+, v21, v22.14+ | Toolchain upgraded in [#172] |
5859
| linux-riscv64 | >= v17 | Note: 26 will require [extra CXXFLAGS](https://github.com/nodejs/build/issues/4099#issuecomment-3619150119) |
60+
| linux-riscv64-pointer-compression | >= v22 | Built with clang instead of GCC ([#222]) |
5961
| linux-x64-glibc-217 | v18 - v23 | v24+: Python too old in CentOS 7 container ([#177], [#176]) |
6062
| linux-x64-debug | v18 - v23 | v24+: C++ compiler too old ([#180]) |
6163
| linux-x64-pointer-compression | v14 - v22 | v23+: CentOS 7 toolchain too old ([#155], [#158]) |
@@ -66,6 +68,7 @@ Builds are published at <https://unofficial-builds.nodejs.org/download/release/>
6668
[#155]: https://github.com/nodejs/unofficial-builds/pull/155
6769
[#158]: https://github.com/nodejs/unofficial-builds/pull/158
6870
[#172]: https://github.com/nodejs/unofficial-builds/pull/172
71+
[#222]: https://github.com/nodejs/unofficial-builds/pull/222
6972
[#176]: https://github.com/nodejs/unofficial-builds/issues/176
7073
[#177]: https://github.com/nodejs/unofficial-builds/pull/177
7174
[#179]: https://github.com/nodejs/unofficial-builds/pull/179

bin/_config.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ recipes=(
88
"arm64-musl"
99
"riscv64"
1010
"loong64"
11+
"riscv64-pointer-compression"
1112

1213
# Legacy recipes, currently gated out for modern Node.js versions
1314
"x86" # major < 22
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM ubuntu:24.04
2+
3+
ARG GID=1000
4+
ARG UID=1000
5+
6+
RUN apt -y update && \
7+
apt -y dist-upgrade && \
8+
apt install -y \
9+
clang-19 \
10+
lld \
11+
gcc-riscv64-linux-gnu \
12+
g++-riscv64-linux-gnu \
13+
ccache \
14+
make \
15+
git \
16+
xz-utils \
17+
adduser && \
18+
apt install -y less file bzip2 curl adduser joe
19+
20+
RUN (addgroup --gid $GID node || groupmod -n node $(getent group $GID | cut -d: -f1)) \
21+
&& (adduser --gid $GID --uid $UID --disabled-password --gecos "" node || usermod -l node -g $GID -d /home/node -m $(getent passwd $UID | cut -d: -f1))
22+
23+
COPY --chown=node:node run.sh /home/node/run.sh
24+
25+
VOLUME /home/node/.ccache
26+
VOLUME /out
27+
VOLUME /home/node/node.tar.xz
28+
29+
USER node
30+
31+
ENTRYPOINT [ "/home/node/run.sh" ]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
release_urlbase="$1"
7+
disttype="$2"
8+
customtag="$3"
9+
datestring="$4"
10+
commit="$5"
11+
fullversion="$6"
12+
source_url="$7"
13+
source_urlbase="$8"
14+
config_flags="--openssl-no-asm --use_clang --experimental-enable-pointer-compression"
15+
16+
cd /home/node
17+
18+
tar -xf node.tar.xz
19+
cd "node-${fullversion}"
20+
21+
export CCACHE_BASEDIR="$PWD"
22+
export CC='ccache clang-19 --target=riscv64-linux-gnu -march=rv64gc'
23+
export CXX='ccache clang++-19 --target=riscv64-linux-gnu -march=rv64gc'
24+
export CC_host='ccache clang-19'
25+
export CXX_host='ccache clang++-19'
26+
27+
#make -j$(getconf _NPROCESSORS_ONLN) binary \
28+
29+
make -j4 binary \
30+
DESTCPU="riscv64" \
31+
ARCH="riscv64" \
32+
VARIATION="" \
33+
DISTTYPE="$disttype" \
34+
CUSTOMTAG="$customtag" \
35+
DATESTRING="$datestring" \
36+
COMMIT="$commit" \
37+
RELEASE_URLBASE="$release_urlbase" \
38+
CONFIG_FLAGS="$config_flags"
39+
40+
# If removal of ICU is desired, add "BUILD_INTL_FLAGS=--with-intl=none" above
41+
42+
mv node-*.tar.?z /out/
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -xe
2+
3+
__dirname=$1
4+
fullversion=$2
5+
6+
. ${__dirname}/_decode_version.sh
7+
8+
decode "$fullversion"
9+
10+
# v20 does not build successfully with clang19
11+
test "$major" -ge "22"

0 commit comments

Comments
 (0)