-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
docs: Add caveats for glibc version targeting feature #232
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
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.
This is expected because even if you want to use glibc 2.32, you can still end up being compatible with glibc 2.31 because all of the versioned symbols you linked are < 2.32.
glibc doesn't increase symbols versions for every functions in a new minor version, only these with breaking changes.
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.
My intent is just to highlight the difference in behaviour from
cargo build
when dynamically linking that same glibc version,cargo zigbuild
is being more lenient.That may be an improvement if it's not impacting functionality. I just wanted to highlight that there was a difference, so there isn't any confusion if it built with the intended version when it doesn't fail under the same conditions that a build via
cargo build
would.How would you word it differently?
EDIT: As covered in last section below
pthread_getattr_np
due to moving the symbol fromlibpthread
tolibc
.Reproduction (static vs dynamic vs zig dynamic)
Below is a reproduction for
cargo build
based on rust-lang/libc#2054 (comment) regardingopenpty
usage withglibc 2.32
.2.32
will prevent it running on earlier glibc, but it'll work fine on newer versions.2.32
becomes compatible with earlier versions of glibc too.cargo zigbuild
can dynamically link with:2.32
target and the failure on earlier glibc is avoided.>2.32
target will introduce failure with a dependency requirement on glibc2.33
.Reproduction example
When building on Fedora 32 (glibc
2.31
) container instead:2.30
)GLIBC_2.31 not found
on Fedora 31, works correctly.cargo zigbuild
for2.32
However when a Fedora 31 (glibc
2.30
) container runs a build via Fedora 34 (glibc2.33
):A static build with glibc
2.33
is successful across all of these Fedora containers.2.33
was when theopenpty
method received proper static support.2.30
vs2.31
. So for static builds it depends on their static build support for that glibc target version.Dynamic linking differences
TL;DR:
cargo zigbuild
will matchcargo build
when linking to glibc2.33
with the built program failing to run on hosts with earlier glibc.cargo build
would also have that same failure experience when building with glibc2.32
version too, but otherwise fine withglibc 2.31
build running on host withglibc 2.30
🤔I tracked it down, the difference doesn't appear related to
openpty
. I'm not entirely sure why the symbol versions differ betweencargo build
andcargo zigbuild
, presumably Zig knows better to not match thepthread_getattr_np
version for glibc 2.32? 🤷♂️ (or it's a bug)Dynamic linking differences (resolved)
UPDATE: I've learned how to inspect the symbol versions to understand what was enforcing the min supported glibc version between
cargo build
andcargo zigbuild
:cargo build
had the min glibc versions of 2.32 because ofpthread_getattr_np
. Prior versions of glibc version this symbol much lower, which matchescargo zigbuild
.cargo zigbuild
as it shares the same symbol version bump forstat64
(technically renamed, not just version bump?)What introduces a difference to(UPDATE: findings below)cargo zigbuild
between glibc2.32
vs2.33
version targeting? Presumably something related to this commit (that was identified as relevant to the compatibility for static builds)From the Fedora mailing list June 2020:
Related bug report:
While this may seem Fedora specific due to the container image choice and reference links, Debian 12 (Bookworm) via
rust:latest
with glibc 2.36 also produces this min requirement.For static builds,
_dl_open
will be always present when linking glibc, regardless if your program would use it or not: