Provide a clear option to depend on zlib-ng
This is more of a nit than anything, but the problem arose in conda-forge where we still haven't gone all-in on zlib-ng.
As such, we ship BOTH zlib, and zlib-ng, which are designed to co-exist.
I thus wrote a patch for pillow to be able to directly target zlib-ng.
I figured I would upstream it and maybe this can help other distributions with this predicament.
xref:
- https://github.com/conda-forge/pillow-feedstock/pull/173
- https://github.com/conda-forge/zlib-ng-feedstock/issues/10
- https://github.com/conda-forge/conda-forge.github.io/issues/2638
I'm happy to address any issues you all have with this but the idea is that:
if zlib-ng is found, then choose that, and just use the zlib-ng headers directly instead of zlib.h.
TODO:
- [ ] Add an explicit option to link to prioritize
zlib.horzlib-ng.h-- @mgorny
I figured I would upstream it and maybe this can help other distributions with this predicament.
Are we the upstream and what is the predicament? 😄
Are we the upstream
I think!? right?
the predicament
Today: i want to take advantage of zlib-ng with Pillow, but:
- Either I migrate the whole OS/distribution to zlib-ng
- I stick to zlib
I want to have both:
- Keep all the old packages on zlib
- Use zlib-ng with pillow.
now if only i understood the windows failures ^_^
Today: i want to take advantage of zlib-ng with Pillow, but:
- Either I migrate the whole OS/distribution to zlib-ng
- I stick to zlib
So, just spelling this out, you're saying that if both zlib and zlib-ng are installed, then Pillow may pick zlib over zlib-ng? Probably just based on the order of the paths that it searches?
Have you considered adjusting the search paths? https://pillow.readthedocs.io/en/stable/installation/building-from-source.html#installing
If they are installed in a non-standard location, you may need to configure setuptools to use those locations by editing setup.py or pyproject.toml, or by adding environment variables on the command line:
CFLAGS="-I/usr/pkg/include" python3 -m pip install --upgrade Pillow --no-binary :all:
So, just spelling this out
If you build out zlib and zlib-ng so that they can be co-installed, you have to disable zlib-ng's "compatibility" mode.
Once you've disabled compatibility mode, we are "forced" to use <zlib.h> from zlib.
Have you considered adjusting the search paths?
Yeah this is generally what we do. we set enough flags that it uses the isolated environment.