[Lldb-commits] [lldb] c9f251a - [lldb/build.py] Always pass an SDK to the compiler on Darwin

Fred Riss via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 1 20:30:49 PDT 2020


Author: Fred Riss
Date: 2020-07-01T20:27:38-07:00
New Revision: c9f251aa6f6221a45d926bc12bd25d1833e5d945

URL: https://github.com/llvm/llvm-project/commit/c9f251aa6f6221a45d926bc12bd25d1833e5d945
DIFF: https://github.com/llvm/llvm-project/commit/c9f251aa6f6221a45d926bc12bd25d1833e5d945.diff

LOG: [lldb/build.py] Always pass an SDK to the compiler on Darwin

On macOS 11, system libraries which are part of the shared cache
are not present on the filesystem anymore. This causes issues
with build.py, because it fails to link binaries with libSystem
or libc++.

The real issue is that build.py was not passing an SDK to the
compiler. The script accepts an argument for the SDK, but it
is currently unused. This patch just threads the SDK through
to the compile and link steps and this fixes a bunch of Shell
test failures on very recent macOS builds.

Added: 
    

Modified: 
    lldb/test/Shell/helper/build.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/Shell/helper/build.py b/lldb/test/Shell/helper/build.py
index d2cb52f00e55..3de2f3350318 100755
--- a/lldb/test/Shell/helper/build.py
+++ b/lldb/test/Shell/helper/build.py
@@ -623,6 +623,9 @@ def output_files(self):
 class GccBuilder(Builder):
     def __init__(self, toolchain_type, args):
         Builder.__init__(self, toolchain_type, args, '.o')
+        if sys.platform == 'darwin':
+            cmd = ['xcrun', '--sdk', args.apple_sdk, '--show-sdk-path']
+            self.apple_sdk = subprocess.check_output(cmd).strip().decode('utf-8')
 
     def _get_compilation_command(self, source, obj):
         args = []
@@ -645,6 +648,9 @@ def _get_compilation_command(self, source, obj):
         args.extend(['-o', obj])
         args.append(source)
 
+        if sys.platform == 'darwin':
+            args.extend(['-isysroot', self.apple_sdk])
+
         return ('compiling', [source], obj, None, args)
 
     def _get_link_command(self):
@@ -664,6 +670,9 @@ def _get_link_command(self):
         args.extend(['-o', self._exe_file_name()])
         args.extend(self._obj_file_names())
 
+        if sys.platform == 'darwin':
+            args.extend(['-isysroot', self.apple_sdk])
+
         return ('linking', self._obj_file_names(), self._exe_file_name(), None, args)
 
 


        


More information about the lldb-commits mailing list