vibhatha commented on code in PR #40520:
URL: https://github.com/apache/arrow/pull/40520#discussion_r1555116608


##########
dev/archery/archery/linking.py:
##########
@@ -61,9 +64,71 @@ def list_dependency_names(self):
             names.append(name)
         return names
 
+    def _extract_symbols(self, symbol_info):
+        return [re.search(r'\S+$', line).group() for line in symbol_info if 
line]
+
+    def _remove_weak_symbols(self, lines):
+        return [line for line in lines if not re.search(r'\s[Ww]\s', line)]
+
+    def list_symbols_for_dependency(self, dependency, 
remove_symbol_versions=False):
+        result = _nm.run('-D', dependency, stdout=subprocess.PIPE)
+        lines = result.stdout.decode('utf-8').splitlines()
+        if remove_symbol_versions:
+            lines = [re.split('@@', line)[0] for line in lines]
+        return self._extract_symbols(lines)
+
+    def list_undefined_symbols_for_dependency(self, dependency,
+                                              remove_symbol_versions=False):
+        result = _nm.run('-u', dependency, stdout=subprocess.PIPE)
+        lines = result.stdout.decode('utf-8').splitlines()
+        if remove_symbol_versions:
+            lines = [re.split('@@', line)[0] for line in lines]
+        lines = self._remove_weak_symbols(lines)
+        return self._extract_symbols(lines)
+
+    def find_library_paths(self, libraries):
+        paths = {}
+        system = platform.system()
+        for lib in libraries:
+            paths[lib] = []
+            if system == 'Linux':
+                result = _ldconfig.run('-p', stdout=subprocess.PIPE)

Review Comment:
   I am getting a missing symbol after using `ldd` locally, but I am going to 
add this here and see what happens in the CIs
   
   ```bash
   archery linking check-dependencies \
     --allow ld-linux-aarch64 \
     --allow ld-linux-x86-64 \
     --allow libc \
     --allow libdl \
     --allow libgcc_s \
     --allow libm \
     --allow libpthread \
     --allow librt \
     --allow libstdc++ \
     --allow libz \
     --allow linux-vdso \
     
/home/vibhatha/Documents/Work/Apache_Arrow/issues/gh-40018/arrow-dataset-15.0.2/x86_64/libarrow_dataset_jni.so
   Error: Undefined symbols found in 
/home/vibhatha/Documents/Work/Apache_Arrow/issues/gh-40018/arrow-dataset-15.0.2/x86_64/libarrow_dataset_jni.so:
   __tls_get_addr
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to