diff --git a/dev/archery/archery/linking.py b/dev/archery/archery/linking.py index 22f5c70f987e1..0602f99c39466 100644 --- a/dev/archery/archery/linking.py +++ b/dev/archery/archery/linking.py @@ -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 @@ -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 = []