Link LLDB only against libclang and libLLVM .a files to fix macOS build
authorTodd Fiala <todd.fiala@gmail.com>
Fri, 12 Aug 2016 17:01:19 +0000 (17:01 +0000)
committerTodd Fiala <todd.fiala@gmail.com>
Fri, 12 Aug 2016 17:01:19 +0000 (17:01 +0000)
The Xcode macOS build of LLDB is currently broken after
https://reviews.llvm.org/D23232 landed, see
http://lab.llvm.org:8080/green/job/lldb_build_test/20014/console,
because we’re trying to link against all .a files found in the
llvm-build/lib directory. Let’s be more specific in what we link
against. This patch applies a regexp to only use “libclang.*”,
“libLLVM.*” and not “libclang_rt.*” static archives.

Change by Kuba Mracek (formerly Kuba Brecka)

See review here:
https://reviews.llvm.org/D23444

Reviewers: tfiala, compnerd
llvm-svn: 278527

lldb/scripts/Xcode/build-llvm.py

index b594a8c..e8d1b63 100755 (executable)
@@ -5,6 +5,7 @@ import hashlib
 import fnmatch
 import os
 import platform
+import re
 import subprocess
 import sys
 
@@ -132,7 +133,9 @@ def CMAKE_ENVIRONMENT ():
 
 def collect_archives_in_path (path): 
     files = os.listdir(path)
-    return [os.path.join(path, file) for file in files if file.endswith(".a")]
+    # Only use libclang and libLLVM archives, and exclude libclang_rt
+    regexp = "^lib(clang[^_]|LLVM).*$"
+    return [os.path.join(path, file) for file in files if file.endswith(".a") and re.match(regexp, file)]
 
 def archive_list ():
     paths = library_paths()