How to compile static binary with rustc?
On ubuntu I compile static binary using target `x86_64-unknown-linux-musl`. In alpine linux `x86_64-alpine-linux-musl` compiles a binary dynamically build with musl libc.
So either alternative stdlib package should be present for `x86_64-unknown-linux-musl` or perhaps there is any way to built static binary other way?
Talking about atlernative stdlib builds also wasm32-unknown-unknown is also very useful for me.
For the reference, I can’t use stock stdlib from rust-lang.org site, because rust thinks it’s a different version (even if it’s numerically the same):
error[E0514]: found crate `std` compiled by an incompatible version of rustc
|
= help: please recompile that crate using this compiler (rustc 1.22.1)
= note: crate `std` path #1: /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-827ddea93328ae2d.rlib compiled by "rustc 1.22.1 (05e2e1c41 2017-11-22)"
= note: crate `std` path #2: /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_unicode-0e1b544c94586415.rlib compiled by "rustc 1.22.1 (05e2e1c41 2017-11-22)"
(from redmine: issue id 8444, created on 2018-01-28, closed on 2019-05-03)