Wheels: link FreeType against the bundled HarfBuzz - #9913
Open
akx wants to merge 1 commit into
Open
Conversation
FreeType's autofitter can use HarfBuzz to work out which glyphs a script covers, so it can derive blue zones for scripts such as Arabic. Only the Windows wheels were built to allow that. macOS passed --with-harfbuzz=no, and Linux left it unconfigured, which meant FreeType defaulted to `dlopen`ing HarfBuzz at runtime with the name "libharfbuzz.so.0". `auditwheel`, part of the wheeling process, renames shared libraries to avoid conflicts, so the Linux wheels ended up with a FreeType that would only find HarfBuzz if the system had its own copy with the name "libharfbuzz.so.0"; the bundled copy was never used.
akx
marked this pull request as ready for review
August 27, 2026 12:35
This comment was marked as outdated.
This comment was marked as outdated.
radarhere
reviewed
Aug 29, 2026
| fi | ||
| # FreeType and HarfBuzz each want the other: | ||
| # HarfBuzz reads font data through FreeType, and FreeType's autofitter asks HarfBuzz which glyphs a script covers. | ||
| # Break the cycle by building FreeType twice, so that the FreeType we ship is linked against the HarfBuzz we ship. |
Member
There was a problem hiding this comment.
It is unusual that this should be required, right? Have FreeType or Harfbuzz discussed this anywhere?
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.
Follows up on #8497.
This came up as a side effect of #9909, where the last commit needed to increase the allowed comparison epsilon for the Arabic-language test, since different platforms in the CI stack would render it slightly differently... and it's a doozy! 😄
FreeType's autofitter can use HarfBuzz to work out which glyphs a script covers, so it can derive blue zones for scripts such as Arabic.
Only the Windows wheels were built that way. macOS passed
--with-harfbuzz=no(so no HarfBuzz interop, no way, no how), and Linux left it unconfigured, which meant FreeType defaulted todlopening HarfBuzz at runtime with the name "libharfbuzz.so.0".However,
auditwheelrenames shared libraries to avoid conflicts, so the Linux wheels ended up with a FreeType that would only find HarfBuzz if the system had its own copy with the name "libharfbuzz.so.0".In the current 12.3 wheel off PyPI, the interop symbols do not exist:
but in a wheel built by CI off this branch (see akx#18):