-
-
Notifications
You must be signed in to change notification settings - Fork 79
fixes compatibility with macos big sur. #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes compatibility with macos big sur. #47
Conversation
MacOS Big Sur had dynamic linker changes. Shared libraries are now
stored only in `/System/Library/dyld/dyld_shared_cache_x86_64`
and no longer present on the actual file system. This changes makes the
`find_library` not return the paths of the libraries such as
`find_library("ssl")`
wbond
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we just need a few little tweaks making sure that we only set the OpenSSL paths if we didn't find anything.
oscrypto/_openssl/_libcrypto_cffi.py
Outdated
| libcrypto_path == '/usr/lib/libcrypto.42.dylib' | ||
| # if we are on macOS 10.15+, we want to strongly version libcrypto since unversioned libcrypto has a non-stable ABI | ||
| if sys.platform == 'darwin' and list(map(int, platform.mac_ver()[0].split('.')))[1] >= 15 and \ | ||
| if sys.platform == 'darwin' and tuple(map(int, platform.mac_ver()[0].split('.'))) >= (10, 15) and \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably become an elif. While it running for 10.16+ doesn't change because the last condition won't apply, this seems more fragile than needs be.
| libcrypto_path == '/usr/lib/libcrypto.42.dylib' | ||
| # if we are on macOS 10.15+, we want to strongly version libcrypto since unversioned libcrypto has a non-stable ABI | ||
| if sys.platform == 'darwin' and list(map(int, platform.mac_ver()[0].split('.')))[1] >= 15 and \ | ||
| if sys.platform == 'darwin' and tuple(map(int, platform.mac_ver()[0].split('.'))) >= (10, 15) and \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
oscrypto/_openssl/_libssl_cffi.py
Outdated
| tuple(map(int, platform.mac_ver()[0].split('.'))) >= (10, 16): | ||
| libssl_path = '/usr/lib/libssl.44.dylib' | ||
| # if we are on macOS 10.15+, we want to strongly version libssl since unversioned libcrypto has a non-stable ABI | ||
| if sys.platform == 'darwin' and list(map(int, platform.mac_ver()[0].split('.')))[1] >= 15 and \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
oscrypto/_openssl/_libssl_ctypes.py
Outdated
| tuple(map(int, platform.mac_ver()[0].split('.'))) >= (10, 16): | ||
| libssl_path = '/usr/lib/libssl.44.dylib' | ||
| # if we are on macOS 10.15+, we want to strongly version libssl since unversioned libcrypto has a non-stable ABI | ||
| if sys.platform == 'darwin' and list(map(int, platform.mac_ver()[0].split('.')))[1] >= 15 and \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
Actually, seeing how frequently this pattern is used, it seems reasonable to factor it out into a function of some sort. |
Have something in mind? This? Welcomed suggestions, I am on the road currently. def get_library(library, fallback, unverisoned):
... |
|
Not sure I like this def get_library(name, unversioned, fallback):
library = find_library(name)
if not library and sys.platform == 'darwin' and tuple(map(int, platform.mac_ver()[0].split('.'))) >= (10, 16):
library == fallback
elif sys.platform == 'darwin' and tuple(map(int, platform.mac_ver()[0].split('.'))) >= (10, 15) and \
library == unversioned:
library = fallback
return libraryin use libssl_path = _backend_config().get('libssl_path')
if libssl_path is None:
libssl_path = get_library('ssl', '/usr/lib/libssl.dylib', '/usr/lib/libssl.44.dylib')
if not libssl_path:
raise LibraryNotFoundError('The library libssl could not be found') |
|
@FichteFoll mind helping out with this test issue? I I am guessing I need to fix something in the tests themselves, unless my logic is wrong. |
|
I believe you have an include loop since the root This helper function really shouldn’t be part of the public API, so it should go in a file with an |
FichteFoll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function made this much better to handle, but there were still some rough edges.
Co-authored-by: FichteFoll <fichtefoll2@googlemail.com>
Co-authored-by: FichteFoll <fichtefoll2@googlemail.com>
Co-authored-by: FichteFoll <fichtefoll2@googlemail.com>
Co-authored-by: FichteFoll <fichtefoll2@googlemail.com>
Co-authored-by: FichteFoll <fichtefoll2@googlemail.com>
|
|
|
The error seen with Python 3.7 on Mac can be resolved by rebasing on master, although you may not see it every time the tests are run. |
|
Apparently installing PyPy via homebrew is broken, so I'm just going to ignore that error for now. Thanks for the work on this! |
MacOS Big Sur had dynamic linker changes. Shared libraries are now stored only in
/System/Library/dyld/dyld_shared_cache_x86_64and no longer present on the actual file system. This changes makes thefind_librarynot return the paths of the libraries such asfind_library("ssl")