Cannot compile in a dependency package needing an external library

My project depends on an external package, which in turn depends on an external for it binary library.

When I download the external package and library and build/test it as a project (passing to cargo "-Lexternal-library-path/"), it works. When I try to compile my project, the external package is downloaded but refuses to compile due to not finding the external library:

error: could not find native static library `<library name>`, perhaps an -L flag is missing?

error: could not compile `<external package name>` due to previous error

I downloaded the library separately and tried passing its path to cargo through -L:

env RUSTFLAGS="-Lexternal-library-path/" cargo build
cargo build -- "-Lexternal-library-path/"
env RUSTFLAGS="-Lexternal-library-path/" cargo build -- "-Lexternal-library-path/"

No go. Using cargo 1.65.0 on Debian GNU/Linux.

Any suggestions? Thanks in advance.

Rust projects generally don't use flags directly. External packages use wrapper crates called sys crates that set the flags from their build.rs.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.