diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index e625ceac6b79b7..3f215cc06395d9 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -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 }} - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: @@ -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 - name: Upload tarball artifact uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index e227877f38a007..4349d906d45a98 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -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: diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 410a92489c8dfd..14cb92ef87e472 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -104,6 +104,7 @@ concurrency: env: FLAKY_TESTS: keep_retrying + CLANG_VERSION: '19' permissions: contents: read @@ -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 }} + - name: Make tarball if: ${{ github.event_name != 'workflow_dispatch' }} run: | @@ -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 - name: Upload tarball artifact if: ${{ github.event_name != 'workflow_dispatch' }} diff --git a/BUILDING.md b/BUILDING.md index ce0994377f5427..43ced2df2ee74e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -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) | @@ -238,7 +238,7 @@ 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. @@ -246,11 +246,11 @@ Consult previous versions of this document for older versions of Node.js: 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`. @@ -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 ``` diff --git a/configure.py b/configure.py index 6182537bfa40fe..9162ae3a1643f3 100755 --- a/configure.py +++ b/configure.py @@ -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') @@ -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))