ruabmbua / enet-sys

Raw rust bindings to the enet C library
MIT License
19 stars 14 forks source link

Fails to build, the trait `Debug` is not implemented #7

Closed Boscop closed 6 years ago

Boscop commented 6 years ago
D:\Program Files\Microsoft Visual Studio 14.0>cd D:\3rdparty\enet-sys

D:\3rdparty\enet-sys>cargo b
   Compiling enet-sys v0.2.0 (file:///D:/3rdparty/enet-sys)
error[E0277]: `_IMAGE_LINENUMBER__bindgen_ty_1` doesn't implement `std::fmt::Deb
ug`
     --> D:\3rdparty\enet-sys\target\debug\build\enet-sys-d7eedfea4cae5078\out/b
indings.rs:49220:5
      |
49220 |     pub Type: _IMAGE_LINENUMBER__bindgen_ty_1,
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `_IMAGE_LINENUMBER__bindge
n_ty_1` cannot be formatted using `{:?}`
      |
      = help: the trait `std::fmt::Debug` is not implemented for `_IMAGE_LINENUM
BER__bindgen_ty_1`
      = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
      = note: required because of the requirements on the impl of `std::fmt::Deb
ug` for `&_IMAGE_LINENUMBER__bindgen_ty_1`
      = note: required for the cast to the object type `dyn std::fmt::Debug`

error[E0277]: `[u8; 40]` doesn't implement `std::fmt::Debug`
      --> D:\3rdparty\enet-sys\target\debug\build\enet-sys-d7eedfea4cae5078\out/
bindings.rs:109601:5
       |
109601 |     pub __bindgen_padding_0: [u8; 40usize],
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[u8; 40]` cannot be formatt
ed using `{:?}` because it doesn't implement `std::fmt::Debug`
       |
       = help: the trait `std::fmt::Debug` is not implemented for `[u8; 40]`
       = note: required because of the requirements on the impl of `std::fmt::De
bug` for `&[u8; 40]`
       = note: required for the cast to the object type `dyn std::fmt::Debug`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
error: Could not compile `enet-sys`.

To learn more, run the command again with --verbose.

D:\3rdparty\enet-sys>rustc --version
rustc 1.30.0-nightly (02cb8f2a4 2018-08-29)
spearman commented 6 years ago

I think these are the same errors as #5?

So far I only get this error when trying to build on Windows.

spearman commented 6 years ago

Opened a pull request (#9) that adds derive_debug(false) option to the bindgen options (default is true).

Enet requires winmm.lib to be linked on windows: #8

With both of these patches I was able to get a successful build with nightly-gnu toolchain in MSYS2 environment with mingw-w64-x86_64-clang and mingw-w64-x86_64-cmake installed.

Boscop commented 6 years ago

@spearman Thanks. The handwritten bindings also used to work with rustc-msvc for me, and I have to use msvc because of the other libs I have to link to.. Does your PR work with msvc, too? :)

spearman commented 6 years ago

@spearman Thanks. The handwritten bindings also used to work with rustc-msvc for me, and I have to use msvc because of the other libs I have to link to.. Does your PR work with msvc, too? :)

No, at least not with my current environment I get errors: https://gist.github.com/spearman/51c724fe56fefc7da166292d6a2b5563

I was able to build enet manually using autoreconf + make, and gcc though, so maybe there is a way around it.

ruabmbua commented 6 years ago

PR merged, thanks @spearman .