MCPcopy Index your code
hub / github.com/nodejs/node / check_compiler

Function check_compiler

configure.py:1544–1642  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

1542# check involves checking the build number against an allowlist. I'm not
1543# quite prepared to go that far yet.
1544def check_compiler(o):
1545 o['variables']['use_ccache_win'] = 0
1546
1547 if sys.platform == 'win32':
1548 if options.clang_cl:
1549 o['variables']['clang'] = 1
1550 o['variables']['llvm_version'] = options.clang_cl
1551 else:
1552 o['variables']['clang'] = 0
1553 o['variables']['llvm_version'] = '0.0'
1554
1555 if options.use_ccache_win:
1556 o['variables']['use_ccache_win'] = 1
1557
1558 if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'):
1559 nasm_version = get_nasm_version('nasm')
1560 o['variables']['nasm_version'] = nasm_version
1561 if nasm_version == '0.0':
1562 o['variables']['openssl_no_asm'] = 1
1563 return
1564
1565 ok, is_clang, clang_version, gcc_version, is_apple = try_check_compiler(CXX, 'c++')
1566 o['variables']['clang'] = B(is_clang)
1567 version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
1568 print_verbose(f"Detected {'Apple ' if is_apple else ''}{'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
1569 if not ok:
1570 warn(f'failed to autodetect C++ compiler version (CXX={CXX})')
1571 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):
1572 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 ''}")
1573
1574 ok, is_clang, clang_version, gcc_version, is_apple = try_check_compiler(CC, 'c')
1575 version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
1576 print_verbose(f"Detected {'Apple ' if is_apple else ''}{'clang ' if is_clang else ''}C compiler (CC={CC}) version: {version_str}")
1577 if not ok:
1578 warn(f'failed to autodetect C compiler version (CC={CC})')
1579 elif not is_clang and gcc_version < (4, 2, 0):
1580 # clang 3.2 is a little white lie because any clang version will probably
1581 # do for the C bits. However, we might as well encourage people to upgrade
1582 # to a version that is not completely ancient.
1583 warn(f'C compiler (CC={CC}, {version_str}) too old, need gcc 4.2 or clang 3.2')
1584
1585 o['variables']['llvm_version'] = get_llvm_version(CC) if is_clang else '0.0'
1586
1587 # cargo and rustc are needed for Temporal.
1588 if not options.v8_disable_temporal_support and not options.shared_temporal_capi:
1589 # Minimum cargo and rustc versions should match values in BUILDING.md.
1590 min_cargo_ver_tuple = (1, 82)
1591 min_rustc_ver_tuple = (1, 82)
1592 cargo = os.environ.get('CARGO', 'cargo')
1593 cargo_ver = get_cargo_version(cargo)
1594 print_verbose(f'Detected cargo (CARGO={cargo}): {cargo_ver}')
1595 if cargo_ver == '0.0':
1596 # Error if --v8-enable-temporal-support is explicitly set,
1597 # otherwise disable support for Temporal.
1598 if options.v8_enable_temporal_support:
1599 error(''&#x27;No acceptable cargo found!
1600
1601 Enabling Temporal support requires cargo.

Callers 1

configure.pyFile · 0.85

Calls 15

get_nasm_versionFunction · 0.85
try_check_compilerFunction · 0.85
print_verboseFunction · 0.85
get_llvm_versionFunction · 0.85
get_cargo_versionFunction · 0.85
get_rustc_versionFunction · 0.85
get_xcode_versionFunction · 0.85
get_gas_versionFunction · 0.85
BFunction · 0.70
warnFunction · 0.70
errorFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…