Skip to content
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
10 changes: 4 additions & 6 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Depending on the host platform, the selection of toolchains may vary.
| ---------------- | -------------------------------------------------------------- |
| Linux | GCC >= 12.2 |
| Windows | Visual Studio >= 2022 with the Windows 10 SDK on a 64-bit host |
| macOS | Xcode >= 16.1 (Apple LLVM >= 17) |
| macOS | Xcode >= 16.3 (Apple LLVM >= 19) |

### Official binary platforms and toolchains

Expand Down Expand Up @@ -249,7 +249,7 @@ FreeBSD and OpenBSD users may also need to install `libexecinfo`.

#### macOS prerequisites

* Xcode Command Line Tools >= 13 for macOS
* Xcode Command Line Tools >= 16.3 for macOS
* [A supported version of Python][Python versions]
* For test coverage, your Python installation must include pip.

Expand Down Expand Up @@ -637,7 +637,7 @@ Refs:
* The current [version of Python][Python versions] from the
[Microsoft Store](https://apps.microsoft.com/store/search?publisher=Python+Software+Foundation)
* The "Desktop development with C++" workload from
[Visual Studio 2022 (17.6 or newer)](https://visualstudio.microsoft.com/downloads/)
[Visual Studio 2022 (17.13 or newer)](https://visualstudio.microsoft.com/downloads/)
or the "C++ build tools" workload from the
[Build Tools](https://aka.ms/vs/17/release/vs_buildtools.exe),
with the default optional components. Starting with Node.js v24, ClangCL is required to compile
Expand All @@ -659,9 +659,7 @@ Optional requirements to build the MSI installer package:

Optional requirements for compiling for Windows on ARM (ARM64):

* Visual Studio 17.6.0 or newer
> **Note:** There is [a bug](https://github.com/nodejs/build/issues/3739) in `17.10.x`
> preventing Node.js from compiling.
* Visual Studio 17.13.0 or newer
* Visual Studio optional components
* Visual C++ compilers and libraries for ARM64
* Visual C++ ATL for ARM64
Expand Down
26 changes: 14 additions & 12 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,18 +1117,20 @@ def try_check_compiler(cc, lang):

with proc:
proc.stdin.write(b'__clang__ __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ '
b'__clang_major__ __clang_minor__ __clang_patchlevel__')
b'__clang_major__ __clang_minor__ __clang_patchlevel__ '
b'__APPLE__')

if sys.platform == 'zos':
values = (to_utf8(proc.communicate()[0]).split('\n')[-2].split() + ['0'] * 7)[0:7]
values = (to_utf8(proc.communicate()[0]).split('\n')[-2].split() + ['0'] * 7)[0:8]
else:
values = (to_utf8(proc.communicate()[0]).split() + ['0'] * 7)[0:7]
values = (to_utf8(proc.communicate()[0]).split() + ['0'] * 7)[0:8]

is_clang = values[0] == '1'
gcc_version = tuple(map(int, values[1:1+3]))
clang_version = tuple(map(int, values[4:4+3])) if is_clang else None
is_apple = values[7] == '1'

return (True, is_clang, clang_version, gcc_version)
return (True, is_clang, clang_version, gcc_version, is_apple)


#
Expand Down Expand Up @@ -1289,18 +1291,18 @@ def check_compiler(o):
o['variables']['openssl_no_asm'] = 1
return

ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
ok, is_clang, clang_version, gcc_version, is_apple = try_check_compiler(CXX, 'c++')
o['variables']['clang'] = B(is_clang)
version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
print_verbose(f"Detected {'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
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 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')
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, clang++ 19.1.0, or Apple clang++ 17.0.0')
Copy link
Member

@richardlau richardlau Aug 6, 2025

Choose a reason for hiding this comment

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

Non-blocking observation -- would it be potentially confusing to mention Apple clang if, for example, you get this warning message on something other than macOS (e.g Linux)?

Copy link
Member Author

Choose a reason for hiding this comment

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


ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c')
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))
print_verbose(f"Detected {'clang ' if is_clang else ''}C compiler (CC={CC}) version: {version_str}")
print_verbose(f"Detected {'Apple ' if is_apple else ''}{'clang ' if is_clang else ''}C compiler (CC={CC}) version: {version_str}")
if not ok:
warn(f'failed to autodetect C compiler version (CC={CC})')
elif not is_clang and gcc_version < (4, 2, 0):
Expand Down Expand Up @@ -1478,7 +1480,7 @@ def configure_zos(o):

def clang_version_ge(version_checked):
for compiler in [(CC, 'c'), (CXX, 'c++')]:
_, is_clang, clang_version, _1 = (
_, is_clang, clang_version, _1, _2 = (
try_check_compiler(compiler[0], compiler[1])
)
if is_clang and clang_version >= version_checked:
Expand All @@ -1487,7 +1489,7 @@ def clang_version_ge(version_checked):

def gcc_version_ge(version_checked):
for compiler in [(CC, 'c'), (CXX, 'c++')]:
_, is_clang, _1, gcc_version = (
_, is_clang, _1, gcc_version, _2 = (
try_check_compiler(compiler[0], compiler[1])
)
if is_clang or gcc_version < version_checked:
Expand Down
Loading