From f2272348fa4b540ae8c5968f2579954ebe2ab0b8 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Tue, 16 Jan 2024 02:33:23 -0500 Subject: [PATCH 1/9] feat: add debug recipe to build.sh --- bin/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/build.sh b/bin/build.sh index aca23d3..7603865 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -18,6 +18,7 @@ recipes=" \ x64-usdt \ riscv64 \ loong64 \ + debug \ " ccachedir=$(realpath "${workdir}/.ccache") stagingdir=$(realpath "${workdir}/staging") From 0b9ba920eadc4446f3eec7a3a16be6cf6722039a Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Tue, 16 Jan 2024 03:40:22 -0500 Subject: [PATCH 2/9] feat: add debug recipe --- recipes/debug/Dockerfile | 33 ++++++++++++++++++++++++++++++++ recipes/debug/run.sh | 36 +++++++++++++++++++++++++++++++++++ recipes/debug/should-build.sh | 10 ++++++++++ 3 files changed, 79 insertions(+) create mode 100644 recipes/debug/Dockerfile create mode 100755 recipes/debug/run.sh create mode 100755 recipes/debug/should-build.sh diff --git a/recipes/debug/Dockerfile b/recipes/debug/Dockerfile new file mode 100644 index 0000000..6e96aa3 --- /dev/null +++ b/recipes/debug/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:22.04 + +ARG GID=1000 +ARG UID=1000 + +RUN addgroup --gid $GID node \ + && adduser --gid $GID --uid $UID --disabled-password --gecos node node + +RUN apt-get update \ + && apt-get dist-upgrade -y \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && apt-get update \ + && apt-get install -y \ + git \ + g++ \ + curl \ + make \ + python3 \ + python3-pip \ + python3-distutils \ + ccache \ + xz-utils + +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" ] diff --git a/recipes/debug/run.sh b/recipes/debug/run.sh new file mode 100755 index 0000000..5e745a8 --- /dev/null +++ b/recipes/debug/run.sh @@ -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" +config_flags="" + +cd /home/node + +tar -xf node.tar.xz +cd "node-${fullversion}" + +export CC="ccache gcc" +export CXX="ccache g++" + +./configure --debug + +make -j$(getconf _NPROCESSORS_ONLN) binary V= \ + DESTCPU="x64" \ + ARCH="x64" \ + VARIATION="" \ + DISTTYPE="$disttype" \ + CUSTOMTAG="$customtag" \ + DATESTRING="$datestring" \ + COMMIT="$commit" \ + RELEASE_URLBASE="$release_urlbase" \ + CONFIG_FLAGS="$config_flags" + +mv node-*.tar.?z /out/ diff --git a/recipes/debug/should-build.sh b/recipes/debug/should-build.sh new file mode 100755 index 0000000..2453d49 --- /dev/null +++ b/recipes/debug/should-build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -xe + +__dirname=$1 +fullversion=$2 + +. ${__dirname}/_decode_version.sh + +decode "$fullversion" + +test "$major" -ge "18" From b998f42a132705055b50b8eabf3c3900ccdfc41e Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Tue, 16 Jan 2024 22:19:50 -0500 Subject: [PATCH 3/9] feat: get x64-debug recipe working correctly --- bin/build.sh | 2 +- recipes/{debug => x64-debug}/Dockerfile | 0 recipes/{debug => x64-debug}/run.sh | 4 +--- recipes/{debug => x64-debug}/should-build.sh | 2 ++ 4 files changed, 4 insertions(+), 4 deletions(-) rename recipes/{debug => x64-debug}/Dockerfile (100%) rename recipes/{debug => x64-debug}/run.sh (92%) rename recipes/{debug => x64-debug}/should-build.sh (79%) diff --git a/bin/build.sh b/bin/build.sh index 7603865..6c76b0e 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -13,12 +13,12 @@ recipes=" \ x86 \ musl \ armv6l \ + x64-debug \ x64-glibc-217 \ x64-pointer-compression \ x64-usdt \ riscv64 \ loong64 \ - debug \ " ccachedir=$(realpath "${workdir}/.ccache") stagingdir=$(realpath "${workdir}/staging") diff --git a/recipes/debug/Dockerfile b/recipes/x64-debug/Dockerfile similarity index 100% rename from recipes/debug/Dockerfile rename to recipes/x64-debug/Dockerfile diff --git a/recipes/debug/run.sh b/recipes/x64-debug/run.sh similarity index 92% rename from recipes/debug/run.sh rename to recipes/x64-debug/run.sh index 5e745a8..0732e26 100755 --- a/recipes/debug/run.sh +++ b/recipes/x64-debug/run.sh @@ -10,7 +10,7 @@ datestring="$4" commit="$5" fullversion="$6" source_url="$7" -config_flags="" +config_flags="--gdb --debug --debug-node" cd /home/node @@ -20,8 +20,6 @@ cd "node-${fullversion}" export CC="ccache gcc" export CXX="ccache g++" -./configure --debug - make -j$(getconf _NPROCESSORS_ONLN) binary V= \ DESTCPU="x64" \ ARCH="x64" \ diff --git a/recipes/debug/should-build.sh b/recipes/x64-debug/should-build.sh similarity index 79% rename from recipes/debug/should-build.sh rename to recipes/x64-debug/should-build.sh index 2453d49..0d40ee4 100755 --- a/recipes/debug/should-build.sh +++ b/recipes/x64-debug/should-build.sh @@ -7,4 +7,6 @@ fullversion=$2 decode "$fullversion" +assert_eq "$disttype" "release" + test "$major" -ge "18" From 3292f4e02dc12ec3b712a9a1b3aabca3aa8b8991 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Tue, 16 Jan 2024 22:28:11 -0500 Subject: [PATCH 4/9] docs: add to builds section of README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b93f60d..a6d7c6e 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,9 @@ This list of officially supported platforms is available in the Node.js [BUILDIN ## Builds + * **linux-x64-debug**: Linux x64 `Debug` binaries compiled with `--gdb --debug --debug-node` enabled so that they include debug symbols and make native module, and core node, debugging easier. Tarballs include `node` and `node_g` binaries in addition to all other standard files included in the official Node.js builds. Designed with Github workflow `actions/setup-node` in mind, so that it is easier to investigate CI segfaults. * **linux-x64-musl**: Linux x64 binaries compiled against [musl libc](https://www.musl-libc.org/) version 1.1.20. Primarily useful for users of Alpine Linux 3.9 and later. Linux x64 with musl is considered "Experimental" by Node.js but the Node.js test infrastructure includes some Alpine test servers so support is generally good. These Node.js builds require the `libstdc++` package to be installed on Alpine Linux, which is not installed by default. You can add this by running `apk add libstdc++`. -* **linux-x64-glibc-217**: Linux x64, compiled with glibc 2.17 to support [older Linux distros](https://en.wikipedia.org/wiki/Glibc#Version_history), QNAP QTS 4.x and 5.x, and Synology DSM 7, and other environments where a newer glibc is unavailable. + * **linux-x64-glibc-217**: Linux x64, compiled with glibc 2.17 to support [older Linux distros](https://en.wikipedia.org/wiki/Glibc#Version_history), QNAP QTS 4.x and 5.x, and Synology DSM 7, and other environments where a newer glibc is unavailable. * **linux-x86**: Linux x86 (32-bit) binaries compiled against libc 2.17, similar to the way the official [linux-x64 binaries are produced](https://github.com/nodejs/node/blob/main/BUILDING.md#official-binary-platforms-and-toolchains). 32-bit Linux binaries were dropped for Node.js 10 and 32-bit support is now considered "Experimental". * **linux-armv6l**: Linux ARMv6 binaries, cross-compiled on Ubuntu 16.04 with a [custom GCC 6 toolchain](https://github.com/rvagg/rpi-newer-crosstools) (for Node.js versions earlier than 16) or Ubuntu 18.04 with a [custom GCC 8 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) From d1525f8a6862392ef02a02268d5c7ef81d91097c Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Tue, 16 Jan 2024 23:00:02 -0500 Subject: [PATCH 5/9] fix: update x64-debug run.sh --- recipes/x64-debug/run.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/recipes/x64-debug/run.sh b/recipes/x64-debug/run.sh index 0732e26..392f105 100755 --- a/recipes/x64-debug/run.sh +++ b/recipes/x64-debug/run.sh @@ -23,7 +23,7 @@ export CXX="ccache g++" make -j$(getconf _NPROCESSORS_ONLN) binary V= \ DESTCPU="x64" \ ARCH="x64" \ - VARIATION="" \ + VARIATION="debug" \ DISTTYPE="$disttype" \ CUSTOMTAG="$customtag" \ DATESTRING="$datestring" \ @@ -31,4 +31,25 @@ make -j$(getconf _NPROCESSORS_ONLN) binary V= \ RELEASE_URLBASE="$release_urlbase" \ CONFIG_FLAGS="$config_flags" -mv node-*.tar.?z /out/ +# The default tarballs from the binary make target do not have the debug +# binary included so we need to rebuild them correctly. +for tarball in node-*.tar.?z; do + # Create a temporary directory and extract the tarball into it + temp_dir=$(mktemp -d) + tar -xf "$tarball" -C "$temp_dir" + + # Copy the debug build to a different name + cp out/Debug/node "$temp_dir/bin/node_g" + + # Recreate the tarball with the same comprbasession format + case $tarball in + *.tar.gz) + tar -czf "/out/$tarball" -C "$temp_dir" . + ;; + *.tar.xz) + tar -cJf "/out/$tarball" -C "$temp_dir" . + ;; + esac + + rm -rf "$temp_dir" +done From 2aacf0cd44e13490918773246b374e3b5b76dc41 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Wed, 17 Jan 2024 20:49:18 -0500 Subject: [PATCH 6/9] fix: remove release should build check --- recipes/x64-debug/should-build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/x64-debug/should-build.sh b/recipes/x64-debug/should-build.sh index 0d40ee4..2453d49 100755 --- a/recipes/x64-debug/should-build.sh +++ b/recipes/x64-debug/should-build.sh @@ -7,6 +7,4 @@ fullversion=$2 decode "$fullversion" -assert_eq "$disttype" "release" - test "$major" -ge "18" From 1338d26bd4b511249467c5a6d38bffab49273388 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Thu, 18 Jan 2024 00:58:23 -0500 Subject: [PATCH 7/9] fix: update re-tar process to overwrite node --- recipes/x64-debug/run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/x64-debug/run.sh b/recipes/x64-debug/run.sh index 392f105..f57ec0a 100755 --- a/recipes/x64-debug/run.sh +++ b/recipes/x64-debug/run.sh @@ -38,8 +38,10 @@ for tarball in node-*.tar.?z; do temp_dir=$(mktemp -d) tar -xf "$tarball" -C "$temp_dir" - # Copy the debug build to a different name - cp out/Debug/node "$temp_dir/bin/node_g" + # Replace Relase version with the Debug built version + tarball_name=$(echo "$tarball" | sed -e 's/\.tar\.[gx]z$//') + rm "$temp_dir/$tarball_name/bin/node" + cp out/Debug/node "$temp_dir/$tarball_name/bin/node" # Recreate the tarball with the same comprbasession format case $tarball in From c95b969b2b1ab0ad7a957e1f83892bf4cc840511 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Thu, 18 Jan 2024 01:02:30 -0500 Subject: [PATCH 8/9] docs: update README to reflect replacing node with debug --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a6d7c6e..a7eea0c 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This list of officially supported platforms is available in the Node.js [BUILDIN ## Builds - * **linux-x64-debug**: Linux x64 `Debug` binaries compiled with `--gdb --debug --debug-node` enabled so that they include debug symbols and make native module, and core node, debugging easier. Tarballs include `node` and `node_g` binaries in addition to all other standard files included in the official Node.js builds. Designed with Github workflow `actions/setup-node` in mind, so that it is easier to investigate CI segfaults. + * **linux-x64-debug**: Linux x64 `Debug` binaries compiled with `--gdb --debug --debug-node` enabled so that they include debug symbols and make native module, and core node, debugging easier. Tarballs replaces the Release `node` with a Debug built binary, in addition to all other standard files included in the official Node.js builds. Designed with Github workflow `actions/setup-node` in mind, so that it is easier to investigate CI segfaults. Is a direct swap for the regular binary and all node execution is the same as the Release build, except with debug symbols. * **linux-x64-musl**: Linux x64 binaries compiled against [musl libc](https://www.musl-libc.org/) version 1.1.20. Primarily useful for users of Alpine Linux 3.9 and later. Linux x64 with musl is considered "Experimental" by Node.js but the Node.js test infrastructure includes some Alpine test servers so support is generally good. These Node.js builds require the `libstdc++` package to be installed on Alpine Linux, which is not installed by default. You can add this by running `apk add libstdc++`. * **linux-x64-glibc-217**: Linux x64, compiled with glibc 2.17 to support [older Linux distros](https://en.wikipedia.org/wiki/Glibc#Version_history), QNAP QTS 4.x and 5.x, and Synology DSM 7, and other environments where a newer glibc is unavailable. * **linux-x86**: Linux x86 (32-bit) binaries compiled against libc 2.17, similar to the way the official [linux-x64 binaries are produced](https://github.com/nodejs/node/blob/main/BUILDING.md#official-binary-platforms-and-toolchains). 32-bit Linux binaries were dropped for Node.js 10 and 32-bit support is now considered "Experimental". From 1b964d032eb1969c0dd6e07ffc137a7271a3e388 Mon Sep 17 00:00:00 2001 From: matthewkeil Date: Thu, 18 Jan 2024 01:05:09 -0500 Subject: [PATCH 9/9] fix: typos --- README.md | 2 +- recipes/x64-debug/run.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7eea0c..51dbfd6 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This list of officially supported platforms is available in the Node.js [BUILDIN ## Builds - * **linux-x64-debug**: Linux x64 `Debug` binaries compiled with `--gdb --debug --debug-node` enabled so that they include debug symbols and make native module, and core node, debugging easier. Tarballs replaces the Release `node` with a Debug built binary, in addition to all other standard files included in the official Node.js builds. Designed with Github workflow `actions/setup-node` in mind, so that it is easier to investigate CI segfaults. Is a direct swap for the regular binary and all node execution is the same as the Release build, except with debug symbols. + * **linux-x64-debug**: Linux x64 `Debug` binaries compiled with `--gdb --debug --debug-node` enabled so that they include debug symbols to make native module, and core node, debugging easier. Tarballs replaces the Release `node` with a Debug built binary, in addition to all other standard files included in the official Node.js builds. Designed with Github workflow `actions/setup-node` in mind, so that it is easier to investigate CI segfaults. Is a direct swap for the regular binary and all node execution is the same as the Release build, except with debug symbols. * **linux-x64-musl**: Linux x64 binaries compiled against [musl libc](https://www.musl-libc.org/) version 1.1.20. Primarily useful for users of Alpine Linux 3.9 and later. Linux x64 with musl is considered "Experimental" by Node.js but the Node.js test infrastructure includes some Alpine test servers so support is generally good. These Node.js builds require the `libstdc++` package to be installed on Alpine Linux, which is not installed by default. You can add this by running `apk add libstdc++`. * **linux-x64-glibc-217**: Linux x64, compiled with glibc 2.17 to support [older Linux distros](https://en.wikipedia.org/wiki/Glibc#Version_history), QNAP QTS 4.x and 5.x, and Synology DSM 7, and other environments where a newer glibc is unavailable. * **linux-x86**: Linux x86 (32-bit) binaries compiled against libc 2.17, similar to the way the official [linux-x64 binaries are produced](https://github.com/nodejs/node/blob/main/BUILDING.md#official-binary-platforms-and-toolchains). 32-bit Linux binaries were dropped for Node.js 10 and 32-bit support is now considered "Experimental". diff --git a/recipes/x64-debug/run.sh b/recipes/x64-debug/run.sh index f57ec0a..81da8c9 100755 --- a/recipes/x64-debug/run.sh +++ b/recipes/x64-debug/run.sh @@ -43,7 +43,7 @@ for tarball in node-*.tar.?z; do rm "$temp_dir/$tarball_name/bin/node" cp out/Debug/node "$temp_dir/$tarball_name/bin/node" - # Recreate the tarball with the same comprbasession format + # Recreate the tarball with the same compression format case $tarball in *.tar.gz) tar -czf "/out/$tarball" -C "$temp_dir" .