Skip to content

Commit

Permalink
fix: adding macOS symbol lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Mar 20, 2024
1 parent ccb5841 commit f426c9c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions dev/archery/archery/linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,23 @@ def find_library_paths(self, libraries):
result = _ldconfig.run('-p', stdout=subprocess.PIPE)
lines = result.stdout.decode('utf-8').splitlines()
paths = {}
system = platform.system()
for lib in libraries:
paths[lib] = []
for line in lines:
if lib in line:
match = re.search(r' => (.*)', line)
if system == 'Linux':
for line in lines:
if lib in line:
match = re.search(r' => (.*)', line)
if match:
paths[lib].append(match.group(1))
elif system == 'Darwin':
result = _otool.run("-L", lib, stdout=subprocess.PIPE)
for line in lines[1:]:
match = re.search(r'\s*(\S*)', line)
if match:
paths[lib].append(match.group(1))
else:
raise ValueError(f"{platform} is not supported")
return paths


Expand All @@ -112,6 +122,7 @@ def check_dynamic_library_dependencies(path, allowed, disallowed):
)
# Check for undefined symbols
undefined_symbols = dylib.list_undefined_symbols_for_dependency(path, True)
print("Allowed: ", allowed)
expected_lib_paths = dylib.find_library_paths(allowed)
all_paths = []

Expand Down

0 comments on commit f426c9c

Please sign in to comment.