-
Notifications
You must be signed in to change notification settings - Fork 744
failed to produce bindings for RPM library #363
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
Comments
Those errors are non-fatal, does the generated code compile? You can post it here if you want. If it doesn't, I bet this is #361, and you need to blacklist the functions that use varargs until we do it automatically. |
We might want to make all the non-fatal Thoughts @emilio ? |
Sounds good to me. |
right, since I had no I tried to compile the produced
and the union related error is the 13 beside the first one. |
I forgot to mention:
|
Ok, so the unions one is that by default we generate rust Can you call bindgen with |
As you suggested, I run
Is C++ somehow controlled by an option? |
Yup! passing
Should make it work. |
That definitely made a difference. First, the output of
and then the output of
|
That's... Interesting! Do you have the definition of the struct that is causing those? |
this comes from what I want is to generate bindings for rpm related headers only, is there an easy way to do that? the code #[repr(C)]
#[derive(Debug, Copy)]
pub struct timex {
pub modes: ::std::os::raw::c_uint,
pub offset: __syscall_slong_t,
pub freq: __syscall_slong_t,
pub maxerror: __syscall_slong_t,
pub esterror: __syscall_slong_t,
pub status: ::std::os::raw::c_int,
pub constant: __syscall_slong_t,
pub precision: __syscall_slong_t,
pub tolerance: __syscall_slong_t,
pub time: timeval,
pub tick: __syscall_slong_t,
pub ppsfreq: __syscall_slong_t,
pub jitter: __syscall_slong_t,
pub shift: ::std::os::raw::c_int,
pub stabil: __syscall_slong_t,
pub jitcnt: __syscall_slong_t,
pub calcnt: __syscall_slong_t,
pub errcnt: __syscall_slong_t,
pub stbcnt: __syscall_slong_t,
pub tai: ::std::os::raw::c_int,
pub _bitfield_1: u32,
pub _bitfield_2: u32,
pub _bitfield_3: u32,
pub _bitfield_4: u32,
pub _bitfield_5: u32,
pub _bitfield_6: u32,
pub _bitfield_7: u32,
pub _bitfield_8: u32,
pub _bitfield_9: u32,
pub _bitfield_10: u32,
pub _bitfield_11: u32,
}
#[test]
fn bindgen_test_layout_timex() {
assert_eq!(::std::mem::size_of::<timex>() , 208usize);
assert_eq!(::std::mem::align_of::<timex>() , 8usize);
}
impl Clone for timex {
fn clone(&self) -> Self { *self }
}
impl timex {
#[inline]
pub fn at_offset_0(&self) -> ::std::os::raw::c_int {
unsafe {
::std::mem::transmute(((self._bitfield_1 &
(4294967295usize as u32)) >> 0u32) as
u32)
}
}
...
#[inline]
pub fn at_offset_0(&self) -> ::std::os::raw::c_int {
unsafe {
::std::mem::transmute(((self._bitfield_2 &
(4294967295usize as u32)) >> 0u32) as
u32)
}
}
... |
Yes, you should whitelist the rpm stuff you want, using regexes. For example: `--whitelist-function "rpm.*". |
@sa2ajj are you still hitting this on master? If so, the best way to contribute to resolving this bug would be to create a reduced test case. |
sorry for a slow follow-up: i'll check it during the coming weekend :/ |
I've managed to use bindgen to produce a Rust binding for https://github.com/iqlusion-io/crates/tree/master/rpmlib-sys I should start by noting that all of the issues being discussed in this thread, at least for me, have been fixed, and IMO the issue can probably be closed. I ran into several other minor (not-really-bindgen-bug) issues, most of which I've managed to address. Many of them were fixed by having bindgen build a C++ binding instead of a C one. If you want the gorey details you can read about them here: iqlusioninc/crates#11 |
Ok, I'll close this based on that, thanks @tarcieri!
|
@emilio thanks for the pointers... looks like #1252 is about the same silly header file I was having trouble with on iqlusioninc/crates#12 ! Glad I found a workaround. |
I'm looking into creating Rust bindings for the RPM libraries.
First I installed
bindgen
, but it seems to be somewhat inconsistent with whatservo/rust-bindgen
offers. So my second attempt was to clone and buildbindgen
fromservo/rust-bindgen
:after that I created a simple
wrapper.h
:and then run
bindgen
on it:as the result I got these errors:
Do I miss something?
The text was updated successfully, but these errors were encountered: