Skip to content

Commit

Permalink
build: fix compiler version detection
Browse files Browse the repository at this point in the history
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 <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
(cherry picked from commit c3dd0d0)
  • Loading branch information
richardlau authored and BaochengSu committed Sep 28, 2020
1 parent 483f8d4 commit 0b3ba49
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ def try_check_compiler(cc, lang):

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

return (True, is_clang, clang_version, gcc_version)

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

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


def gcc_version_ge(version_checked):
for compiler in [(CC, 'c'), (CXX, 'c++')]:
ok, is_clang, clang_version, compiler_version = \
try_check_compiler(compiler[0], compiler[1])
if is_clang or compiler_version < version_checked:
return False
return True


def configure_node(o):
if options.dest_os == 'android':
o['variables']['OS'] = 'android'
Expand Down

0 comments on commit 0b3ba49

Please sign in to comment.