-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Refactor static / dynamic linking into build options #546
Conversation
7502b0d
to
eb8c67a
Compare
eb8c67a
to
23a92fd
Compare
After trying #547 I think this is a little simpler because we otherwise have to sanitize all the targets when building packages, e.g., |
cpython-unix/build-main.py
Outdated
# Construct possible options, we use a set here for canonical ordering | ||
options = set() | ||
options.update({"debug", "noopt", "pgo", "lto", "pgo+lto"}) | ||
options.update({f"freethreaded+{option}" for option in options}) | ||
link_modes = {"static", "shared"} | ||
options.update( | ||
{f"{option}+{link_mode}" for link_mode in link_modes for option in options} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this, especially since it's repeated. I will refactor this further separately.
Some history on shared / static fields can be found by following #241 |
As a consequence of #540 I was playing with these concepts and decided to explore it. This includes #546 (could be merged separately or together), which separates "static" builds from the "musl" triple specifically in favor of a dedicated build option. The main implementation downside here is that `$ORIGIN` doesn't work with DT_NEEDED so we need to use RUNPATH instead, which can cause the wrong library to be loaded if LD_LIBRARY_PATH is set. Given the current builds aren't usable at all, I think this is a fine trade-off. We can explore alternatives in the future, like statically linking just libpython. Another caveat here: for consistency with the glibc builds, we're changing the "default" musl build to be dynamically linked. This is a breaking change in the release artifacts. The statically linked musl build will include a `+static` suffix. We could do something for backwards compatibility here, but I _think_ this probably makes sense in the long term. My primary concern is that consumers that combine releases (such as uv) would need to encode this change (e.g., toggle the expectation based on the python-build-standalone version tag). It's challenging to test changes to the release artifact handling. Regardless of approach, this will need a follow-up to adjust that accordingly.
Merged via #541 |
A bit on the fence about where to put this, i.e., it could be a part of the target triple? Trying this out to start.
The goal here is to untangle the static vs shared builds from musl per #542 so we can ship both kinds in #541