---
# System prepended metadata

title: Cargo build/install with musl libc without dynamic link
tags: [Install]

---


> tag: rustup, cargo, install, x86_64-unknown-linux-musl, static

[Reference](https://users.rust-lang.org/t/is-cargo-build-target-x86-64-unknown-linux-musl-is-not-possible-anymore-with-rust-1-82/123584/2)

```shell
$ rustup target add x86_64-unknown-linux-musl

# add linker to the .cargo/config.toml
$ cat ~/.cargo/config.toml
[target.x86_64-unknown-linux-musl]
linker = "rust-lld"

$ cargo <install/build> --target x86_64-unknown-linux-musl
```