Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix compiler version detection #24879

Closed
wants to merge 2 commits into from
Closed
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
9 changes: 5 additions & 4 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ def try_check_compiler(cc, lang):

values = (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 @@ -753,6 +753,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 @@ -921,8 +923,7 @@ 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])
compiler_version_num = tuple(map(int, compiler_version))
if is_clang or compiler_version_num < version_checked:
if is_clang or compiler_version < version_checked:
return False
return True

Expand Down