Hugal31 / yara-rust

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

Buiding on Windows fails to create symlinks #70

Closed daladim closed 2 years ago

daladim commented 2 years ago

Hello, building on Windows can fail with the following error:

> cargo build --target x86_64-pc-windows-msvc --release

...
error: failed to run custom build command for `yara-sys v0.10.0`

Caused by:
  process didn't exit successfully: `C:\Users\daladim\cargo_targets\release\build\yara-sys-e572de569afc4b9d\build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 1314, kind: Uncategorized, message: "A required privilege is not held by the client." }', C:\Users\daladim\.cargo\git\checkouts\yara-rust-e153bd97be5a0ab6\7378b3d\yara-sys\build.rs:76:48
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

That's due to symlink_dir not being available on Windows without admin rights.

Note: there's a workaround: enabling developer mode on Windows 10. But that also enables many other settings which are not secure, so that would be better to avoid needing them.