zmwangx / rust-ffmpeg

Safe FFmpeg wrapper.
Do What The F*ck You Want To Public License
1.2k stars 195 forks source link

missing `libavutil.pc` build failure on windows #181

Closed anandijain closed 2 months ago

anandijain commented 2 months ago

I am on windows and I installed the full shared Gyan 6.1.1 build but I can't seem to find any .pc files included.

I tried following the build guide from https://github.com/zmwangx/rust-ffmpeg/wiki/Notes-on-building and have installed and added LLVM and ffmpeg to path.

I had the same problem with ffmpeg-the-third and would love to have any help in trying to get one of the ffmpeg binding libraries to run on my machine. Apologies if the question is naive, I don't know much about this windows version:

OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22631 N/A Build 22631

mwe (reproducible for me on windows):

cargo new ffmpegtest
cd ffmpegtest
cargo add ffmpeg-next 
cargo build

build failure log:

PS C:\Users\anand\.rust\ffmpegtest> cargo build
   Compiling windows_x86_64_msvc v0.52.5
   Compiling proc-macro2 v1.0.81
   Compiling glob v0.3.1
   Compiling libc v0.2.153
   Compiling unicode-ident v1.0.12
   Compiling minimal-lexical v0.2.1
   Compiling regex-syntax v0.8.3
   Compiling memchr v2.7.2
   Compiling either v1.11.0
   Compiling bindgen v0.69.4
   Compiling lazy_static v1.4.0
   Compiling rustc-hash v1.1.0
   Compiling itertools v0.12.1
   Compiling bitflags v2.5.0
   Compiling lazycell v1.3.0
   Compiling shlex v1.3.0
   Compiling num_cpus v1.16.0
   Compiling pkg-config v0.3.30
   Compiling vcpkg v0.2.15
   Compiling cc v1.0.95
   Compiling clang-sys v1.7.0
   Compiling nom v7.1.3
   Compiling windows-targets v0.52.5
   Compiling libloading v0.8.3
   Compiling ffmpeg-next v7.0.0
   Compiling regex-automata v0.4.6
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling cexpr v0.6.0
   Compiling regex v1.10.4
   Compiling ffmpeg-sys-next v7.0.0
error: failed to run custom build command for `ffmpeg-sys-next v7.0.0`

Caused by:
  process didn't exit successfully: `C:\Users\anand\.rust\ffmpegtest\target\debug\build\ffmpeg-sys-next-5838a61724cdf86c\build-script-build` (exit code: 101)
  --- stdout
  Could not find ffmpeg with vcpkg: Could not find library in Vcpkg tree package ffmpeg is not installed for vcpkg triplet x64-windows
  cargo:rerun-if-env-changed=LIBAVUTIL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at C:\Users\anand\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ffmpeg-sys-next-7.0.0\build.rs:740:14:
  called `Result::unwrap()` on an `Err` value:
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags libavutil

  The system library `libavutil` required by crate `ffmpeg-sys-next` was not found.
  The file `libavutil.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `libavutil.pc`.

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thanks!

anandijain commented 2 months ago

apologies for the spam. the solution is to just install ffmpeg with vcpkg.