zmwangx / rust-ffmpeg-sys

FFmpeg bindings for Rust.
125 stars 86 forks source link

FreeBSD Compilation errored by pkg-config #40

Open jaw-sh opened 2 years ago

jaw-sh commented 2 years ago
# cargo test
   Compiling ring v0.16.20
   Compiling rustls v0.20.6
   Compiling zstd-safe v4.1.6+zstd.1.5.2
   Compiling zstd-sys v1.6.3+zstd.1.5.2
   Compiling blake3 v1.3.1
   Compiling ffmpeg-sys-next v5.0.1
error: failed to run custom build command for `ffmpeg-sys-next v5.0.1`

Caused by:
  process didn't exit successfully: `/usr/local/ruforo/target/debug/build/ffmpeg-sys-next-b8cd01aafd053925/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBAVUTIL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-freebsd
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_freebsd
  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-unknown-freebsd
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_freebsd
  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-unknown-freebsd
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_freebsd
  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-unknown-freebsd
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_freebsd
  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: Could not run `"pkg-config" "--libs" "--cflags" "libavutil"`
  The pkg-config command could not be found.

  Most likely, you need to install a pkg-config package for your OS.
  Try `apt install pkg-config`, or `yum install pkg-config`,
  or `pkg install pkg-config` depending on your distribution.

  If you've already installed it, ensure the pkg-config command is one of the
  directories in the PATH environment variable.

  If you did not expect this build to link to a pre-installed system library,
  then check documentation of the ffmpeg-sys-next crate for an option to
  build the library from source, or disable features or dependencies
  that require pkg-config.', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-sys-next-5.0.1/build.rs:711:14
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The issue is that pkg-config has not existed in BSD for supposedly 10 years. The work around is here: https://forums.freebsd.org/threads/port-pkg-config-deleted-no-alternative.65273/

I'm not sure if this can be dealt with by the crate, but it would be nice if it could.

jaw-sh commented 2 years ago

After posting this, the compilation halted much later.

error[E0432]: unresolved imports `libc::ENODATA`, `libc::ENOSR`, `libc::ENOSTR`, `libc::ETIME`
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-next-5.0.3/src/util/error.rs:20:22
   |
20 |     ENFILE, ENOBUFS, ENODATA, ENODEV, ENOENT, ENOEXEC, ENOLCK, ENOLINK, ENOMEM, ENOMSG,
   |                      ^^^^^^^ no `ENODATA` in the root
21 |     ENOPROTOOPT, ENOSPC, ENOSR, ENOSTR, ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTRECOVERABLE,
   |                          ^^^^^  ^^^^^^ no `ENOSTR` in the root
   |                          |
   |                          no `ENOSR` in the root
22 |     ENOTSOCK, ENOTSUP, ENOTTY, ENXIO, EOPNOTSUPP, EOVERFLOW, EOWNERDEAD, EPERM, EPIPE, EPROTO,
23 |     EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, ESRCH, ETIME, ETIMEDOUT, ETXTBSY,
   |                                                                ^^^^^ no `ETIME` in the root
   |
help: a similar name exists in the module
   |
21 |     ENOPROTOOPT, ENOSPC, ENOSR, NOSTR, ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTRECOVERABLE,
   |                                 ~~~~~
help: a similar name exists in the module
   |
23 |     EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, ESRCH, VTIME, ETIMEDOUT, ETXTBSY,
   |                                                                ~~~~~

For more information about this error, try `rustc --explain E0432`.
error: could not compile `ffmpeg-next` due to previous error