SOLVED: Compiling rust with native static library


#1

I am trying to build SolidOak(https://github.com/oakes/SolidOak) 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?


#2

Hi neolem,

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

http://doc.crates.io/build-script.html

Regards,
Harris


#3

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:


#4

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


#5

@brakmic I have tried the following,

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

and

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

and

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.


#6

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


#7

@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.


#8

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

Thanks @brakmic @steveklabnik. :blush: