Rewrite the install_name of the ZLIB-NG library on macOS by freakboy3742 · Pull Request #8673 · python-pillow/Pillow
EDIT: I believe #8743 is an even better solution, as it fixes the problem at the source.
Fixes #8671. Alternative to #8672
Changes proposed in this pull request:
- Rewrites the install_name of the zlib-ng binary on macOS to be an absolute path.
- Removes the override of
DYLD_LIBRARY_PATH, since it won't be passed down to subshells.
When zlib-ng is compiled, it sets the install name of the libz.1.dylib to @rpath/libz.1.dylib. This means that any subsequent load requires a valid DYLD_LIBRARY_PATH to resolve the link.
Recent versions of macOS have a feature called System Integrity Protection (SIP) which (amongst other things) prevents DYLD_LIBRARY_PATH from being passed into subshells. As the build's dependencies aren't on the default library path on macOS, delocate-wheel is unable to resolve the libz library.
SIP is disabled on GitHub Actions configurations, so this problem isn't seen in CI; but is enabled by default on macOS machines, so individual developers building Pillow dependencies will get an error from cibuildwheel when the wheel is repaired.
By making the install_name of libz an absolute path, it removes the need to dynamically resolve the path.