avast / yari

YARI is an interactive debugger for YARA Language.
https://avast.github.io/yls/
MIT License
86 stars 9 forks source link

Cargo build error E0432 on Linux #16

Open albertzsigovits opened 1 year ago

albertzsigovits commented 1 year ago

When compiling under Linux, I get the following error message:

error[E0432]: unresolved import `crate::bindings::yr_modules_do_load`
  --> yari-sys/src/lib.rs:23:5
   |
23 | use crate::bindings::yr_modules_do_load;
   |     ^^^^^^^^^^^^^^^^^------------------
   |     |                |
   |     |                help: a similar name exists in the module: `yr_modules_load`
   |     no `yr_modules_do_load` in `bindings`

error[E0432]: unresolved import `crate::bindings::yr_modules_do_unload`
  --> yari-sys/src/lib.rs:24:5
   |
24 | use crate::bindings::yr_modules_do_unload;
   |     ^^^^^^^^^^^^^^^^^--------------------
   |     |                |
   |     |                help: a similar name exists in the module: `yr_modules_load`
   |     no `yr_modules_do_unload` in `bindings`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `yari-sys` due to 2 previous errors

rustc --explain E0432: An import was unresolved.

uname -a: Linux Host 5.10.102.1-microsoft-standard-WSL2 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a: Ubuntu 20.04.5 LTS

MatejKastak commented 1 year ago

Hi Albert! Thanks for the report.

Currently we are building against a slightly modified libyara in this repository. This approach is subject to change, as I would like to integrate this small patch directly into YARA ustream so we don't have to worry about those symbols.

To diagnose your issue further, can you checkout the following commands:

λ ls -lah ./yari-sys/yara/libyara/.libs/libyara.a
Permissions Size User         Date Modified Name
.rw-rw-r--  4.3M matej.kastak  2 Oct 17:04   ./yari-sys/yara/libyara/.libs/libyara.a

λ nm ./yari-sys/yara/libyara/.libs/libyara.a | grep yr_modules_do_load
00000000000001e0 T yr_modules_do_load

λ cd yari-sys/yara && git status
HEAD detached at 38298ca7
nothing to commit, working tree clean
albertzsigovits commented 1 year ago

Sorry this took so long, just noticed this reply. My yari-sys/yara/ folder is completely empty.

Did I miss some pre-req steps?

MatejKastak commented 1 year ago

It's interesting that it is empty, from the first message it seems that you have upstream yara version installed.

The empty yari-sys/yara dir is because yari uses YARA as a submodule. You will need to clone it with --recursive flag.

If you don't want to clone it again something like this should help: git submodule init && git submodule sync && git submodule update.

There were many changes in YARI since you first opened the issue, before you try anything please update to the latest master commit.

I have prepared instructions how to run it locally for inspiration. Hope it helps.