Hugal31 / yara-rust

Rust bindings for VirusTotal/Yara
Apache License 2.0
77 stars 28 forks source link

Build failed on macos #40

Closed bigdogs closed 3 years ago

bigdogs commented 3 years ago

hi,

with "vendored" feature enabled, I got the following build error on Macos

/Users/../.cargo/bin/cargo build --color=always --message-format=json-diagnostic-rendered-ansi --package .. --bin... Compiling yara-sys v0.8.0 error: failed to run custom build command for yara-sys v0.8.0 Caused by: process didn't exit successfully: /Users/../working/../target/debug/build/yara-sys-040eb9438488a67e/build-script-build (signal: 6, SIGABRT: process abort signal) --- stderr WARNING: /Users/../working/../target/debug/build/yara-sys-040eb9438488a67e/build-script-build is loading libcrypto in an unsafe way Process finished with exit code 101

bigdogs commented 3 years ago

BTW, it also compile error on windows with "vendored" feature, which requires privilege permission to make symbol link works

image

thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 1314, kind: Other, message: "A required privilege is not held by the client." }', C:\Users\Admin.cargo\registry\src\github.com-1ecc6299db9ec823\yara-sys-0.8.0\build.rs:33:48 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\std\src\panicking.rs:493 1: core::panicking::panic_fmt at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\panicking.rs:92 2: core::option::expect_none_failed at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53\/library\core\src\option.rs:1329 3: core::result::Result<tuple<>, std::io::error::Error>::unwrap<tuple<>,std::io::error::Error>

Hugal31 commented 3 years ago

We recently added compilation with libcrypto. Try to set the environment variable YARA_ENABLE_CRYPTO=0 to disable it on MacOS, or don't use the vendored feature and install / build libyara by other means.

On Windows, this is strange. I'll look into it.

ikrivosheev commented 3 years ago

I'll see what's wrong on the mac and add a test to GitHub actions.

ikrivosheev commented 3 years ago

@bigdogs can you run build with --verbose on MacOs and paste here output?

bigdogs commented 3 years ago

@bigdogs can you run build with --verbose on MacOs and paste here output? cargo --verbose build gives same output info with previous :( Caused by: process didn't exit successfully: /Users/../yarars/target/debug/build/yara-sys-d1f0356c19548844/build-script-build (signal: 6, SIGABRT: process abort signal) --- stderr WARNING: /Users/../yarars/target/debug/build/yara-sys-d1f0356c19548844/build-script-build is loading libcrypto in an unsafe way

But set YARA_ENABLE_CRYPTO=0 works on MacOS, seems it was caused by "openssl" not installed

ikrivosheev commented 3 years ago

@bigdogs I meant to attach a full build log

bigdogs commented 3 years ago

@ikrivosheev , Full build log still seemed no useful information, But I think this issue can be easily reproduced in an "new" MacOs env with feature "vendored" enabled ruster % cargo build --verbose Fresh cfg-if v1.0.0 Fresh regex-syntax v0.6.25 Fresh unicode-xid v0.2.2 Fresh version_check v0.9.3 Fresh glob v0.3.0 Fresh lazy_static v1.4.0 Fresh unicode-width v0.1.8 Fresh same-file v1.0.6 Fresh fnv v1.0.7 Fresh once_cell v1.8.0 Fresh ansi_term v0.11.0 Fresh humantime v2.1.0 Fresh termcolor v1.1.2 Fresh vec_map v0.8.2 Fresh strsim v0.8.0 Fresh rustc-hash v1.1.0 Fresh peeking_take_while v0.1.2 Fresh shlex v1.0.0 Fresh lazycell v1.3.0 Fresh cc v1.0.69 Fresh textwrap v0.11.0 Fresh libloading v0.7.0 Fresh thread_local v1.1.3 Fresh walkdir v2.3.2 Fresh memchr v2.4.0 Fresh libc v0.2.98 Fresh proc-macro2 v1.0.28 Fresh log v0.4.14 Fresh bitflags v1.2.1 Fresh crossbeam-utils v0.8.5 Fresh aho-corasick v0.7.18 Fresh quote v1.0.9 Fresh bstr v0.2.16 Fresh atty v0.2.14 Fresh nom v5.1.2 Fresh which v3.1.1 Fresh clang-sys v1.2.0 Fresh regex v1.5.4 Fresh cexpr v0.4.0 Fresh clap v2.33.3 Fresh syn v1.0.74 Fresh globset v0.4.8 Fresh env_logger v0.8.4 Fresh thiserror-impl v1.0.26 Fresh ignore v0.4.18 Fresh bindgen v0.58.1 Fresh thiserror v1.0.26 Fresh globwalk v0.8.1 Compiling yara-sys v0.8.0 Running /Users/../Desktop/ruster/target/debug/build/yara-sys-040eb9438488a67e/build-script-build error: failed to run custom build command for yara-sys v0.8.0

Caused by: process didn't exit successfully: /Users/../Desktop/ruster/target/debug/build/yara-sys-040eb9438488a67e/build-script-build (signal: 6, SIGABRT: process abort signal) --- stderr WARNING: /Users/../Desktop/ruster/target/debug/build/yara-sys-040eb9438488a67e/build-script-build is loading libcrypto in an unsafe way

ikrivosheev commented 3 years ago

@ikrivosheev , Full build log still seemed no useful information, But I think this issue can be easily reproduced in an "new" MacOs env with feature "vendored" enabled ruster % cargo build --verbose Fresh cfg-if v1.0.0 Fresh regex-syntax v0.6.25 Fresh unicode-xid v0.2.2 Fresh version_check v0.9.3 Fresh glob v0.3.0 Fresh lazy_static v1.4.0 Fresh unicode-width v0.1.8 Fresh same-file v1.0.6 Fresh fnv v1.0.7 Fresh once_cell v1.8.0 Fresh ansi_term v0.11.0 Fresh humantime v2.1.0 Fresh termcolor v1.1.2 Fresh vec_map v0.8.2 Fresh strsim v0.8.0 Fresh rustc-hash v1.1.0 Fresh peeking_take_while v0.1.2 Fresh shlex v1.0.0 Fresh lazycell v1.3.0 Fresh cc v1.0.69 Fresh textwrap v0.11.0 Fresh libloading v0.7.0 Fresh thread_local v1.1.3 Fresh walkdir v2.3.2 Fresh memchr v2.4.0 Fresh libc v0.2.98 Fresh proc-macro2 v1.0.28 Fresh log v0.4.14 Fresh bitflags v1.2.1 Fresh crossbeam-utils v0.8.5 Fresh aho-corasick v0.7.18 Fresh quote v1.0.9 Fresh bstr v0.2.16 Fresh atty v0.2.14 Fresh nom v5.1.2 Fresh which v3.1.1 Fresh clang-sys v1.2.0 Fresh regex v1.5.4 Fresh cexpr v0.4.0 Fresh clap v2.33.3 Fresh syn v1.0.74 Fresh globset v0.4.8 Fresh env_logger v0.8.4 Fresh thiserror-impl v1.0.26 Fresh ignore v0.4.18 Fresh bindgen v0.58.1 Fresh thiserror v1.0.26 Fresh globwalk v0.8.1 Compiling yara-sys v0.8.0 Running /Users/../Desktop/ruster/target/debug/build/yara-sys-040eb9438488a67e/build-script-build error: failed to run custom build command for yara-sys v0.8.0

Caused by: process didn't exit successfully: /Users/../Desktop/ruster/target/debug/build/yara-sys-040eb9438488a67e/build-script-build (signal: 6, SIGABRT: process abort signal) --- stderr WARNING: /Users/../Desktop/ruster/target/debug/build/yara-sys-040eb9438488a67e/build-script-build is loading libcrypto in an unsafe way

Hello, I found the problem and create PR.