Skip to content
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

Update notes about static linking and MUSL #224

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

![Minimum Rust version: 1.1](https://img.shields.io/badge/Minimum%20Rust%20Version-1.1-brightgreen.svg)

(Note: current Rust (as of 1.48) supports static linking with either glibc or
MUSL, so you can select whichever libc you need or prefer.)
Comment on lines +5 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure it is 1.48? I thought static support is in 1.49 (rust-lang/rust#77386).

I would suggest being a little clearer here, and providing an example:

Suggested change
(Note: current Rust (as of 1.48) supports static linking with either glibc or
MUSL, so you can select whichever libc you need or prefer.)
> Note: Starting with Rust 1.49, the Linux glibc targets also support static
> linking the C runtime. This can be done with the [`+crt-static` target feature][crt-static].
> For example, with Cargo:
>
> ```console
> RUSTFLAGS="-C target-feature=+crt-static" cargo build --target x86_64-unknown-linux-gnu
> ```
[crt-static]: ../../../reference/linkage.html#static-and-dynamic-c-runtimes

I would also put this at the bottom of this section (just before ## Installing MUSL support).


By default, Rust will statically link all Rust code. However, if you use the
standard library, it will dynamically link to the system's `libc`
implementation.
Expand Down