yari icon indicating copy to clipboard operation
yari copied to clipboard

Cargo build error E0432 on Linux

Open albertzsigovits opened this issue 2 years ago • 3 comments

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

  • cargo update
  • cargo build
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

albertzsigovits avatar Nov 14 '22 13:11 albertzsigovits

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

MatejKastak avatar Nov 14 '22 13:11 MatejKastak

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

Did I miss some pre-req steps?

albertzsigovits avatar Feb 09 '23 11:02 albertzsigovits

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.

MatejKastak avatar Feb 21 '23 15:02 MatejKastak