Skip to content

Conversation

@freakboy3742
Copy link
Contributor

@freakboy3742 freakboy3742 commented Jan 8, 2025

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.

@radarhere radarhere changed the title Rewrite the install_name of the ZLIB-NG library on macOS. Rewrite the install_name of the ZLIB-NG library on macOS Jan 8, 2025
@freakboy3742
Copy link
Contributor Author

Gentle nudge on this (and/or #8672) - is there something preventing a merge on one of these two fixes for #8671?

@hugovk hugovk added this to the 11.2.0 milestone Feb 6, 2025
@freakboy3742
Copy link
Contributor Author

I believe #8743 is an even better solution, as it fixes the problem at the source; and, with any luck, eventually the patch won't be needed.

@radarhere radarhere merged commit 1650425 into python-pillow:main Feb 15, 2025
66 checks passed
@freakboy3742 freakboy3742 deleted the zlib-ng-with-sip branch February 16, 2025 01:07
@radarhere
Copy link
Member

I've created #9312 to upgrade to zlib-ng 2.3.1, which now includes zlib-ng/zlib-ng#1867.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants