diff options
author | Andrew Gallant <jamslam@gmail.com> | 2023-10-23 12:01:27 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2023-11-20 23:51:53 -0500 |
commit | c33f6237199cd3ae6f884f5fe0f6ccf57f805a28 (patch) | |
tree | 5d703a6a9fe5397afd563718cf235482d9e132d9 /.cargo | |
parent | 824778c009165d5b56f97aad1b824a2bca039c08 (diff) |
cargo: explicitly configure musl to be statically linked
It looks like the musl target will, at some point, default to be
dynamically linked. This config knob should make it so that it's always
statically linked.
Ref https://github.com/rust-lang/compiler-team/issues/422
Ref https://github.com/rust-lang/compiler-team/issues/422#issuecomment-812135847
Diffstat (limited to '.cargo')
-rw-r--r-- | .cargo/config.toml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index 7db936b4..9e543011 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -6,3 +6,16 @@ rustflags = ["-C", "target-feature=+crt-static"] [target.i686-pc-windows-msvc] rustflags = ["-C", "target-feature=+crt-static"] + +# Do the same for MUSL targets. At the time of writing (2023-10-23), this is +# the default. But the plan is for the default to change to dynamic linking. +# The whole point of MUSL with respect to ripgrep is to create a fully +# statically linked executable. +# +# See: https://github.com/rust-lang/compiler-team/issues/422 +# See: https://github.com/rust-lang/compiler-team/issues/422#issuecomment-812135847 +[target.x86_64-unknown-linux-musl] +rustflags = [ + "-C", "target-feature=+crt-static", + "-C", "link-self-contained=yes", +] |