SOLVED: Compiling rust with native static library

I am trying to build SolidOak(GitHub - oakes/SolidOak: An IDE for Rust) but keep getting the error message below,

error: could not find native static library nvim, perhaps an -L flag is missing?
Could not compile neovim-rs.

Is there a way to pass the -L flag using cargo build. Is there a way to list the directories that Cargo looks for static libs?

Hi neolem,

Maybe a Build-Script for Cargo could help you in such situations?


Also, there's a possibility to run "cargo rustc" which allows you putting extra options/flags.

Here's an example from a reddit-thread with a similar question:

1 Like

This probably means you don't have the library installed.

@brakmic I have tried the following,

cargo rustc -- -l /usr/lib/x86_64-linux-gnu/libuv.a


cargo rustc -- -L /usr/lib/x86_64-linux-gnu/


cargo rustc --verbose -- -L dependency=/usr/lib/x86_64-linux-gnu/

None of these command seems to help. rustc still doesn't look for the static lib in the given path.

I suppose I could, but the crate that I am trying to build is an external one.

@steveklabnik I even copied the static libs in the usual system folders /usr/lib but alas rustc is not picking it up. Calling cargo build with --verbose lists the -L paths used but I am unable to see /usr/lib listed. -L option doesn't seem to work too.

I changed rustc to stable, it is building okay now. I was getting the above errors on nightly.

Thanks @brakmic @steveklabnik. :blush:

1 Like