Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Build failure of the new bindgen-based bindings #43

Open
YaLTeR opened this issue Jun 27, 2017 · 7 comments
Open

Build failure of the new bindgen-based bindings #43

YaLTeR opened this issue Jun 27, 2017 · 7 comments

Comments

@YaLTeR
Copy link

YaLTeR commented Jun 27, 2017

Arch Linux x64, ffmpeg 1:3.3.2-1, 9d63d3b

cargo build gives me:

thread 'main' panicked at 'TranslationUnit::parse failed', /checkout/src/libcore/option.rs:785
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:511
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:495
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:471
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:69
   9: core::option::expect_failed
             at /checkout/src/libcore/option.rs:785
  10: <core::option::Option<T>>::expect
             at /checkout/src/libcore/option.rs:293
  11: bindgen::ir::context::BindgenContext::new
             at /home/yalter/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.26.2/src/ir/context.rs:231
  12: bindgen::Bindings::generate
             at /home/yalter/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.26.2/src/lib.rs:1095
  13: bindgen::Builder::generate
             at /home/yalter/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.26.2/src/lib.rs:798
  14: build_script_build::main
             at ./build.rs:860
  15: std::panicking::try::do_call
             at /checkout/src/libstd/panicking.rs:454
  16: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  17: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:433
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:57
  18: main
  19: __libc_start_main
  20: _start
@YaLTeR
Copy link
Author

YaLTeR commented Jun 27, 2017

@retrry any ideas?

@YaLTeR
Copy link
Author

YaLTeR commented Jun 28, 2017

Building with the build feature works fine, but if I try to use it with cargo build --target=i686-unknown-linux-gnu I get another error:

--- stdout
cargo:rustc-link-search=native=/home/yalter/Source/rust/rust-ffmpeg-sys/target/i686-unknown-linux-gnu/debug/build/ffmpeg-sys-7961c9a07a542f48/out/dist/lib
configure: Must specify target arch and OS when cross-compiling

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.


--- stderr
Cloning into 'ffmpeg-3.2'...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Custom(Custom { kind: Other, error: StringError("configure failed ") }) }', /checkout/src/libcore/result.rs:859
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Re-running with RUST_BACKTRACE=1 results in:

--- stdout
cargo:rustc-link-search=native=/home/yalter/Source/rust/rust-ffmpeg-sys/target/i686-unknown-linux-gnu/debug/build/ffmpeg-sys-7961c9a07a542f48/out/dist/lib

--- stderr
fatal: destination path 'ffmpeg-3.2' already exists and is not an empty directory.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Custom(Custom { kind: Other, error: StringError("fetch failed") }) }', /checkout/src/libcore/result.rs:859
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:511
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:495
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:471
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:69
   9: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:29
  10: <core::result::Result<T, E>>::unwrap
             at /checkout/src/libcore/result.rs:737
  11: build_script_build::main
             at ./build.rs:450
  12: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  13: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:433
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:57
  14: main
  15: __libc_start_main
  16: _start

So, to sum up, building with the system ffmpeg isn't working (both 64-bit and 32-bit with a similar error), and also building with 32-bit non-system ffmpeg isn't working.

@retrry
Copy link
Contributor

retrry commented Jun 28, 2017

So at the moment for me it seems, that include paths are not found on ArchLinux and other distributions. @meh maybe you know why include paths wouldn't be found? If I understand correctly include_paths variable is empty. So my search includes function is wrong and always returns empty string.

@retrry
Copy link
Contributor

retrry commented Jun 30, 2017

So I looked a bit more and pkg-config returns empty include_pats Vec. I still don't know which layer is broken - pkg-config-rs or pkg-config. Are there other ways of looking for include paths? Or I should just hardcode /usr/include, when it is returned as empty Vec, as it should work on most Linux distributions (I'm on NixOS and pkg-config seems to be returning include_paths correctly).

@YaLTeR
Copy link
Author

YaLTeR commented Jul 10, 2017

Sorry for taking so long to test this. Building with system FFMpeg is now fixed, building with non-system FFMpeg still works for 64-bit, but it still fails for 32-bit:

error: failed to run custom build command for `ffmpeg-sys v3.3.2 (file:///home/yalter/Source/rust/rust-ffmpeg-sys)`
process didn't exit successfully: `/home/yalter/Source/rust/rust-ffmpeg-sys/target/debug/build/ffmpeg-sys-23aa852ecddc4198/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/home/yalter/Source/rust/rust-ffmpeg-sys/target/i686-unknown-linux-gnu/debug/build/ffmpeg-sys-e0cf992a85b60e90/out/dist/lib
configure: Must specify target arch and OS when cross-compiling

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.


--- stderr
Cloning into 'ffmpeg-3.3'...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Custom(Custom { kind: Other, error: StringError("configure failed ") }) }', /checkout/src/libcore/result.rs:860:4
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:380
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:396
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:611
   5: std::panicking::begin_panic_new
             at /checkout/src/libstd/panicking.rs:553
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:521
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:497
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:92
   9: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:31
  10: <core::result::Result<T, E>>::unwrap
             at /checkout/src/libcore/result.rs:738
  11: build_script_build::main
             at ./build.rs:451
  12: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  13: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:458
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  14: main
  15: __libc_start_main
  16: _start

@meh meh reopened this Jul 10, 2017
@retrry
Copy link
Contributor

retrry commented Jul 11, 2017

It seems that you are trying to build 32-bit on 64-bit machine via cross-compiling? I don't think cross-compiling was supported and I don't have enough knowledge about it. @meh did cross-compiling ever work?

@YaLTeR
Copy link
Author

YaLTeR commented Jul 11, 2017

I am, and I can actually build FFMpeg fine with the right ./configure keys. You also need to set PKG_CONFIG_ALLOW_CROSS=1 for cargo build so the pkg-config crate is fine linking 32-bit libs. I think there's some key missing from build.rs ./configure invocation.

Here's the lib32-ffmpeg PKGBUILD for reference, also on 64-bit Travis system (Ubuntu) I built FFMpeg successfully with ./configure --disable-programs --disable-doc --enable-cross-compile --arch=x86_32 --target_os=linux --prefix="$HOME/ffmpeg" --cc="gcc -m32" --disable-static --enable-shared

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants