Skip to content

bug: rust ffmpeg crate fails to compile #36

@massivebird

Description

@massivebird

Man this shit sucks. I have vaapi.h-adjacent files from ffmpeg and some other package, but it's looking for the file(s) in /usr/include/, which doesn't even exist on my system.

Flake setup
  {
  description = "fallow: Jump King";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
        };
      in
        with pkgs;
      {
        # `nix develop`
        devShell = mkShell {
          buildInputs = [
            cargo
            ffmpeg.dev
            llvmPackages.libclang.lib
            openssl
            pkg-config
            rustc
          ];

          shellHook = ''
            export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
          '';
        };
      }
    );
}
Error message
  --- stderr
  Using stack size: Ok(3145728)
  In file included from /nix/store/cjmda5agi5ddwf4x43v7x20fm7p39047-glibc-2.40-66-dev/include/bits/libc-header-start.h:33,
                   from /nix/store/cjmda5agi5ddwf4x43v7x20fm7p39047-glibc-2.40-66-dev/include/stdio.h:28,
                   from check.c:2:
  /nix/store/cjmda5agi5ddwf4x43v7x20fm7p39047-glibc-2.40-66-dev/include/features.h:422:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
    422 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
        |    ^~~~~~~
  fatal error: '/usr/include/libavcodec/vaapi.h' file not found
  fatal error: '/usr/include/libavcodec/vaapi.h' file not found, err: true

  thread 'ffmpg-sys-build' panicked at /home/penguino/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ffmpeg-sys-4.3.3/build.rs:1279:10:
  Unable to generate bindings: ()
  stack backtrace:
     0: rust_begin_unwind
     1: core::panicking::panic_fmt
     2: core::result::unwrap_failed
     3: core::result::Result<T,E>::expect
     4: build_script_build::thread_main
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

  thread 'main' panicked at /home/penguino/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ffmpeg-sys-4.3.3/build.rs:629:10:
  called `Result::unwrap()` on an `Err` value: Any { .. }
  stack backtrace:
     0: rust_begin_unwind
     1: core::panicking::panic_fmt
     2: core::result::unwrap_failed
     3: build_script_build::main
     4: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnixNixOS or Nix package managerrustRelated to Rust or cargo

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions