You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no build of rustup-init against musl libc, which means that rustup cannot be installed on Alpine Linux, for example, without building rustup yourself.
Building rustup-init for x86_64-unknown-linux-musl is not going to be enough because there is no rustc component for that triple. I'm not aware of anyone that has built a workingrustc for that triple. I have tried and managed to built a rustc but it always crashed in the LLVM phase when I tried to compile anything. Probably, LLVM needed more patching (I applied some of Alpine Linux patches) to work correctly with musl but I didn't investigate further.
Using https://github.com/emk/rust-musl-builder I've just built what appears to be a perfectly good x86_64-unknown-linux-muslrustup-init (nothing fancy, just a cargo build --release). Is this problem now solvable or am I missing some other missing detail?
It's still not possible to build a rustc that works on musl distros like Alpine. PR rust-lang/rust#40113 is one of the requirements to build such rustc.
It's still not possible to build a rustc that works on musl distros like Alpine.
That’s not entirely correct. It is possible (see APKBUILD), I did it in August 2016 (with your help), but it requires cross-compiling rustc against musl on GNU-based system and applying some hacks.
It’d like to also note that there’s no problem with musl itself, just in Rust build system. 😿
Oy, the cargo package on alpine:edge fails to access the cargo index, due to linking against a broken libgit2... Could someone fix the Alpine rust & cargo packages plz
Rust and Cargo in Alpine testing are currently broken. We’ve updated Rust to the latest version, with better patches that allow both dynamic and static linking on Alpine. Initially it seemed that everything is okay, but then we found many breakages. Still hard working on it, fixing Rust build system…
Building rustup-init for x86_64-unknown-linux-musl is not going to be enough because there is no rustc component for that triple.
Is rust-lang/rust producing rustc binaries for x86_64-unknown-linux-musl? I'm no longer involved with infrastructure stuff so I don't know. Producing rustc binaries is a rust-lang/rust issue that the infra team is in charge of so you should ask them.
P.S. Also, I'm not a rustup developer so I can't reopen issues in this repo.
Is rust-lang/rust producing rustc binaries for x86_64-unknown-linux-musl?
No, they still do not. 😞 However, it is possible to build rustc on and for x86_64-unknown-linux-musl system with fully working both static and dynamic compilation, but it still requires some patches (see here). We in Alpine Linux do it since rust 1.17.0 (package rust). About half of the patches has been already upstreamed, somewhere between 1.19.0 and 1.21.0.
@raphaelcohn Your amazing! After only a little playing it looks like you don't even need the patches
FROM frolvlad/alpine-glibc
RUN apk add --no-cache curl bash
RUN curl https://sh.rustup.rs -o rustup-init
RUN chmod +x rustup-init
RUN ./rustup-init --verbose -y --no-modify-path --default-toolchain nightly --default-host x86_64-unknown-linux-gnu
RUN rm rustup-init
ENV PATH=/root/.cargo/bin:"$PATH"
RUN rustup target add x86_64-unknown-linux-musl
RUN rustup update
RUN rustc -Vv
ENTRYPOINT ["rustc"]
However it does appear that if I try to compile anything with a C/C++ dep then it implodes on jemalloc. I will have to look into other solutions there.
Activity
japaric commentedon Apr 25, 2016
Building
rustup-init
forx86_64-unknown-linux-musl
is not going to be enough because there is norustc
component for that triple. I'm not aware of anyone that has built a workingrustc
for that triple. I have tried and managed to built arustc
but it always crashed in the LLVM phase when I tried to compile anything. Probably, LLVM needed more patching (I applied some of Alpine Linux patches) to work correctly with musl but I didn't investigate further.sagebind commentedon Apr 25, 2016
Alright then, my bad. This issue isn't really relevant to rustup then, so I'll close it.
Thanks anyway!
rustup run nightly cargo install
generates unexecutable executables #350palfrey commentedon Dec 29, 2016
Using https://github.com/emk/rust-musl-builder I've just built what appears to be a perfectly good
x86_64-unknown-linux-musl
rustup-init
(nothing fancy, just acargo build --release
). Is this problem now solvable or am I missing some other missing detail?sanmai-NL commentedon Mar 31, 2017
@palfrey, @japaric: Also wondering ...
japaric commentedon Apr 2, 2017
It's still not possible to build a rustc that works on musl distros like Alpine. PR rust-lang/rust#40113 is one of the requirements to build such rustc.
jirutka commentedon Apr 6, 2017
That’s not entirely correct. It is possible (see APKBUILD), I did it in August 2016 (with your help), but it requires cross-compiling rustc against musl on GNU-based system and applying some hacks.
It’d like to also note that there’s no problem with musl itself, just in Rust build system. 😿
mcandre commentedon Apr 11, 2017
Oy, the cargo package on alpine:edge fails to access the cargo index, due to linking against a broken libgit2... Could someone fix the Alpine rust & cargo packages plz
jirutka commentedon Apr 12, 2017
Rust and Cargo in Alpine testing are currently broken. We’ve updated Rust to the latest version, with better patches that allow both dynamic and static linking on Alpine. Initially it seemed that everything is okay, but then we found many breakages. Still hard working on it, fixing Rust build system…
corbinu commentedon Aug 27, 2017
Now that rust-lang/rust#40113 has closed can't this be reopened?
fzgregor commentedon Feb 14, 2018
@japaric WDYT?
japaric commentedon Feb 24, 2018
@fzgregor
The same thing as almost two years ago:
Is rust-lang/rust producing rustc binaries for x86_64-unknown-linux-musl? I'm no longer involved with infrastructure stuff so I don't know. Producing rustc binaries is a rust-lang/rust issue that the infra team is in charge of so you should ask them.
P.S. Also, I'm not a rustup developer so I can't reopen issues in this repo.
corbinu commentedon Feb 24, 2018
Thanks I will ping them then. This is super important for things like building rocket services into a docker container
jirutka commentedon Feb 25, 2018
No, they still do not. 😞 However, it is possible to build rustc on and for x86_64-unknown-linux-musl system with fully working both static and dynamic compilation, but it still requires some patches (see here). We in Alpine Linux do it since rust 1.17.0 (package rust). About half of the patches has been already upstreamed, somewhere between 1.19.0 and 1.21.0.
raphaelcohn commentedon Nov 2, 2018
@corbinu @japaric Not sure if this is helpful, but it is possible to run
rustup-init
on Alpine Linux if one builds (or installs)glibc
first and then usespatchelf
to adjust the rpath of the rust binaries. See this docket file for an example script https://github.com/libertine-linux/libertine/blob/master/dockers/libertine-build-environment/Dockerfile.I've got my fingers crossed that
mrustc
gets mature enough that I can bootstrap new Linux distros without this horrible chicken-and-egginess.corbinu commentedon Nov 2, 2018
@raphaelcohn Your amazing! After only a little playing it looks like you don't even need the patches
However it does appear that if I try to compile anything with a C/C++ dep then it implodes on jemalloc. I will have to look into other solutions there.
corbinu commentedon Nov 2, 2018
@raphaelcohn actually it looks like this may finally be coming anyway! rust-lang/rust#55163