[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-09-01 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: I made a typo (forgetting the -D): clang -Wno-unused-result -Wsign-compare -g -O0 -Wall -arch x86_64 -mmacosx-version-min=10.9 -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-undef-prefix -isysroot /Applications/Xcode_12.4.app/Contents

[issue44689] ctypes.util.find_library() does not find macOS 11+ system libraries when built on older macOS systems

2021-09-01 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: It seems like _dyld_shared_cache_contains_path exists, while the define flag HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH has not been set. Essentially, the define-flags being used does not seem to agree with the SDK version you are using. Could you try adding

[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-08-06 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: I realised that I needed to define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME in the source file myself - as this is not defined after running the configure-script. I've updated the PR and its description to only focus on the legacy/deprecated app

[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-08-05 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: This makes a lot of sense now. Thank you so much for the thorough explanation Ned - and for highlighting where my assumptions were wrong! I didn’t realise I needed to specify MACOSX_DEPLOYMENT_TARGET to enable backwards compatibility. Is there a reason

[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-07-22 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: Okay, I decided to look into how I could do dynamic loading as you suggested. Here is a POC (executable) for using _dyld_shared_cache_contains_path when available: ``` #include #include void* libsystemb_handle; typedef bool

[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-07-22 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: You are absolutely right! From the manpage of dlopen(3) on MacOS Big Sur: > dlopen() examines the mach-o file specified by path. If the file is > compatible with the current process and has not already been loaded into the > current process, it

[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-07-21 Thread Tobias Bergkvist
Tobias Bergkvist added the comment: An alternative to using _dyld_shared_cache_contains_path is to use dlopen to check for library existence (which is what Apple recommends in their change notes: https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release

[issue44689] MacOS: Python binaries not portable between Catalina and Big Sur

2021-07-20 Thread Tobias Bergkvist
New submission from Tobias Bergkvist : Python-binaries compiled on either Big Sur or Catalina - and moved to the other MacOS-version will not work as expected when code depends on ctypes.util.find_library. Example symptom of this issue: https://github.com/jupyterlab/jupyterlab/issues/9863 I