-
Notifications
You must be signed in to change notification settings - Fork 95
Add musl-dev to alpine images #68
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
Comments
The official alpine images tend to be as small as possible - take go's for example: https://hub.docker.com/_/golang which doesn't even include gcc. |
What's the point of including gcc when there are not even std headers? Is it a common scenario to compile |
rustc uses gcc as its linker. |
Ok, got it. I guess |
Why is that not default in the rust-alpine container preinstalled? |
Given the discussion at rust-lang/compiler-team#422 Should that change land, the user will fail to build a simple "hello world" program when dynamic linking becomes default with musl targets. They'd either need to know to specify Documenting that on DockerHub would be the better route if the alpine image is meant to prioritize size over UX (less of an issue until the image toolchain defaults to dynamic linking), but only if the size increase was notable..
|
@mamins1376 I agree with @polarathene here. Having images that are currently pretty useless at compiling any modern Rust project in order to save 1.33% on a build image seems highly awkward. Let's say Rust does enable dynamic linking on musl? So what, we save 1.33% overhead in that case? And if you want to compile static (which is a huge gain if you want to deploy using scratch/distroless) then you'll still get value out of this anyway. I don't understand the merit here. The Alpine image to isn't supposed to prioritize size. It's supposed to prioritize building for the musl target which right now is static. And lastly, let's take assume we want Alpine to prioritize size, can't we take the interest in this issue as evidence that people want another target for rust to prioritize static compilation? Speak for my own use case, I just want to build for a scratch image. Also worth pointing out that docs and man pages aren't pruned in the image... $ podman run docker.io/rustlang/rust:nightly-alpine /bin/sh -c "du -hs /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-musl/share/doc /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-musl/share/man"
488.0K /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-musl/share/man
12.8M /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-musl/share/doc That alone would save 13.2MB, which is comically more than the size of |
Currently when building something that involves compiling C (
bat
as an example), at the linking stage the following happens, due to missing/usr/lib/crti.o
:This can be eliminated simply by adding
musl-dev
after RUN apk add ....The text was updated successfully, but these errors were encountered: