Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add x64-debug build recipe #107

Closed
wants to merge 9 commits into from
Closed
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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-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)
Expand Down
1 change: 1 addition & 0 deletions bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ recipes=" \
x86 \
musl \
armv6l \
x64-debug \
x64-glibc-217 \
x64-pointer-compression \
x64-usdt \
Expand Down
33 changes: 33 additions & 0 deletions recipes/x64-debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
57 changes: 57 additions & 0 deletions recipes/x64-debug/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/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="--gdb --debug --debug-node"

cd /home/node

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

export CC="ccache gcc"
export CXX="ccache g++"

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

# 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"

# 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 compression 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
10 changes: 10 additions & 0 deletions recipes/x64-debug/should-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -xe

__dirname=$1
fullversion=$2

. ${__dirname}/_decode_version.sh

decode "$fullversion"

test "$major" -ge "18"