To avoid GLIBC errors, you can compile your own version of Rust against the static alternative libc, musl .
Get the latest stable version of musl and build it with the --disable-shared option:
$ mkdir musldist $ PREFIX=$(pwd)/musldist $ ./configure --disable-shared --prefix=$PREFIX
then create Rust against musl:
$ ./configure --target=x86_64-unknown-linux-musl --musl-root=$PREFIX --prefix=$PREFIX
then create your project
$ echo 'fn main() { println!("Hello, world!"); }' > main.rs $ rustc --target=x86_64-unknown-linux-musl main.rs $ ldd main not a dynamic executable
For more information, see the extended link section in the documentation.
As indicated in the source documentation:
However, you may need to recompile your native anti-muslin libraries before they can be linked.
You can also use rustup .
Remove the old rust installed by rustup.sh
$ sudo /usr/local/lib/rustlib/uninstall.sh # only if you have $ rm $HOME/.rustup
Install rustup
$ curl https://sh.rustup.rs -sSf | sh $ rustup default nightly #just for ubuntu 14.04 (stable Rust 1.11.0 has linking issue) $ rustup target add x86_64-unknown-linux-musl $ export PATH=$HOME/.cargo/bin:$PATH $ cargo new --bin hello && cd hello $ cargo run --target=x86_64-unknown-linux-musl $ ldd target/x86_64-unknown-linux-musl/debug/hello not a dynamic executable
etreus
source share