--- build/toolchain/apple/filter_libtool.py.orig 2025-10-27 10:10:06.000000000 +0800 +++ build/toolchain/apple/filter_libtool.py 2025-11-04 03:08:03.000000000 +0800 @@ -8,7 +8,7 @@ import subprocess import sys -# This script executes libool and filters out logspam lines like: +# This script executes libtool and filters out logspam lines like: # '/path/to/libtool: file: foo.o has no symbols' SUPPRESSED_PATTERNS = [ @@ -37,7 +37,39 @@ return False +def ExpandResponseFiles(args): + """Expands @file arguments to their contents. + + Apple's libtool doesn't support response files, so we need to expand them + manually before calling libtool. + """ + expanded_args = [] + for arg in args: + if arg.startswith('@'): + # This is a response file - read and expand it + rsp_file = arg[1:] # Remove the '@' prefix + try: + with open(rsp_file, 'r') as f: + # Response files can have arguments separated by spaces or newlines + content = f.read() + # Split on whitespace and filter out empty strings + file_list = content.split() + expanded_args.extend(file_list) + except IOError as e: + # If we can't read the file, pass the original argument through + # and let libtool report the error + print(f"Warning: Could not read response file {rsp_file}: {e}", + file=sys.stderr) + expanded_args.append(arg) + else: + expanded_args.append(arg) + return expanded_args + + def Main(cmd_list): + # Expand any response files in the arguments + cmd_list = ExpandResponseFiles(cmd_list) + env = os.environ.copy() libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) _, err = libtoolout.communicate()