zmwangx/rust-ffmpeg

x86_64-apple-darwin build release fail.

WangJiaJun8922 opened this issue · 0 comments

OS: macos m1 arch

ffmpeg: 5.1.2

Cargo.toml

[dependencies]
ffmpeg-sys-next = {version = "5.1.1", features = ["build"] }

When I compile with default arch, everything is ok.

but, when i use cargo build --target x86_64-apple-darwin -r, the following error occurred.

❯ RUST_BACKTRACE=1 cargo build --target x86_64-apple-darwin -r
   Compiling libc v0.2.139
   Compiling ffmpeg-sys-next v5.1.1
error: failed to run custom build command for `ffmpeg-sys-next v5.1.1`

Caused by:
  process didn't exit successfully: `/Users/ken/codes/rust_project/test_ffmpeg_build/target/release/build/ffmpeg-sys-next-a0f76561b91f47b9/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-search=native=/Users/ken/codes/rust_project/test_ffmpeg_build/target/x86_64-apple-darwin/release/build/ffmpeg-sys-next-c1a5b411dc83b78d/out/dist/lib
  cargo:rustc-link-lib=static=avcodec
  cargo:rustc-link-lib=static=avdevice
  cargo:rustc-link-lib=static=avfilter
  cargo:rustc-link-lib=static=avformat
  cargo:rustc-link-lib=static=avutil
  cargo:rustc-link-lib=static=swresample
  cargo:rustc-link-lib=static=swscale
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-apple-darwin")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_x86_64-apple-darwin
  CC_x86_64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_x86_64_apple_darwin
  CC_x86_64_apple_darwin = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  RUSTC_LINKER = None
  cargo:rerun-if-env-changed=CROSS_COMPILE
  CROSS_COMPILE = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-apple-darwin
  CFLAGS_x86_64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_apple_darwin
  CFLAGS_x86_64_apple_darwin = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2,sse3,ssse3")

  --- stderr
  Cloning into 'ffmpeg-5.1'...
  thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/ken/.cargo/registry/src/github.com-1ecc6299db9ec823/ffmpeg-sys-next-5.1.1/build.rs:211:46
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
     1: core::panicking::panic_fmt
               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
     2: core::panicking::panic
               at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:48:5
     3: core::option::Option<T>::unwrap
     4: build_script_build::build
     5: build_script_build::main
     6: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I want to compile 2 different arch on my macos m1, how can i fix that? please let me know.. thanks!!!