-
Notifications
You must be signed in to change notification settings - Fork 147
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
PEP 656 musllinux support #305
Comments
Hi @uranusjr, Sorry it took this long for someone to answer. I think it makes sense to add musllinux support to auditwheel. One a of the major difference I foresee is that, because glibc uses symbol versioning, everything is done through the policy wether we're talking about glibc libraries, gcc/g++ libraries. Symbol versions are used to compute the effective policy and thus wether or not it's compatible with the requested one. As I see it, it would require at least a new json policy file specific to musllinux, a way to switch between policies at startup & the minimum "musl" detection code. @lkollar, any other inputs/ideas/remarks/objections ? I do not have the time to look into it myself but will do my best to review any proposition to add such support. |
The musllinux spec was intentionally designed to follow the new “perennial” manylinux design, so I’m kind of expecting to reuse much of the same logic. musl does not support the same symbol versioning functionalities as glibc, only allows pulling the default version and not the latest version, but I’m expecting users to mainly use containers to produce musllinux wheels, so they can use an older musl version in their image to get the musllinux tag they want; i.e. a wheel built against musl 1.2 can only become |
That was my - probably unclear - comment:
You build & repair on musl 1.2, you get I was more thinking about symbol introduction rather than symbol compatibility and trying to detect which minimum musl version satisfies the symbols used by the wheel being repaired. Maybe that's a bit too complicated, not wanted or whatever. The option you propose is a perfectly valid one although it differs a bit from my comment which doesn't add "or later". If you get "later", then, it becomes a hassle to test the wheel you just built in the same image because pip will refuse - rightfully so - to install it. |
I think we are on the same page, just not communicating very well 🙂
I don’t think it’s practical. musl does not expose the information itself, so to achieve this we’ll need to maintain the symbol-minver lookup ourselves. So yeah, too complicated etc.
I probably shouldn’t have added the “or later” part, it only made things more complicated. I was trying to say that the user theoratically can choose to repair a wheel into |
do you mind if auditwheel maintainers edit your first post to add a checklist of what we would expect to see in a PR ? I think it would help potential contributors to understand what's expected without browsing through all comments. |
No problem at all, please go ahead! |
At first glance, most of the work should be in creating a For For PEP 600 For PEP 656
this has to be checked. If it's not the case, something else shall be implemented. |
How do you determine whether a distro is compliant to a PEP 600 manylinux tag? From my understanding of PEP 600 (which PEP 656 follows), whether a library (except libc) is allowed depends on whether it is provided by popular distros. This means the policy is inheritantly defined by distros, and it seems circular to me if distros can be categorised by that policy. |
Just looking at its glibc version.
For auditing, it's not only wether a library is allowed. It's also wether or not its version (or more exactly symbols it uses) are allowed. This is only enforced for gcc libraries in auditwheel as of now (& glibc but we already talked about how to handle musl in a previous comment). Let's take a look at simple sample: In other words, every popular glibc 2.28 distro is compliant for consuming
Well, I think you had a look at the https://github.com/mayeut/pep600_compliance and that the wording there is a bit misleading. The 2 other sections are a bit more interesting: The "Acceptable distros to build wheels" section is a bit more interesting here. The way the policies are built is even more interesting for the purpose of this thread and it exactly matches your comment "policy is inheritantly defined by distros":
|
Thanks a lot for the detailed explaination, indeed I was misunderstanding what Since musl does not cover C++ in the first place and I believe distros just use libstdc++ built against musl, can the above PEP 600 implementation be used for PEP 656? Where can I find it? I quickly searched but couldn’t find the above code snippet in either |
If gcc libraries do use symbol versioning (as opposed to musl), sure you can use it. If not....
I wrote this as pseudo-code for it to be a bit clearer. The actual way it works in the pep600_compliance repo is:
PEP 656 starts from scratch so there's no pre-existing policies which should simplify a bit the code (look for "official") and policies can be built cleanly. |
I know Alpine’s toolchain does support symbol versioning, and at least some libs are compiled with it (not sure if all of them do), so that should be a good starting point (again, I expect PEP 656 users to mainly use containers for compilation, so having one working distro should be enough). I’ll find some time to dig into the compliance logic and se what I can come up with. (But thinking this some more, Alpine doesn’t really come with many libraries in the first place, maybe this whole discussion would be pretty moot and we end up not including any system libraries at all… I’ll need to check that.) |
|
This prepares for other policies to be added with meaningful names. Contributes to pypa#305 resolution where `musllinux-policy.json` would be added.
This prepares for other policies to be added with meaningful names. Contributes to #305 resolution where `musllinux-policy.json` would be added.
So I suppose we should go through the current white list in the Looking at From this it seems that although some of the GNU symbol versions are kept on Alpine, these libraries are linked against I think it would be also worthwhile to come up with a list of popular musl distros which we can include in the initial research and testing. There are quite a few listed on https://wiki.musl-libc.org/projects-using-musl.html but I'm sure many of these are niche enough that we shouldn't include them. Some of the major ones I've used or heard about are Alpine, OpenWRT and the musl variant of Void. Any others? |
After reading through the PEP discussions on Discourse, particularly from Nathaniel's post it seems that So in theory, the I expect quite a few changes to |
Yes I think that’s totally reasonable. I intentionally left out what exactly should be grafted because the default Alpine installation is so bare. So we should start with grafting mostly everything and see what the community reacts. If there’s a strong demand in reducing wheel sizes (by sharing some libraries between them), we can learn from the actual users what they want to share and create PEPs for specific |
I started prototyping this in A major roadblock I've hit is that I have no idea how to determine what version of If we can't determine the version reliably, we could take it from the user with |
For anyone following this, I posted the same question about the |
You mean exposing the interface in I’ll reply to the rest on Discourse to keep the conversation in one place. |
I wouldn't graft |
I'm actually not aware of problems with grafting |
Thanks for the feedback @njsmith. |
I've uploaded my work in progress in #313. This will require a significant refactor as We will also need to build |
PR #313 has been superseded by PR #315 per #315 (comment) |
#315 is merged now. So this is closable I think? |
5.0.0 with musllinux support is available on PyPI |
PEP 656 proposed
musllinux
, a counterpart ofmanylinux
for Linux distros running on musl libc. I’ve recently implemented support for installingmusllinux
wheels (pypa/packaging#411), and are now looking for a place to implement wheel generation logic.Do you think auditwheel is a good place for this? Many things are the same auditing manylinux and musllinux wheels (the Linux part), but from my (very little) understanding, many parts in auditwheel assume glibc and would need some refactoring to work with musl, so there’s case to create a new tool for musllinux wheel auditing as well. My main end goal is to add musl to the support matrix of cibuildwheel (pypa/cibuildwheel#627), so either approach would ultimately be fine.
Edit from maintainers:
List of tasks that would need to be done in order to add support for musllinux.
This list is subject to changes and will be updated with feedback from comments.
auditwheel/policy/policy.json
->auditwheel/policy/manylinux-policy.json
refactor: rename policy.json to manylinux-policy.json #311auditwheel/policy/musllinux-policy.json
following the same schema. Add support for musllinux #315This seems to be what's needed for now.
Be warned, most of the work is probably
musllinux-policy.json
.The text was updated successfully, but these errors were encountered: