Skip to content

error: could not find native static library c, perhaps an -L flag is missing? #70

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

Closed
mkb2091 opened this issue Jun 30, 2021 · 3 comments

Comments

@mkb2091
Copy link

mkb2091 commented Jun 30, 2021

Tried compiling empty project and it failed with the error

Compiling compiler_builtins v0.1.46
   Compiling core v0.0.0 (/home/mkb/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.93
   Compiling cc v1.0.68
   Compiling std v0.0.0 (/home/mkb/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/src/rust/library/std)
   Compiling unwind v0.0.0 (/home/mkb/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/src/rust/library/unwind)
   Compiling rustc-std-workspace-core v1.99.0 (/home/mkb/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/src/rust/library/rustc-std-workspace-core)
error: could not find native static library `c`, perhaps an -L flag is missing?

   Compiling alloc v0.0.0 (/home/mkb/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/src/rust/library/alloc)
error: aborting due to previous error

error: could not compile `libc`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

cargo version: cargo 1.55.0-nightly (9233aa06c 2021-06-22)
system: Void Linux with musl and libc

command to reproduce

cargo new --bin project && cd project
cargo +nightly build --release -Z build-std=std --target=x86_64-unknown-linux-musl

But I tested instead creating a project with libc as a dependency and compiled as normal cargo +nightly build --release and it builds fine, so libc isn't the entire problem

@mkb2091
Copy link
Author

mkb2091 commented Jun 30, 2021

duplicate of #66, hadn't spotted that also covered same error on musl system

@mkb2091 mkb2091 closed this as completed Jun 30, 2021
@12101111
Copy link

12101111 commented Jul 5, 2021

worksround: export RUSTFLAGS="-Lnative=/usr/lib"

@mkb2091
Copy link
Author

mkb2091 commented Jul 5, 2021

Yeah that workaround works for me, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants