rust-ffmpeg icon indicating copy to clipboard operation
rust-ffmpeg copied to clipboard

error: failed to run custom build command for `ffmpeg-sys-next v6.0.1`

Open OktoberfestTheEnthusiast opened this issue 1 year ago • 6 comments

I'm trying to build a cargo with RUST but I always seem to get this error upon installing these ffmpeg crates

**error: failed to run custom build command for ffmpeg-sys-next v6.0.1

Caused by: process didn't exit successfully: G:\Documents\ghwt-de-volatile-master\rust-ffmpeg\target\debug\build\ffmpeg-sys-next-633df82b3238d16e\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 'called Result::unwrap() on an Err value: "pkg-config" "--libs" "--cflags" "libavutil" did not exit successfully: exit code: 1 error: could not find system library 'libavutil' required by the 'ffmpeg-sys-next' crate

--- stderr Package libavutil was not found in the pkg-config search path. Perhaps you should add the directory containing libavutil.pc' to the PKG_CONFIG_PATH environment variable No package 'libavutil' found ', C:\Users\Diego\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ffmpeg-sys-next-6.0.1\build.rs:715:14 note: run with RUST_BACKTRACE=1` environment variable to display a backtrace**

Can anybody help me with this issue? Thank you!

I had the same with libavfilter and libavdevice, turns out ffmpeg-sys-next 6.0.1 needs both of them, so the necessary packages to install are (excerpt from my devcontainer's Dockerfile):

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y install --no-install-recommends \
    clang \
    libavcodec-dev \
    libavdevice-dev \
    libavfilter-dev \
    libavformat-dev \
    libavutil-dev \
    pkg-config

kgeri avatar Apr 01 '23 08:04 kgeri

I am also having the same problem, did you solve it ?

coderLanlan avatar Apr 17 '23 08:04 coderLanlan

Hi, how to fix it in Windows?

Fitrad3w avatar May 17 '23 14:05 Fitrad3w

try this: vcpkg install ffmpeg:x64-windows

openersoft avatar Jul 20 '23 09:07 openersoft

I managed to fix it after 7 hours of work. What I did was using the GNU build guide found in the build wiki of this repo. Afterwards I: installed vcpkg ran vcpkg integrate install ran: vcpkg install ffmpeg[core,avcodec,avformat,swscale,avdevice,avfilter] --triplet x64-windows --recurse The avdevice component includes libavdevice, and the avfilter component includes libavfilter.

You should than get this error: usr/include/libswresample/swresample.h is missing error (or something along these lines, it will appear at the bottom of the screen) the file is located in this path (if you used the default download location for vcpkg) : C:\Users\USERNAME\vcpkg\buildtrees\ffmpeg\src\n5.1.2-f31542651f.clean (libswresample will be one of the folders in here) move it over to: C:\Users\USERNAME\vcpkg\installed\x64-windows\include

run cargo build again and it should work just fine.

GioGioWasTaken avatar Jul 28 '23 10:07 GioGioWasTaken

#160 is a duplicate. I tried to answer there

Coddeus avatar Sep 16 '23 12:09 Coddeus