Skip to content
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

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

Open
jiabochao opened this issue May 9, 2021 · 3 comments

Comments

@jiabochao
Copy link

  • 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"] }
@Orycterope
Copy link
Contributor

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
Copy link

  • 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
Copy link
Owner

Hugal31 commented Jan 24, 2024

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.

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

4 participants