Open
Description
TODO:
- Installable host toolchain (Musl host toolchain #58575)
- Rustup support (Add x86_64-unknown-linux-musl build rustup#1882)
Tests passing as the host ( Make tests compatible with musl host #60474)Transition musl targets to dynamically link libc by default- MCP approving this: Update the existing musl targets to be dynamically linked. compiler-team#422
static-pie support static-pie for musl target (remove crt1.o) #53968 (done in Enabling static-pie for musl #70740)
For people looking how to use as it dynamic target:
RUSTFLAGS="-C target-feature=-crt-static" cargo build
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
wangbj commentedon Mar 20, 2019
It seems
x86_64-unknown-linux-musl
target doesn't honor--enable-default-pie
, a different behavior compare tox86_64-unknown-linux-gnu
. Is this a known issue?mati865 commentedon Mar 20, 2019
@wangbj I don't think Rust supports
--enable-default-pie
for any target. Could you provide more details?wangbj commentedon Mar 20, 2019
hmm, the problem seems caused by
musl-gcc
wrapper instead ofrustc
:details: https://gist.github.com/wangbj/ead5fa8c96418de7c9050bc354fbf353
--enable-default-pie
is a gcc configure flag. sorry for the noise. (shortened the text to a gist).Cogitri commentedon May 3, 2019
FWIW, Void has been hacking around this for some time: https://github.com/void-linux/void-packages/blob/742a7d53eb0b373bf8dad3b51db3380c5cdf8dc1/srcpkgs/rust/patches/musl-dont-use-crt-static.patch and https://github.com/void-linux/void-packages/blob/742a7d53eb0b373bf8dad3b51db3380c5cdf8dc1/srcpkgs/rust/patches/link-musl-dynamically.patch
I'm currently working on this for Alpine too (BTW, maybe I can ping you on the PR for this @mati865 so you can take a look at it?).
mati865 commentedon May 5, 2019
I knew about Alpine and Void. IMO Alpine approach is better because
<arch>-unknown-linux-musl
remain static by default (it behaves like upstream) and new target<arch>-alpine-linux-musl
links dynamically by default.I had looked at that PR and
libc
changes will be incompatible with upstream rust behaviour. Official Rust packages when statically linking to musl create executables that all fully static (run basically everywhere), that patch will create static executables that depend on musl runtime (use have to install musl to be able to run them).Cogitri commentedon May 5, 2019
Yup, but at least on Void we've come to terms that the Rust in the repos is only really meant for packages in the repos, while users interested in rust development should use upstream Rust via rustip.
smaeul commentedon May 5, 2019
That doesn't make sense. Static executables by definition don't depend on having musl installed. Are you referring to rust-lang/libc#1327? That change would require having a musl-targeting toolchain installed for rustc to link (static) musl-targeting binaries. But any static binaries compiled by rustc would still be totally independent and require no musl installation.
mati865 commentedon May 5, 2019
@smaeul I'm referring to https://github.com/alpinelinux/aports/blob/21c1983ce828ead1afc9e80aa77ede330c662182/community/rust/link-musl-dynamically.patch
52 remaining items