Apple removed the libraries from the directories listed. In other words, ls
can't see them.
However, the libraries are still there. You must use dlopen
to access them. Apple did this so that it could automatically port libraries needed to different CPU architecture. That porting is expensive -- so dlopen
first checks in a dylib cache for the libraries.
This cache is the reason why the libraries are gone.
You can verify that the libraries still exist via dlopen:
from cffi import FFI
ffi = FFI()
ffi.dlopen('/usr/lib/libSystem.B.dylib')
ffi.dlopen('/usr/lib/actually-nonexistent-library')
This shows the following results:
<cffi.api._make_ffi_library.<locals>.FFILibrary object at 0x7fc1b83d1210>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/cade/opt/anaconda3/envs/my-env/lib/python3.7/site-packages/cffi/api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/Users/cade/opt/anaconda3/envs/my-env/lib/python3.7/site-packages/cffi/api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/Users/cade/opt/anaconda3/envs/my-env/lib/python3.7/site-packages/cffi/api.py", line 827, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library '/usr/lib/actually-nonexistent-library': dlopen(/usr/lib/actually-nonexistent-library, 0x0002): tried: '/usr/lib/actually-nonexistent-library' (no such file), '/usr/local/lib/actually-nonexistent-library' (no such file). Additionally, ctypes.util.find_library() did not manage to locate a library called '/usr/lib/actually-nonexistent-library'