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

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

Later updates to the posix search case did include LD_LIBRARY_PATH but were not backported. Additionally, these had reliance on gcc and ldconfig behavior that 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