Skip to content

Commit 0b3ba49

Browse files
richardlauBaochengSu
authored andcommitted
build: fix compiler version detection
Compiler version tuples should be numeric for tuple comparisons to work. Also correct check for AIX where the minimum supported GCC is 6.3.0 PR-URL: nodejs#24879 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> (cherry picked from commit c3dd0d0)
1 parent 483f8d4 commit 0b3ba49

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

configure.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ def try_check_compiler(cc, lang):
584584

585585
values = (to_utf8(proc.communicate()[0]).split() + ['0'] * 7)[0:7]
586586
is_clang = values[0] == '1'
587-
gcc_version = tuple(values[1:1+3])
588-
clang_version = tuple(values[4:4+3])
587+
gcc_version = tuple(map(int, values[1:1+3]))
588+
clang_version = tuple(map(int, values[4:4+3])) if is_clang else None
589589

590590
return (True, is_clang, clang_version, gcc_version)
591591

@@ -659,6 +659,8 @@ def check_compiler(o):
659659
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
660660
if not ok:
661661
warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX)
662+
elif sys.platform.startswith('aix') and gcc_version < (6, 3, 0):
663+
warn('C++ compiler too old, need g++ 6.3.0 (CXX=%s)' % CXX)
662664
elif clang_version < (3, 4, 2) if is_clang else gcc_version < (4, 9, 4):
663665
warn('C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=%s)' % CXX)
664666

@@ -823,6 +825,15 @@ def configure_mips(o):
823825
o['variables']['mips_fpu_mode'] = options.mips_fpu_mode
824826

825827

828+
def gcc_version_ge(version_checked):
829+
for compiler in [(CC, 'c'), (CXX, 'c++')]:
830+
ok, is_clang, clang_version, compiler_version = \
831+
try_check_compiler(compiler[0], compiler[1])
832+
if is_clang or compiler_version < version_checked:
833+
return False
834+
return True
835+
836+
826837
def configure_node(o):
827838
if options.dest_os == 'android':
828839
o['variables']['OS'] = 'android'

0 commit comments

Comments
 (0)