Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/build-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ jobs:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Clang ${{ env.CLANG_VERSION }}
uses: ./.github/actions/install-clang
with:
clang-version: ${{ env.CLANG_VERSION }}
Comment on lines +80 to +83
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job only packs the tarball, the actual compilation already uses clang

Suggested change
- name: Install Clang ${{ env.CLANG_VERSION }}
uses: ./.github/actions/install-clang
with:
clang-version: ${{ env.CLANG_VERSION }}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If clang is not installed, the new default in configure.py makes it fail. See https://github.com/nodejs/node/actions/runs/23843452764/job/69504716314?pr=62533

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a flag to disable that check:

diff --git a/configure.py b/configure.py
index 6182537bfa..49a99767a9 100755
--- a/configure.py
+++ b/configure.py
@@ -2607,7 +2607,8 @@ configurations = {
 }
 
 # Print a warning when the compiler is too old.
-check_compiler(output)
+if not os.environ['SKIP_COMPILER_CHECK']:
+  check_compiler(output)
 
 # determine the "flavor" (operating system) we're building for,
 # leveraging gyp's GetFlavor function

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
Expand All @@ -90,6 +94,9 @@ jobs:
export DATESTRING=$(date "+%Y-%m-%d")
export COMMIT=$(git rev-parse --short=10 "$GITHUB_SHA")
./configure && make tar -j4 SKIP_XZ=1
env:
CC: clang-19
CXX: clang++-19
Comment on lines +97 to +99
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env:
CC: clang-19
CXX: clang++-19

- name: Upload tarball artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ jobs:
fail-fast: false
runs-on: macos-15
env:
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} gcc
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} g++
CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang
CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++
SCCACHE_GHA_ENABLED: ${{ github.base_ref == 'main' || github.ref_name == 'main' }}
SCCACHE_IDLE_TIMEOUT: '0'
steps:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ concurrency:

env:
FLAKY_TESTS: keep_retrying
CLANG_VERSION: '19'

permissions:
contents: read
Expand All @@ -119,6 +120,11 @@ jobs:
with:
persist-credentials: false

- name: Install Clang ${{ env.CLANG_VERSION }}
uses: ./.github/actions/install-clang
with:
clang-version: ${{ env.CLANG_VERSION }}

Comment on lines +123 to +127
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Install Clang ${{ env.CLANG_VERSION }}
uses: ./.github/actions/install-clang
with:
clang-version: ${{ env.CLANG_VERSION }}

- name: Make tarball
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
Expand All @@ -127,6 +133,8 @@ jobs:
./configure && make tar -j4 SKIP_XZ=1 SKIP_SHARED_DEPS=1
env:
DISTTYPE: nightly
CC: clang-19
CXX: clang++-19
Comment on lines +136 to +137
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CC: clang-19
CXX: clang++-19


- name: Upload tarball artifact
if: ${{ github.event_name != 'workflow_dispatch' }}
Expand Down
18 changes: 9 additions & 9 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Depending on the host platform, the selection of toolchains may vary.

| Operating System | Compiler Versions |
| ---------------- | ------------------------------------------------------------------- |
| Linux | GCC >= 12.2 or Clang >= 19.1 |
| Linux | Clang >= 19.1 or GCC >= 13.2 (experimental) |
| Windows | Visual Studio 2022 or 2026 with the Windows 11 SDK on a 64-bit host |
| macOS | Xcode >= 16.4 (Apple LLVM >= 19) |

Expand Down Expand Up @@ -238,19 +238,19 @@ Consult previous versions of this document for older versions of Node.js:

#### Unix prerequisites

* `gcc` and `g++` >= 12.2 or `clang` and `clang++` >= 19.1
* `clang` and `clang++` >= 19.1 or `gcc` and `g++` >= 13.2 (experimental)
* GNU Make 3.81 or newer
* [A supported version of Python][Python versions]
* For test coverage, your Python installation must include pip.

Installation via Linux package manager can be achieved with:

* Nix, NixOS: `nix-shell`
* Ubuntu, Debian: `sudo apt-get install python3 g++-12 gcc-12 make python3-pip`
* Fedora: `sudo dnf install python3 gcc-c++ make python3-pip`
* CentOS and RHEL: `sudo yum install python3 gcc-c++ make python3-pip`
* OpenSUSE: `sudo zypper install python3 gcc-c++ make python3-pip`
* Arch Linux, Manjaro: `sudo pacman -S python gcc make python-pip`
* Ubuntu, Debian: `sudo apt-get install python3 clang-19 make python3-pip`
* Fedora: `sudo dnf install python3 clang make python3-pip`
* CentOS and RHEL: `sudo yum install python3 clang make python3-pip`
* OpenSUSE: `sudo zypper install python3 clang make python3-pip`
* Arch Linux, Manjaro: `sudo pacman -S python clang make python-pip`

FreeBSD and OpenBSD users may also need to install `libexecinfo`.

Expand Down Expand Up @@ -660,8 +660,8 @@ need to install the latest version but not the apt version.

```bash
sudo apt install ccache mold # for Debian/Ubuntu, included in most Linux distros
export CC="ccache gcc" # add to your .profile
export CXX="ccache g++" # add to your .profile
export CC="ccache clang" # add to your .profile
export CXX="ccache clang++" # add to your .profile
export LDFLAGS="-fuse-ld=mold" # add to your .profile
```

Expand Down
10 changes: 4 additions & 6 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@

original_argv = sys.argv[1:]

# gcc and g++ as defaults matches what GYP's Makefile generator does,
# except on macOS and Windows.
CC = os.environ.get('CC', 'cc' if sys.platform == 'darwin' else 'clang' if sys.platform == 'win32' else 'gcc')
CXX = os.environ.get('CXX', 'c++' if sys.platform == 'darwin' else 'clang' if sys.platform == 'win32' else 'g++')
CC = os.environ.get('CC', 'clang')
CXX = os.environ.get('CXX', 'clang' if sys.platform == 'win32' else 'clang++')

tools_path = Path('tools')

Expand Down Expand Up @@ -1521,8 +1519,8 @@ def check_compiler(o):
print_verbose(f"Detected {'Apple ' if is_apple else ''}{'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
if not ok:
warn(f'failed to autodetect C++ compiler version (CXX={CXX})')
elif ((is_apple and clang_version < (17, 0, 0)) or (not is_apple and clang_version < (19, 1, 0))) if is_clang else gcc_version < (12, 2, 0):
warn(f"C++ compiler (CXX={CXX}, {version_str}) too old, need g++ 12.2.0 or clang++ 19.1.0{' or Apple clang++ 17.0.0' if is_apple else ''}")
elif ((is_apple and clang_version < (17, 0, 0)) or (not is_apple and clang_version < (19, 1, 0))) if is_clang else gcc_version < (13, 2, 0):
warn(f"C++ compiler (CXX={CXX}, {version_str}) too old, need g++ 13.2.0 or clang++ 19.1.0{' or Apple clang++ 17.0.0' if is_apple else ''}")

ok, is_clang, clang_version, gcc_version, is_apple = try_check_compiler(CC, 'c')
version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
Expand Down
Loading