Bug 1363655 - part 2 - check for existence of paths returned by llvm-config; r=rillian
authorNathan Froyd <froydnj@mozilla.com>
Wed, 21 Jun 2017 13:28:37 -0400
changeset 414064 5d8ef49108c1e2facf0b91799c1fb7caf909e628
parent 414063 af0dd402ca5b216d0946dd918594852ab6b7e1f7
child 414065 ae3346e96d470444ff6dbb28891227f632c5ad71
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1363655
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1363655 - part 2 - check for existence of paths returned by llvm-config; r=rillian On some systems, llvm-config may be installed, but not the files to which it needs to refer. We should ensure that the values returned actually make some sense.
toolkit/moz.configure
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -700,21 +700,41 @@ def bindgen_config_paths(stylo_config, b
 
     if not libclang_path and not clang_path:
         # We must have LLVM_CONFIG in this case.
         if not llvm_config:
             return None
 
         check_minimum_llvm_config_version(llvm_config)
         libclang_arg = '--bindir' if host.os == 'WINNT' else '--libdir'
+        libclang_path = invoke_llvm_config(llvm_config, libclang_arg)
         clang_path = os.path.join(invoke_llvm_config(llvm_config, '--bindir'),
                                   'clang')
+        libclang_path = normsep(libclang_path)
+        clang_path = normsep(clang_path)
+
+        # Debian-based distros, at least, can have llvm-config installed
+        # but not have other packages installed.  Since the user is trying
+        # to use their system packages, we can't be more specific about what
+        # they need.
+        if not os.path.exists(libclang_path)
+            die(dedent('''\
+            The directory {} returned by `llvm-config {}` does not exist.
+            Please check your system configuration.
+            '''.format(libclang_path, libclang_arg)))
+
+        if not os.path.exists(clang_path):
+            die(dedent('''\
+            The file {} returned by `llvm-config {}` does not exist.
+            Please check your system configuration.
+            '''.format(clang_path, '--bindir')))
+
         return namespace(
-            libclang_path=normsep(invoke_llvm_config(llvm_config, libclang_arg)),
-            clang_path=normsep(clang_path),
+            libclang_path=libclang_path,
+            clang_path=clang_path,
         )
 
     if (not libclang_path and clang_path) or \
        (libclang_path and not clang_path):
         die(dedent('''\
         You must provide both of --with-libclang-path and --with-clang-path
         or neither of them.'''))