[3.7] bpo-21622 ctypes.util find_library walk LD_LIBRARY_PATH (GH-10460) by jcastillo2nd · Pull Request #10461 · python/cpython (original) (raw)

Originally, issue was open for case where SONAME wasn't part of binary.

Updates to the posix case did include LD_LIBRARY_PATH, but reliance on gcc and ldconfig behavior breaks in some cases. e.g. musl on alpine builds

This provides a find method that walks the LD_LIBRARY_PATH, checks for ELF bytes, and returns the name when found or None, matching the other behavior.

This runs after all prior cases fail, does not rely on SONAME entry, gcc or ldconfig -p behavior.

https://bugs.python.org/issue21622