gtk-rs / gtk-rs-core

Rust bindings for GNOME libraries
https://gtk-rs.org/gtk-rs-core
MIT License
272 stars 104 forks source link

[BUG] cross-validation tests fail for glib-sys #1354

Closed plugwash closed 2 months ago

plugwash commented 2 months ago
cd glib-sys
cargo test--all-targets

Results in build failures of the cross validation tests.

tests/layout.c: In function ‘main’:
tests/layout.c:117:48: error: ‘GUnixPipe’ undeclared (first use in this function)
  117 |     printf("%s;%zu;%zu\n", "GUnixPipe", sizeof(GUnixPipe), alignof(GUnixPipe));
      |                                                ^~~~~~~~~
tests/layout.c:117:48: note: each undeclared identifier is reported only once for each function it appears in

I was able to fix the build failure by adding #include <glib-unix.h> to tests/manual.h

However I then get

---- cross_validate_layout_with_c stdout ----
Layout mismatch for GStaticMutex
Rust: Layout { size: 8, alignment: 8 }
C:    Layout { size: 48, alignment: 8 }
Layout mismatch for GStaticRWLock
Rust: Layout { size: 40, alignment: 8 }
C:    Layout { size: 80, alignment: 8 }
Layout mismatch for GStaticRecMutex
Rust: Layout { size: 16, alignment: 8 }
C:    Layout { size: 64, alignment: 8 }

It appears that until recently, these were not included in the rust bindings. It also appears that they are deprecated upstream.

Should they be excluded from the bindings somehow? or at least excluded from the cross-validation checks?

sdroege commented 2 months ago

I was able to fix the build failure by adding #include to tests/manual.h

Can you create a PR for that?

The other issue is already tracked in https://github.com/gtk-rs/gtk-rs-core/issues/1353

bilelmoussaoui commented 2 months ago

This should be fixed in main