master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.51k stars 155 forks source link

Build fails "Couldn't find NASM, make sure NASM installed" #415

Closed CallumWatkins closed 2 years ago

CallumWatkins commented 2 years ago

I am trying to install Av1an with a clean installation of Rust/Cargo. Does anyone know how I can resolve this issue? I'm not familiar with 'NASM' or how I would acquire it. Thanks.

> cargo install av1an
    Updating crates.io index
  Installing av1an v0.2.0
   Compiling autocfg v1.0.1
   Compiling proc-macro2 v1.0.32
   Compiling libc v0.2.107
   Compiling unicode-xid v0.2.2
   Compiling winapi v0.3.9
   Compiling syn v1.0.81
   Compiling memchr v2.4.1
   Compiling jobserver v0.1.24
   Compiling version_check v0.9.3
   Compiling cfg-if v1.0.0
   Compiling crossbeam-utils v0.8.5
   Compiling lazy_static v1.4.0
   Compiling crossbeam-epoch v0.9.5
   Compiling bitflags v1.3.2
   Compiling log v0.4.14
   Compiling rayon-core v1.9.1
   Compiling regex-syntax v0.6.25
   Compiling pkg-config v0.3.22
   Compiling vcpkg v0.2.15
   Compiling rustversion v1.0.5
   Compiling semver v1.0.4
   Compiling glob v0.3.0
   Compiling scopeguard v1.1.0
   Compiling tinyvec_macros v0.1.0
   Compiling ryu v1.0.5
   Compiling serde_derive v1.0.130
   Compiling either v1.6.1
   Compiling anyhow v1.0.45
   Compiling bindgen v0.54.0
   Compiling matches v0.1.9
   Compiling cfg-if v0.1.10
   Compiling rustc-hash v1.1.0
   Compiling serde v1.0.130
   Compiling lazycell v1.3.0
   Compiling shlex v0.1.1
   Compiling peeking_take_while v0.1.2
   Compiling unicode-bidi v0.3.7
   Compiling unicode-segmentation v1.8.0
   Compiling ntapi v0.3.6
   Compiling unicode-width v0.1.9
   Compiling percent-encoding v2.1.0
   Compiling radium v0.5.3
   Compiling once_cell v1.8.0
   Compiling adler v1.0.2
   Compiling bytes v1.1.0
   Compiling rust_hawktracer_proc_macro v0.4.1
   Compiling rust_hawktracer_normal_macro v0.4.1
   Compiling itoa v0.4.8
   Compiling failure_derive v0.1.8
   Compiling gimli v0.26.1
   Compiling lexical-core v0.7.6
   Compiling rustc-demangle v0.1.21
   Compiling wyz v0.2.0
   Compiling strsim v0.8.0
   Compiling static_assertions v1.1.0
   Compiling arrayvec v0.5.2
   Compiling vec_map v0.8.2
   Compiling noop_proc_macro v0.3.0
   Compiling byte-slice-cast v1.2.0
   Compiling vapoursynth-sys v0.3.0
   Compiling funty v1.1.0
   Compiling serde_json v1.0.71
   Compiling tap v1.0.1
   Compiling paste v1.0.6
   Compiling bitstream-io v1.2.0
   Compiling ffmpeg-next v4.4.0
   Compiling plotters-backend v0.3.2
   Compiling sysinfo v0.20.5
   Compiling arrayvec v0.7.2
   Compiling encode_unicode v0.3.6
   Compiling y4m v0.7.0
   Compiling std_prelude v0.2.12
   Compiling number_prefix v0.4.0
   Compiling smawk v0.3.1
   Compiling pin-project-lite v0.2.7
   Compiling strsim v0.10.0
   Compiling splines v4.0.3
   Compiling shlex v1.1.0
   Compiling tinyvec v1.5.1
   Compiling cc v1.0.72
   Compiling itertools v0.10.1
   Compiling textwrap v0.11.0
   Compiling form_urlencoded v1.0.1
   Compiling time v0.3.5
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling nom v5.1.2
   Compiling nom v6.1.2
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling memoffset v0.6.4
   Compiling rayon v1.5.1
   Compiling num-bigint v0.3.3
   Compiling miniz_oxide v0.4.4
   Compiling num-rational v0.3.2
   Compiling tokio v1.14.0
   Compiling heck v0.3.3
   Compiling rust_hawktracer v0.7.0
   Compiling clang-sys v0.29.3
   Compiling plotters-svg v0.3.1
   Compiling num_cpus v1.13.0
   Compiling which v4.2.2
   Compiling rustc_version v0.4.0
   Compiling crossbeam-channel v0.5.1
   Compiling bitvec v0.19.5
   Compiling aho-corasick v0.7.18
   Compiling object v0.27.1
   Compiling quote v1.0.10
   Compiling unicode-normalization v0.1.19
   Compiling err-derive v0.2.4
   Compiling crossbeam-deque v0.8.1
   Compiling simd_helpers v0.1.0
   Compiling regex v1.5.4
   Compiling libloading v0.5.2
   Compiling libz-sys v1.1.3
   Compiling libgit2-sys v0.12.25+1.3.0
   Compiling backtrace v0.3.63
   Compiling plotters v0.3.1
   Compiling idna v0.2.3
   Compiling addr2line v0.17.0
   Compiling stfu8 v0.2.4
   Compiling url v2.2.2
   Compiling cexpr v0.4.0
   Compiling unicode-linebreak v0.1.2
   Compiling nasm-rs v0.2.1
   Compiling synstructure v0.12.6
   Compiling atty v0.2.14
   Compiling terminal_size v0.1.17
   Compiling miow v0.3.7
   Compiling time v0.1.44
   Compiling ansi_term v0.12.1
   Compiling ctrlc v3.2.1
   Compiling clap v2.33.3
   Compiling console v0.15.0
   Compiling textwrap v0.14.2
   Compiling chrono v0.4.19
   Compiling indicatif v0.17.0-beta.1
   Compiling thiserror-impl v1.0.30
   Compiling num-derive v0.3.3
   Compiling enum-iterator-derive v0.7.0
   Compiling arg_enum_proc_macro v0.3.2
   Compiling getset v0.1.1
   Compiling strum_macros v0.22.0
   Compiling structopt-derive v0.4.18
   Compiling enum-iterator v0.7.0
   Compiling av-bitstream v0.1.2
   Compiling failure v0.1.8
   Compiling vapoursynth v0.3.0
   Compiling vergen v3.2.0
   Compiling vergen v5.1.17
   Compiling mio v0.7.14
   Compiling v_frame v0.2.5
   Compiling git2 v0.13.24
   Compiling thiserror v1.0.30
   Compiling structopt v0.3.25
   Compiling strum v0.22.0
   Compiling av-data v0.3.0
   Compiling flexi_logger v0.19.6
   Compiling rav1e v0.5.0
   Compiling av-format v0.3.1
   Compiling av-ivf v0.2.2
error: failed to run custom build command for `rav1e v0.5.0`

Caused by:
  process didn't exit successfully: `C:\Users\Callum\AppData\Local\Temp\cargo-installyMHG9t\release\build\rav1e-e10507cab768161a\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=nasm_x86_64

  --- stderr
  thread 'main' panicked at 'Couldn't find NASM, make sure NASM installed and in PATH or disable "asm" feature', C:\Users\Callum\.cargo\registry\src\github.com-1ecc6299db9ec823\rav1e-0.5.0\build.rs:296:7
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `av1an v0.2.0`, intermediate artifacts can be found at `C:\Users\Callum\AppData\Local\Temp\cargo-installyMHG9t`

Caused by:
  build failed
redzic commented 2 years ago

@CallumWatkins NASM refers to the "Netwide Assembler", which is required for some functions that are hand-written in assembly.

Since you're on Windows, you can download NASM from here: https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/

Make sure that once installed, it is in your PATH and that nasm --version outputs the version successfully in the command line.

CallumWatkins commented 2 years ago

Thank you for the quick response. That seems to work, although now after painfully installing pkg-config to resolve another error I am running into #390. Trying to download the binaries from GitHub as you suggested in that thread gives me "Failed - Virus Detected" so it seems it's just not meant to be. Should I just wait until #390 is fixed?

redzic commented 2 years ago

There is nothing malicious in the binary on the GitHub release page, but Windows tends to be a bit overzealous when it comes to its virus detection for binaries.

390 is not a blocker for compiling on Windows, otherwise it wouldn't have been possible to compile the binary on the GitHub release page. Basically, you have to install ffmpeg via vcpkg on Windows for it to work.

CallumWatkins commented 2 years ago

Oh absolutely, I'll give the download a go again differently. I'm not in too much of a hurry to get this installed though, so if you think that the ffmpeg issue is something that will be streamlined fairly soon then I don't mind waiting. What do you think?

redzic commented 2 years ago

The binary on the GitHub release page at this point is slightly outdated, so it's your call on what to do. The fix for the ffmpeg issue on Windows would basically just involve writing documentation for how to compile it which I will get around to at some point. Perhaps we will not zip the binary for the next release as that seems to be the source of all the issues regarding false positives about virus detection.

The only thing that needs fixing beyond writing documentation is compiling with the ffmpeg_static feature enabled on Windows (which statically links ffmpeg), as it is extremely difficult and requires manually patching ffmpeg-sys-next and a lot of other stuff, which will have to be upstreamed. ffmpeg_static is not enabled by default, so this shouldn't be an issue if you're compiling for local use.

CallumWatkins commented 2 years ago

That makes sense; I'll consider my options with all that in mind.

I appreciate the help.