-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-evaluate bundling dynamic library dependencies in manylinux wheels. #284
Comments
Item 3 already exists, I personally uses the releases from https://github.com/HinTak/skia-building-fun when I switch skia upward. It still needs be static - as skia-python's pybind11 code can't cross dynamic library boundaries, but there is already an answer of NOT bundling any system libraries at all - it is just that AFAIK only I am building skia that way. (It is quicker for me to switch skia when they are properly separate). 2 is a possibility, but it is a matter of what's the oldest we want to support - there are people still asking for 87.x you know, 4 years after Google stopped supporting it. As I comment in #175 I am not sure the vulnerability is real - the vulnerability refers to packages, which consists of multiple libraries, and not all of them are applicable. I.e. while package X is known to be vulnerable, package x have 10 libraries, and we are only bundling one of 10 (say). The vulnerability may well be one or two of the other 9, within the same package. I am tempted to close this as duplicate of #175, or the other way round. |
Also, we don't actually use the bundled old freetype nor the bundled old libpng - we use some of the latest features in freetype so actually use |
Apparently it is just adding icuuc, webp, jpeg, webpdemux, webpmux, harfbuzz-subset and adding freetypr header locations, to build against a "everything from system" static skia. |
See also #257 . I think the issue covered here is a combination of #257 and #175 . Please feel free to improve #257 , and adding (alternative from system) of "icuuc, webp, jpeg, webpdemux, webpmux, harfbuzz-subset and adding freetypr header locations, to build against a "everything from system" static skia." to |
Thanks for the detailed explanation of why things are this way, I really appreciate it!
Interesting! If it's using system freetype anyway, why not use system fontconfig instead of bundling it?
This repo is super interesting and useful, thank you.
Haha I don't doubt it! Maybe for Python 3.13+ wheels we could step up the |
Your understanding of what is and what isn't bundled is in the opposite sense, I think. Skia/Chrome uses freetype on all platforms (and Google contributes to freetype development) to use freetype to load fonts on mac os which apple does not support, and load fonts on windows which Microsoft does not support. Hence skia has a build option to bundle freetype ("use system freetype false" means use the private up-to-date static copy from google repo as a submodule - it is sometimes ahead of "latest freetype release", and definitely ahead of most linux's distro's shipped freetype) within skia. The dependency on fontconfig is only on Linux. There is 2nd and different bundling process by auditwheel, which is what you see. Basically the 2nd bundling bundles what is NOT bundled by the first. What you observe is the 2nd bundling; what is written in libpng is a dependency of freetype (to load apple emoji's on MS platforms, if you want a specific usage). Hence both are/can be bundled by the first bundle, and their usage are up to date in current skia-python, although it does not look like it. Fontconfig is an optional dependency applies only to Linux, so it is bundled by the 2nd stage (and together with what it depends, the older copy of freetype & libpng). |
@kyamagu switching manylinux for the new python builds is an interesting idea - since we broke into two build stanza in m132 - one for 3.8 + 3.9, another for 3.10,11,12,13 (due to github's build machinery not being able to cope with both new and old in one), it isn't too hard to split out say 3.13 - in fact we can probably go with the oldest Linux box that has 3.10 for the latter group of builds, since they are now separate? |
Python 3.10 dev began in May 2020, released 2021 Oct. 2.30 August 2019 We should be able to say python 3.10 is accompanied by at least glibc 2.31? @kyamagu - it is of course possible to put extremely new python on extremely old glibc system... but we are trying to guess what distro combinations are on initial shipping, I think. |
2_28 will be the default in 6 months - https://cibuildwheel.pypa.io/en/stable/options/#linux-image - so do nothing, this and #175 will probably fix itself. |
By the time we merge for the next release (134 possibly), it would be only about 3 months ahead. |
Thanks for explaining, @HinTak! I'm still confused on one aspect - if the manylinux builds are indeed using system libraries, then why is it seemingly using the wheel's
Also, if the wheel libraries aren't being used, it would probably be worthwhile to not include them since they make the |
@theacodes "up to date" != "system". There are 3 sets of libraries, one from skia's submodules, which is always up to date and occasionally have extra google-specific stuff being upstreamed, and sometimes ahead of releases - google has a forked freetype repo and forked libpng repo, but not fontconfig; (2) the build host, which is manylinux2014 and soon to be manylinux2_28, (3) the runtime host, I.e. your computer. Fontconfig is from (2), which is why it isn't 100% happy working in (3). Freetype and libpng used to be from (2) too, but switched to (1) about a year ago. What you see them bundled is indirect from fontconfig. Since the build host's copy of fontconfig does not know it will have (1) eventually, the fontconfig library on the build host holds a reference to the build host's freetype, which then get bundled. The benefit of switching from (2) to (1) is that things are more up to date - but it makes larger binaries, because the |
@theacodes also you probably don't realise: (2) is not built on the build host, but just taken from system locations of the build host. That's why they exist as separate files as seen on (3). (1) is built and included in |
Ah, gotcha. That makes sense. Thank you. :) |
Overview
At the moment,
skia-python
includes several dynamic library dependencies in its manylinux wheel:This is convenient since it reduces the number of system packages that a user needs to install, but it has some serious drawbacks:
libfontconfig
that depend on configuration files found in the system. For example, modern Debian installs a config file at/usr/share/fontconfig/conf.avail/05-reset-dirs-sample.conf
that is incompatible with the older version oflibfontconfig
bundled withskia-python
, causing a warning:How these get bundled
The present build system for
skia-python
causes this through two location. First, Skia is told not to use system packages when being built:skia-python/scripts/build_Linux.sh
Lines 71 to 76 in db7d7fc
Second, cibuildwheel will run
auditwheel
on anymanylinux
wheel. This where these dependencies get grafted into the wheel.Possible solutions
manylinux
wheels will use outdated versions of these libraries.manylinux2014
in favor of a newer PEP600 version based onglibc
, possiblymanylinux_2_36
(which covers contemporary distros like Debian 12). This would result in newer version being bundled, but wouldn't completely resolve the issue.skia-python
without the necessary packages.Version comparison
The text was updated successfully, but these errors were encountered: