Skip to content

rpmlib-sys: rpmts.h and rpmfi.h cause bindgen_test_layout_max_align_t failures #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tony-iqlusion opened this issue Apr 8, 2018 · 3 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tony-iqlusion
Copy link
Member

These headers are:

  • rpmts.h: Transaction sets
  • rpmfi.h: File information

When either of these headers are enabled (in src/rpmlib-sys.h), they cause the automatically generated bindgen_test_layout_max_align_t test to fail. In either case, we get the following failure:

---- bindgen_test_layout_max_align_t stdout ----
	thread 'bindgen_test_layout_max_align_t' panicked at 'assertion failed: `(left == right)`
  left: `24`,
 right: `32`: Size of: max_align_t', target/debug/build/rpmlib-sys-25076a13bc63918f/out/bindings.rs:6564:5

Both of these headers are presently commented out in the binding generator due to these errors.

@tony-iqlusion
Copy link
Member Author

Transaction sets are an integral part of rpmlib's API, and without them we're blocked on doing pretty much anything (#13, #14, #15, #16).

@tony-iqlusion
Copy link
Member Author

These were both fixed in #17 by having bindgen build a C++ binding instead of a C one

@tony-iqlusion
Copy link
Member Author

Per rust-lang/rust-bindgen#363 it sounds like this issue would've also been addressed by using rust_target(1.25) now that repr(align(N)) is stable.

tarcieri pushed a commit that referenced this issue Aug 9, 2018
snev68 added a commit to snev68/iqlusioninc-crates that referenced this issue Aug 5, 2024
bindgen was having trouble with several critical files when we were
attempting to build a C binding:

iqlusioninc/crates#11
iqlusioninc/crates#12

However, rpmlib's headers are also set up to supply C++ bindings,
and if we rename our header file from `.h` to `.hpp` it signals
to bindgen that we want to treat the project as C++.

If we do, all the previous problems are magically resolved, and
we are able to bind to all of rpmlib as well as librpmbuild and
librpmsign.

We do introduce one new weird minor bindgen issue (see `lib.rs`).
We should probably switch to whitelisting the structs and
functions the `rpmlib` crate actually uses, rather than having
bindgen build a binding to everything.

But good to know it works!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant