зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1604616 - check for a new enough libstdc++; r=glandium
After a C++ language version bump, It's possible to wind up in situations where we are using a new enough compiler version, but the libstdc++ version in use is not new enough to support new language features: self-compiled clang with system libraries, clang from `mach bootstrap` prior to C++ language version bump (and thus including a new libstdc++ with the boostrapped clang), etc. Previously, such a situation would mean that things would work fine, and then start breaking as soon as new library features started to be used. Let's try to catch the problem earlier, when the update happens, by verifying that the libstdc++ version is at least as new as the GCC version we're requiring. Differential Revision: https://phabricator.services.mozilla.com/D57516 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0a0a18f3e0
Коммит
4bb0df12f2
|
@ -886,6 +886,10 @@ def prepare_flags(host_or_target, macos_sdk):
|
|||
return []
|
||||
|
||||
|
||||
def minimum_gcc_version():
|
||||
return Version('7.1.0')
|
||||
|
||||
|
||||
@template
|
||||
def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
|
||||
other_c_compiler=None):
|
||||
|
@ -1012,10 +1016,11 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
|
|||
if host_or_target.os == 'Android':
|
||||
raise FatalCheckError('GCC is not supported on Android.\n'
|
||||
'Please use clang from the Android NDK instead.')
|
||||
if info.version < '7.1.0':
|
||||
gcc_version = minimum_gcc_version()
|
||||
if info.version < gcc_version:
|
||||
raise FatalCheckError(
|
||||
'Only GCC 7.1 or newer is supported (found version %s).'
|
||||
% info.version)
|
||||
'Only GCC %d.%d or newer is supported (found version %s).'
|
||||
% (gcc_version.major, gcc_version.minor, info.version))
|
||||
|
||||
if info.type == 'clang-cl':
|
||||
if info.version < '8.0.0':
|
||||
|
@ -1213,6 +1218,45 @@ def check_have_64_bit(have_64_bit, compiler_have_64_bit):
|
|||
'about the target bitness.')
|
||||
|
||||
|
||||
@depends(cxx_compiler, target)
|
||||
def needs_libstdcxx_newness_check(cxx_compiler, target):
|
||||
# We only have to care about this on Linux and MinGW.
|
||||
if cxx_compiler.type == 'clang-cl':
|
||||
return
|
||||
|
||||
if target.kernel not in ('Linux', 'WINNT'):
|
||||
return
|
||||
|
||||
if target.os == 'Android':
|
||||
return
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def die_on_old_libstdcxx():
|
||||
die('The libstdc++ in use is not new enough. Please run '
|
||||
'./mach bootstrap to update your compiler, or update your system '
|
||||
'libstdc++ installation.')
|
||||
|
||||
try_compile(includes=['cstddef'],
|
||||
body='\n'.join([
|
||||
# _GLIBCXX_RELEASE showed up in libstdc++ 7.
|
||||
'#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)',
|
||||
'# error libstdc++ not new enough',
|
||||
'#endif',
|
||||
'#if defined(_GLIBCXX_RELEASE)',
|
||||
'# if _GLIBCXX_RELEASE < %d' % minimum_gcc_version().major,
|
||||
'# error libstdc++ not new enough',
|
||||
'# else',
|
||||
' (void) 0',
|
||||
'# endif',
|
||||
'#endif',
|
||||
]),
|
||||
check_msg='for new enough STL headers from libstdc++',
|
||||
when=needs_libstdcxx_newness_check,
|
||||
onerror=die_on_old_libstdcxx)
|
||||
|
||||
|
||||
@depends(c_compiler, target)
|
||||
def default_debug_flags(compiler_info, target):
|
||||
# Debug info is ON by default.
|
||||
|
|
Загрузка…
Ссылка в новой задаче