-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for building with static glibc #1899
Add support for building with static glibc #1899
Conversation
r? @JohnTitor (rust_highfive has picked a reviewer for you, use r? to override) |
45a0027
to
d76f0d0
Compare
Still WIP, need to do something similar for the link lines for |
OK, this should work now. |
74cfbfd
to
8e65bdb
Compare
Update: had to reverse the order of the libraries so that symbol resolution worked correctly when linking statically. |
Both of the failures seem entirely unrelated to this PR. |
Also, as far as I can tell, this change (together with some corresponding changes in rust-lang/rust) will noticeably speed up linking of all Rust binaries on |
This will need corresponding changes in rust-lang/rust to activate, but this will make it possible to make those changes. Note that despite the apparent redundancy in config directives, the link directives cannot be simplified any further. Attempting to factor out the checks for `target_feature = "crt-static"` does not work.
The two library blocks that specify `#[link(name = "util")]` do not actually reference any functions in `libutil`; the functions that do use `libutil` don't have any reference to it. And having two library blocks specify it results in two separate inclusions of `-lutil` on the linker command line. Move the link lines up to `src/unix/mod.rs`, making it easier to see all the libraries `libc` links to. This also makes `libutil` respect `target-feature=+crt-static`.
Move the link line for `libdl` up to `src/unix/mod.rs`, making it easier to see all the libraries `libc` links to. This also makes `libdl` respect `target-feature=+crt-static`.
8e65bdb
to
5bf6ee5
Compare
Thanks for the work and sorry for the delay! Looks great to me, let's re-trigger CI to make sure it. |
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.
The failure is due to timeout and it was green previously so I'd ignore here. Thanks!
This will need corresponding changes in rust-lang/rust to activate, but
this will make it possible to make those changes.
Note that despite the apparent redundancy in config directives, the link
directives cannot be simplified any further. Attempting to factor out
the checks for
target_feature = "crt-static"
does not work.