Windows build improvements#6562
Merged
hugovk merged 17 commits intopython-pillow:mainfrom Oct 27, 2022
Merged
Conversation
…penjpeg binaries on windows
Contributor
|
# Conflicts: # Tests/test_imagefont.py
19 tasks
hugovk
approved these changes
Oct 26, 2022
This was referenced Oct 29, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #6369, close #6554, close #553
In an effort to sync the dependencies available on Linux/macOS (python-pillow/pillow-wheels) and Windows (test-windows.yml) ahead of the next release (#6460), I've compiled a list of dependencies (including indirect ones) below, and included some updates for Windows in this PR.
The full list is: (click to expand)
libjpegvia its forklibjpeg-turboversion 2.1.4 is included on all platformszlibversion 1.2.12, included on all platformslibtiffversion 4.4.0, included on all platformszlibandlibjpegon all platformslzma2version 5.2.6 fromxz; added on Windows in this PR and added testwebpbecause that is built afterlibtiffon both platforms; swapped on Windows in this PR and added testdeflate,jbig,libjpeg12,lerc,zstd, but cgohlke mentioned at least LERC being included in his wheels in _imaging Failed to Import in from PIL import Image #5573 (comment)webpversion 1.2.4, included on all platformslibjpeg,libpng,libtiff, andgiflibare only used for binary conversion utilities, notlibwebp. However, on Linux/macOS multibuild ensures these are built beforewebp. For Windows I movedwebpto be built beforelibtiff.freetypeversion 2.12.1, included on all platformszlibandlibpngon all platformsharfbuzzonly on Windows because the cyclic dependency is tricky to resolve with GCCbzip2version 1.0.8. I tried adding it on Windows, but the driverftbzip2appears to have been left out of the Visual Studio project files. It is only used for.pcf.bz2fonts which aren't that common anyway (especially on Windows).brotliversion 1.0.9 added in Added brotli pillow-wheels#320 for Linux/macOS and this PR for Windowslcms2version 2.13.1libjpeg,zlib,libtiffare only used in binary utilities, not the libraryopenjpegversion 2.5.0zlib,libpng,libtiff,lcms2are only used in binary utilities, not the library; changed the build flag used on Windows to reflect this (makes builds marginally faster).harfbuzzversion 5.1.0 included on all platforms with its dependency FreeTypexcbis included on Linux/macOS; not very useful on Windowsfribidiis linked at runtime, support shim is enabled on all platformslibimagequantis only used in tests, not included in wheelsChanges proposed in this pull request:
xz, used bylibtiffwebpbeforelibtiffrather than after so thatlibtiffcan use itbrotliforfreetypewith a WOFF2 font test for Unknown file format error on somewoff2fonts onImageFont.truetype()#6554 / Added brotli pillow-wheels#320LICENSEbefore building wheels (on GHA only)py_vcruntime_redistvariable. Although I previously thought it was no longer necessary, it turns out this is only true for recent builds of Python (such as the ones on GHA). It is still necessary for older builds such as the one on AppVeyor (I noticed it was emitting a linker warning). It can be safely removed again when Python 3.9.0 is the oldest supported release: https://github.com/python/cpython/blob/v3.9.0/Lib/distutils/_msvccompiler.py#L243This is enough to get the Windows and Linux/macOS mostly in sync, with
bzip2forfreetype, andxcbnot enabled on Windows, andwebpforlibtiffnot enabled on Linux/macOS.Considerations for future PRs:
libtiffdependencies (deflate,lerc,zstd), might be worth adding on all platforms.Addbrotlifor Unknown file format error on somewoff2fonts onImageFont.truetype()#6554_webpand_imagingcould save about 0.5MB per wheel with thelibtiffchanges above.Additional testing (e.g. _imaging Failed to Import in from PIL import Image #5573 (comment)); I'm working on a separate PR.see Check available features in Windows wheels #6847; edit: see also bpo-25361: enables use of SSE2 instructions in Windows 32-bit build. python/cpython#12438; edit2: fixed in libpng v1.6.41libpngis failing to detect SSE2 support, should be safe to patch in (even Windows 7 requires SSE2 now)harfbuzzbuild warning:openjpegsuggests enabling SSE4.1/AVX2 if available, probably not safe to enable yet