-
Notifications
You must be signed in to change notification settings - Fork 32
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
Tests fail on 32bit architectures #32
Comments
It appears that these test failures happen because bindgen test cases are not generated at build-time, and hard-code struct sizes that are only valid on 64-bit architectures. Looking at the code, I think the failures are harmless. Still, would it be possible to generate the bindings and tests with bindgen at build-time (i.e. in build.rs)? Looking at the generated code in src/lib.rs, I think there are no manual modifications of the source code that was generated by bindgen, so that should work, it would solve the problem of the broken bindgen tests, and you wouldn't need to actually commit the generated source code to git at all, but only the build script and a "wrapper" lib.rs file. |
Just using bindgen directly is not a good solution as this introduces quite a lot of heavy dependencies. |
Sure, it makes sense to make it optional behind a feature flag for such cases. I can submit a PR for that, once the prerequisites are done :) |
I ran into the same issue on debian while unblocking diesel. I skipped the failing test for now with this patch: --- a/src/lib.rs
+++ b/src/lib.rs
@@ -37,6 +37,7 @@ pub struct __sbuf {
pub _size: ::std::os::raw::c_int,
}
#[test]
+#[cfg(not(target_pointer_width = "32"))]
fn bindgen_test_layout___sbuf() {
assert_eq!(::std::mem::size_of::<__sbuf>() , 16usize);
assert_eq!(::std::mem::align_of::<__sbuf>() , 8usize);
@@ -91,6 +92,7 @@ pub struct __sFILE {
pub _offset: fpos_t,
}
#[test]
+#[cfg(not(target_pointer_width = "32"))]
fn bindgen_test_layout___sFILE() {
assert_eq!(::std::mem::size_of::<__sFILE>() , 152usize);
assert_eq!(::std::mem::align_of::<__sFILE>() , 8usize);
@@ -235,6 +237,7 @@ pub struct pgNotify {
pub next: *mut pgNotify,
}
#[test]
+#[cfg(not(target_pointer_width = "32"))]
fn bindgen_test_layout_pgNotify() {
assert_eq!(::std::mem::size_of::<pgNotify>() , 32usize);
assert_eq!(::std::mem::align_of::<pgNotify>() , 8usize);
@@ -268,6 +271,7 @@ pub struct _PQprintOpt {
pub fieldName: *mut *mut ::std::os::raw::c_char,
}
#[test]
+#[cfg(not(target_pointer_width = "32"))]
fn bindgen_test_layout__PQprintOpt() {
assert_eq!(::std::mem::size_of::<_PQprintOpt>() , 40usize);
assert_eq!(::std::mem::align_of::<_PQprintOpt>() , 8usize);
@@ -288,6 +292,7 @@ pub struct _PQconninfoOption {
pub dispsize: ::std::os::raw::c_int,
}
#[test]
+#[cfg(not(target_pointer_width = "32"))]
fn bindgen_test_layout__PQconninfoOption() {
assert_eq!(::std::mem::size_of::<_PQconninfoOption>() , 56usize);
assert_eq!(::std::mem::align_of::<_PQconninfoOption>() , 8usize);
@@ -311,6 +316,7 @@ pub struct _bindgen_ty_8__bindgen_ty_1 {
pub bindgen_union_field: u64,
}
#[test]
+#[cfg(not(target_arch = "x86"))]
fn bindgen_test_layout__bindgen_ty_8__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<_bindgen_ty_8__bindgen_ty_1>() , 8usize);
assert_eq!(::std::mem::align_of::<_bindgen_ty_8__bindgen_ty_1>() ,
@@ -340,6 +346,7 @@ pub struct pgresAttDesc {
pub atttypmod: ::std::os::raw::c_int,
}
#[test]
+#[cfg(not(target_pointer_width = "32"))]
fn bindgen_test_layout_pgresAttDesc() {
assert_eq!(::std::mem::size_of::<pgresAttDesc>() , 32usize);
assert_eq!(::std::mem::align_of::<pgresAttDesc>() , 8usize);
|
@werdahias Again, I'm happy to accept a PR that fixes these tests. |
Essentially fixed by #47 which allows to build your own platform specific bindings. The bundled bindings are meant to support all targets that are tested on CI. |
The text was updated successfully, but these errors were encountered: