-
Notifications
You must be signed in to change notification settings - Fork 958
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
Upgrade zlib-ng #10375
Upgrade zlib-ng #10375
Conversation
8caee53
to
4493536
Compare
# | ||
# See: https://github.com/astral-sh/ruff/issues/11503 | ||
[target.'cfg(all(target_env = "msvc", target_os = "windows"))'] | ||
rustflags = ["-C", "target-feature=+crt-static"] |
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.
We did add this for a reason (astral-sh/ruff#11503) so we need to decide if it's important to retain.
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.
Do you mean root cause of that issue was in zlib-ng
?
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.
No the issue is fundamental to windows and how it deals with ~system libraries. At least one thing we would regard as equivalent to "glibc" on linux is not shipped by default on windows (VCRUNTIME). When you ship a Windows application you are either expected to include an installer ("redistributable") for the version of VCRUNTIME that you need and invoke it to tell windows to add it to the system, or, you're expected to statically link it.
The above config chooses the latter, making us more statically linked in the same way that statically linking musl does. This is good for installing our binaries on any random Windows machine without additional installation stuff.
However it has a similar side-effect that musl does: if you need to dynamically link any other libraries you will likely get errors, because (handwaving) the other libraries dynamically link to VCRUNTIME-et-al and treat the contents of VCRUNTIME as protocol you need to interoperate with.
zlib-ng failing to link properly when we have this setting enabled is indicative of it wanting to dynamically link extra things, and running into the fact that we've essentially opted into "no you don't". (I haven't verified this but it's the only thing that makes sense to me).
By deleting this config (and doing nothing else), we are essentially opting into a lottery where we really hope all our users happened to have installed an appropriate version of VCRUNTIME before they install uv. This was the original issue ruff ran into. So we shouldn't remove it without a solution for redistributables (or research indicating this is just guaranteed to be on all supported systems now).
If you don’t end up merging this for some reason, please consider at least making the version bound For now, I’ll just watch this PR, since it would remove the |
I tried that, but you actually can't make it Windows-specific. Cargo doesn't let you use multiple dependencies when linking a native library, apparently:
|
That kind of almost makes sense – mostly – in retrospect… I think… possibly. Anyway, thanks for attempting it! |
# | ||
# See: https://github.com/astral-sh/ruff/issues/11503 | ||
[target.'cfg(all(target_env = "msvc", target_os = "windows"))'] | ||
rustflags = ["-C", "target-feature=+crt-static"] |
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.
No the issue is fundamental to windows and how it deals with ~system libraries. At least one thing we would regard as equivalent to "glibc" on linux is not shipped by default on windows (VCRUNTIME). When you ship a Windows application you are either expected to include an installer ("redistributable") for the version of VCRUNTIME that you need and invoke it to tell windows to add it to the system, or, you're expected to statically link it.
The above config chooses the latter, making us more statically linked in the same way that statically linking musl does. This is good for installing our binaries on any random Windows machine without additional installation stuff.
However it has a similar side-effect that musl does: if you need to dynamically link any other libraries you will likely get errors, because (handwaving) the other libraries dynamically link to VCRUNTIME-et-al and treat the contents of VCRUNTIME as protocol you need to interoperate with.
zlib-ng failing to link properly when we have this setting enabled is indicative of it wanting to dynamically link extra things, and running into the fact that we've essentially opted into "no you don't". (I haven't verified this but it's the only thing that makes sense to me).
By deleting this config (and doing nothing else), we are essentially opting into a lottery where we really hope all our users happened to have installed an appropriate version of VCRUNTIME before they install uv. This was the original issue ruff ran into. So we shouldn't remove it without a solution for redistributables (or research indicating this is just guaranteed to be on all supported systems now).
Closing based on @Gankra's great diagnosis. |
Summary
If we remove this static linking, we can upgrade
zlib-ng
, which in turn lets us enable it on PowerPC.