MacOS Big Sur is out in Dev Beta and I am running it to test out a few things. One of the things I've noticed is that in Python ctypes, find_library()
no longer finds the libraries.
An example would be
from ctypes.util import find_library
find_library("ssl")
This should find the ssl
file similar to the output like
>>> find_library("ssl")
'libssl.so.1.1'
However, with Big Sur, it finds nothing. I noticed their are some Dynamic Linker changes. That might contribute to this behavior.
Has anyone else encountered this? I am looking for the new method for finding libraries across the Big Sur system.
I believe it is the same as iOS in that it's using /System/Library/dyld/dyld_shared_cache_x86_64
for shared cache. But I am not familiar enough to know how to open that file for accessing things like CoreFoundations, ssl, etc. Still looking into it.
This issue is due to python using stat()
to check for dylibs on disk before it dlopen's them. This behaviour stopped working in macOS Big Sur due to dylibs being removed from disk when they are included in the dyld shared cache.
The python included in macOS has a fix for this.
/usr/bin/python3
from ctypes.util import find_library
>>> find_library("ssl")
'libssl.so.1.1'
Additionally, here is a link to a pull request for open source python for the same fix there. https://github.com/python/cpython/pull/21241
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With