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

Can't compile with Rust 1.39 #78

Closed
AndreaCatania opened this issue Nov 16, 2019 · 2 comments · Fixed by #80
Closed

Can't compile with Rust 1.39 #78

AndreaCatania opened this issue Nov 16, 2019 · 2 comments · Fixed by #80

Comments

@AndreaCatania
Copy link

With rust 1.39 is not possible to compile this crate anymore, I get the followig errors. Do you have any ideas?

error[E0369]: binary operation `==` cannot be applied to type `__mbstate_t__bindgen_ty_1`
    --> /home/andrea/Workspace/git/video_ludo/target/debug/build/ffmpeg-sys-77d9e656be992a77/out/bindings.rs:3000:5
     |
3000 |     pub __value: __mbstate_t__bindgen_ty_1,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: an implementation of `std::cmp::PartialEq` might be missing for `__mbstate_t__bindgen_ty_1`

error[E0369]: binary operation `!=` cannot be applied to type `__mbstate_t__bindgen_ty_1`
    --> /home/andrea/Workspace/git/video_ludo/target/debug/build/ffmpeg-sys-77d9e656be992a77/out/bindings.rs:3000:5
     |
3000 |     pub __value: __mbstate_t__bindgen_ty_1,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: an implementation of `std::cmp::PartialEq` might be missing for `__mbstate_t__bindgen_ty_1`

error[E0277]: the trait bound `__mbstate_t__bindgen_ty_1: std::cmp::Eq` is not satisfied
    --> /home/andrea/Workspace/git/video_ludo/target/debug/build/ffmpeg-sys-77d9e656be992a77/out/bindings.rs:3000:5
     |
3000 |     pub __value: __mbstate_t__bindgen_ty_1,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `__mbstate_t__bindgen_ty_1`
     |
     = note: required by `std::cmp::AssertParamIsEq`
@danieldulaney
Copy link
Contributor

After a git bisect, it looks like this issue first appears in 8a6d9c6, in which bindgen was updated from 0.30 to 0.31. These were all run with the current stable Rust compiler (1.39.0).

It appears that versions of bindgen between 0.31 and 0.51.0 interact with a compiler behavior change in 1.39 -- see rust-lang/rust-bindgen#1627 and the related discussion at rust-lang/rust#64710. The solution is to upgrade bindgen to the latest fixed version at 0.51.1. This is accomplished in PR #79.

However, even with the upgrade, #79 does not fix all issues (at least on my machine 😄), producing outputs like this:

error[E0428]: the name `FP_ZERO` is defined multiple times
    --> /home/daniel/rust-ffmpeg-sys/target/debug/build/ffmpeg-sys-790f9f63289709f5/out/bindings.rs:2855:1
     |
572  | pub const FP_ZERO: libc::c_int = 2;
     | ----------------------------------- previous definition of the value `FP_ZERO` here
...
2855 | pub const FP_ZERO: _bindgen_ty_1 = _bindgen_ty_1::FP_ZERO;
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `FP_ZERO` redefined here
     |
     = note: `FP_ZERO` must be defined only once in the value namespace of this module

build.rs line 906 attempts to fix this by blacklisting the types involved (FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, and FP_NORMAL). However, at least on my machine, this is insufficient. The recommended way of handling this is by implementing will_parse_macro and returning Ignore for any of the macros given here. This replaces the type blacklisting, allowing that code to be removed.

I will work up a PR and check that it builds on Travis as well as my machine.

@danieldulaney
Copy link
Contributor

Ok, #80 appears to fix this. @AndreaCatania, can you comment if it works for you? If so, this can be closed when it gets merged.

@meh meh closed this as completed in #80 Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants