I successfully created a musl
configured rustc
by following this link
My attempt to build a project (which builds fine using non-musl configured rust) failed when I used cargo rustc -- --target=x86_64-unknown-linux-musl
'error: could not find crate `libc` with expected target triple x86_64-unknown-linux-musl'
Then, I tried to create rust-libc
library using the code from crate. To be more accurate, I used the command provided by cargo
to build rust-libc
, I've only added --target=x86_64-unknown-linux-musl
to the command. This time it failed reporting:
'error: could not find native static library `c`, perhaps an -L flag is missing?`'
I have two questions:
Is it mandatory to build musl
configured cargo
to be able to use cargo build --target=x86_64-unknown-linux-musl
?
How can I address this:
'error: could not find native static library `c`, perhaps an -L flag is missing?'
This worked for me to build libc:
rustc --target=x86_64-unknown-linux-musl /address-of-libc/lib.rs --crate-name libc --crate-type lib -L /address-of-musldist/musldist/lib/ --out-dir=/your-chosen-address/target --cfg feature=\"default\" --cfg feature=\"cargo-build\" --emit=dep-info,link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With