Hugal31 / yara-rust

Rust bindings for VirusTotal/Yara
Apache License 2.0
76 stars 29 forks source link

error: could not find native static library `yara`, perhaps an -L flag is missing? #26

Open jiabochao opened 3 years ago

jiabochao commented 3 years ago
Orycterope commented 3 years ago

If you want to link with your own yara static library, you need to specify the path where to find the libyara.a in $YARA_LIBRARY_PATH like documented in the yara-sys readme.

If you prefer to dynamically link against libyara.so at runtime, you must set LIBRARY_STATIC=0 (source)

You can also have cc automatically compile the lib at build time and static link it by using the vendored feature.

coalooball commented 8 months ago
  • error message
$ cargo build
   Compiling yara-sys v0.6.1
   Compiling yara v0.6.1
error: could not find native static library `yara`, perhaps an -L flag is missing?
  • Cargo.toml
[dependencies]
yara = "0.6.1"
yara-sys = { version = "0.6.1", features = ["bundled-4_1_0"] }

I also encounter this problem, and I fix this by doing

export YARA_LIBRARY_PATH=/usr/local/lib/
export YARA_INCLUDE_DIR=/usr/local/include/

before cargo r

Hugal31 commented 8 months ago

export YARA_LIBRARY_PATH=/usr/local/lib/ export YARA_INCLUDE_DIR=/usr/local/include/

It's weird, /usr/local is in the default path, it should be automatic.