imager-io / ffmpeg-dev-rs

Rust - Self Contained FFmpeg Bindings
https://crates.io/crates/ffmpeg-dev
MIT License
52 stars 13 forks source link

how to resolve build error: unknown type name '*' #5

Open piaoger opened 4 years ago

piaoger commented 4 years ago

Hi, I got build error: unknown type name '*' when trying to build this crate:

LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config cargo run --release --example h264_video_dec

--- stderr

--- stderr /w/imager-io/ffmpeg-dev-rs/target/release/build/ffmpeg-dev-81b52e898a9ea16c/out/FFmpeg-FFmpeg-2722fc2/libavutil/buffer_internal.h:44:5: error: unknown type name 'atomic_uint' /w/imager-io/ffmpeg-dev-rs/target/release/build/ffmpeg-dev-81b52e898a9ea16c/out/FFmpeg-FFmpeg-2722fc2/libavutil/buffer_internal.h:89:5: error: unknown type name 'atomic_uint' /w/imager-io/ffmpeg-dev-rs/target/release/build/ffmpeg-dev-81b52e898a9ea16c/out/FFmpeg-FFmpeg-2722fc2/libavcodec/error_resilience.h:64:5: error: unknown type name 'atomic_int' ...

colbyn commented 4 years ago

Ahh, first I don't think the LLVM_CONFIG_PATH path is a necessity (it's from a dependency called rust-bindgen), but perhaps I'm wrong (I've built this before without setting it).

Anyway in all honesty, this is a very strange error. Can you give me the full output instead of a summary? That may give me better context.

Also what is your OS?

But from what I gather, this definitely looks like an FFmpeg build issue. I wonder, this crate is supposed to be self contained, but perhaps this is still linking against some system dependency somehow (maybe the ffmpeg config flag --disable-autodetect isn't enough), and/or perhaps it's due to some untested linux distribution.

Oh, I noticed you had the --release flag set. Does this work in dev/debug mode? I.e. cargo run --example h264_video_dec, instead of cargo run --release --example h264_video_dec.

Another possibility I think, on my Mac I've built this using clang, and on Linux I'm pretty sure I've always used llvm/clang (e.g. here is a Dockerfile that builds this crate as a dependency). Maybe this is a bug in some codepath trigged by GCC. Do you have clang installed and available on your path?

Update: also just to be safe, when testing the GCC idea, rm -rf your build output dir, usually called target.

piaoger commented 4 years ago

I am using macOS Mojave and running in debug mode does not help. I also tried to build the example on my Ubuntu 16.04 and got same error.

Below are more information, including clang version, llvm version and error details. Hope they are helpful for locating the reason :)

active toolchain
----------------
stable-x86_64-apple-darwin (default)
rustc 1.40.0 (73528e339 2019-12-16)
piaoger:ffmpeg-dev-rs piaoger$ /usr/local/opt/llvm/bin/llvm-config --version
8.0.0

piaoger$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
piaoger$ cargo run --example h264_video_dec
   Compiling ffmpeg-dev v0.3.8 (/w/imager-io/ffmpeg-dev-rs)
error: failed to run custom build command for `ffmpeg-dev v0.3.8 (/w/imager-io/ffmpeg-dev-rs)`

Caused by:
  process didn't exit successfully: `/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-5a16a3d1babc6a34/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavcodec
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavdevice
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavfilter
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavformat
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavutil
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libpostproc
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libswresample
cargo:rustc-link-search=native=/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libswscale
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
rerun-if-changed=headers
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- stderr
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavutil/buffer_internal.h:44:5: error: unknown type name 'atomic_uint'
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavutil/buffer_internal.h:89:5: error: unknown type name 'atomic_uint'
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavcodec/error_resilience.h:64:5: error: unknown type name 'atomic_int'
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/internal.h:63:10: warning: 'AVMixCoeffType' is deprecated [-Wdeprecated-declarations]
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/avresample.h:112:6: note: 'AVMixCoeffType' has been explicitly marked deprecated here
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/internal.h:73:10: warning: 'AVResampleFilterType' is deprecated [-Wdeprecated-declarations]
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/avresample.h:123:6: note: 'AVResampleFilterType' has been explicitly marked deprecated here
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/internal.h:75:10: warning: 'AVResampleDitherMethod' is deprecated [-Wdeprecated-declarations]
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/avresample.h:132:6: note: 'AVResampleDitherMethod' has been explicitly marked deprecated here
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/resample.h:42:10: warning: 'AVResampleFilterType' is deprecated [-Wdeprecated-declarations]
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/avresample.h:123:6: note: 'AVResampleFilterType' has been explicitly marked deprecated here
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/audio_mix.h:55:33: warning: 'AVMixCoeffType' is deprecated [-Wdeprecated-declarations]
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/avresample.h:112:6: note: 'AVMixCoeffType' has been explicitly marked deprecated here
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavutil/buffer_internal.h:44:5: error: unknown type name 'atomic_uint', err: true
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavutil/buffer_internal.h:89:5: error: unknown type name 'atomic_uint', err: true
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavcodec/error_resilience.h:64:5: error: unknown type name 'atomic_int', err: true
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/internal.h:63:10: warning: 'AVMixCoeffType' is deprecated [-Wdeprecated-declarations], err: false
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/internal.h:73:10: warning: 'AVResampleFilterType' is deprecated [-Wdeprecated-declarations], err: false
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/internal.h:75:10: warning: 'AVResampleDitherMethod' is deprecated [-Wdeprecated-declarations], err: false
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/resample.h:42:10: warning: 'AVResampleFilterType' is deprecated [-Wdeprecated-declarations], err: false
/w/imager-io/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-b0fc1cca8b3d58d1/out/ffmpeg-4.2.2/libavresample/audio_mix.h:55:33: warning: 'AVMixCoeffType' is deprecated [-Wdeprecated-declarations], err: false
thread 'main' panicked at 'Unable to generate bindings: ()', src/libcore/result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.