Bug 1533149 - add checking messages for libstdcxx_version; r=glandium
authorNathan Froyd <froydnj@gmail.com>
Sun, 10 Mar 2019 00:11:09 +0000
changeset 521272 63bd1994e17c
parent 521271 199af6c43953
child 521273 e6a4cd115b45
child 521274 5f7ea2187fa6
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1533149
milestone67.0a1
first release with
nightly linux32
63bd1994e17c / 67.0a1 / 20190310095404 / files
nightly linux64
63bd1994e17c / 67.0a1 / 20190310095404 / files
nightly mac
63bd1994e17c / 67.0a1 / 20190310095404 / files
nightly win32
63bd1994e17c / 67.0a1 / 20190310095404 / files
nightly win64
63bd1994e17c / 67.0a1 / 20190310095404 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1533149 - add checking messages for libstdcxx_version; r=glandium It's occasionally useful to know what versions are being discovered for these variables. It's also convenient for logs from automation to contain all the relevant information, rather than setting up a loaner and running all the commands yourself. Differential Revision: https://phabricator.services.mozilla.com/D22385
build/moz.configure/toolchain.configure
python/mozbuild/mozbuild/configure/libstdcxx.py
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -2168,26 +2168,34 @@ add_old_configure_assignment('ENABLE_MOZ
 #
 js_option('--enable-stdcxx-compat', env='MOZ_STDCXX_COMPAT',
           help='Enable compatibility with older libstdc++')
 
 
 @template
 def libstdcxx_version(var, compiler, host_or_target):
     @depends(compiler, host_or_target, when='--enable-stdcxx-compat')
+    @checking(var, lambda v: v and "GLIBCXX_%s" % v.dotted)
     @imports(_from='mozbuild.configure.libstdcxx', _import='find_version')
+    @imports(_from='__builtin__', _import='Exception')
     def version(compiler, host_or_target):
-        if host_or_target.os == 'Android':
+        if host_or_target.os == 'Android' or host_or_target.kernel == 'Darwin':
             return None
-        result = find_version(
-            compiler.wrapper + [compiler.compiler] + compiler.flags)
+        try:
+            result = find_version(
+                compiler.wrapper + [compiler.compiler] + compiler.flags)
+        except Exception:
+            die("Couldn't determine libstdc++ version")
         if result:
-            return str(result)
-
-    set_config(var, version)
+            return namespace(
+                dotted=result[0],
+                encoded=str(result[1]),
+            )
+
+    set_config(var, version.encoded)
     return version
 
 
 add_gcc_flag(
     '-D_GLIBCXX_USE_CXX11_ABI=0', cxx_compiler,
     when=libstdcxx_version(
         'MOZ_LIBSTDCXX_TARGET_VERSION', cxx_compiler, target))
 add_gcc_flag(
--- a/python/mozbuild/mozbuild/configure/libstdcxx.py
+++ b/python/mozbuild/mozbuild/configure/libstdcxx.py
@@ -59,31 +59,32 @@ def find_version(args):
     """Given a base command line for a compiler, find the version of the
     libstdc++ it uses.
     """
     args +=  ['-shared', '-Wl,-t']
     p = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
     candidates = [x for x in p.stdout if 'libstdc++.so' in x]
     candidates = [x for x in candidates if 'skipping incompatible' not in x]
     if not candidates:
-        return ''
+        raise Exception('''Couldn't find libstdc++ candidates!
+command line: %s''' % args)
     if len(candidates) != 1:
         raise Exception('''Too many libstdc++ candidates!
 command line: %s
 candidates:
 %s''' % (args, '\n'.join(candidates)))
 
     libstdcxx = parse_ld_line(candidates[-1])
 
     p = subprocess.Popen(['readelf', '-V', libstdcxx], stdout=subprocess.PIPE)
     versions = [parse_readelf_line(x)
                 for x in p.stdout.readlines() if 'Name: GLIBCXX' in x]
     last_version = sorted(versions, cmp = cmp_ver)[-1]
-    return encode_ver(last_version)
+    return (last_version, encode_ver(last_version))
 
 if __name__ == '__main__':
     """Given the value of environment variable CXX or HOST_CXX, find the
     version of the libstdc++ it uses.
     """
     cxx_env = os.environ['CXX']
-    print('MOZ_LIBSTDCXX_TARGET_VERSION=%s' % find_version(cxx_env.split()))
+    print('MOZ_LIBSTDCXX_TARGET_VERSION=%s' % find_version(cxx_env.split())[1])
     host_cxx_env = os.environ.get('HOST_CXX', cxx_env)
-    print('MOZ_LIBSTDCXX_HOST_VERSION=%s' % find_version(host_cxx_env.split()))
+    print('MOZ_LIBSTDCXX_HOST_VERSION=%s' % find_version(host_cxx_env.split())[1])