You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's an exemple binding to bzip2 (just as an exemple ; the author knows about bzip2 and bzip2-sys crates).
I'm using :
rustc 1.64.0 (a55dd71d5 2022-09-19)
bindgen-0.60.1
Windows 10
MSYS2/Mingw64 : clang64/mingw-w64-clang-x86_64-bzip2 1.0.8-2 as the provider of C package bzip2
After adding some bindgen::Builder config in build.rs to set path to included <bzlib.h> :
.clang_arg("-IC:/dev/msys64/clang64/include")
I'm getting this error :
$ cargo build
Compiling bindgen-tutorial-bzip2-sys v0.1.0 (C:\Users\olivier\dev\rust\www-sample\interop\c\bindgen-tutorial-bzip2-sys)
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
--> C:\Users\olivier\dev\rust\www-sample\interop\c\bindgen-tutorial-bzip2-sys\target\debug\build\bindgen-tutorial-bzip2-sys-03a76bb986e88418\out/bind
ings.rs:64916:1
|
64916 | pub struct _IMAGE_TLS_DIRECTORY64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `_IMAGE_TLS_DIRECTORY64__bindgen_ty_1__bindgen_ty_1` has a `#[repr(align)]` attribute
--> C:\Users\olivier\dev\rust\www-sample\interop\c\bindgen-tutorial-bzip2-sys\target\debug\build\bindgen-tutorial-bzip2-sys-03a76bb986e88418\out/bind
ings.rs:64933:1
|
64933 | pub struct _IMAGE_TLS_DIRECTORY64__bindgen_ty_1__bindgen_ty_1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `_IMAGE_TLS_DIRECTORY64` contains a field of type `_IMAGE_TLS_DIRECTORY64__bindgen_ty_1`
--> C:\Users\olivier\dev\rust\www-sample\interop\c\bindgen-tutorial-bzip2-sys\target\debug\build\bindgen-tutorial-bzip2-sys-03a76bb986e88418\out/bind
ings.rs:64922:9
|
64922 | pub __bindgen_anon_1: _IMAGE_TLS_DIRECTORY64__bindgen_ty_1,
| ^^^^^^^^^^^^^^^^
note: ...which contains a field of type `_IMAGE_TLS_DIRECTORY64__bindgen_ty_1__bindgen_ty_1`
--> C:\Users\olivier\dev\rust\www-sample\interop\c\bindgen-tutorial-bzip2-sys\target\debug\build\bindgen-tutorial-bzip2-sys-03a76bb986e88418\out/bind
ings.rs:64928:9
|
64928 | pub __bindgen_anon_1: _IMAGE_TLS_DIRECTORY64__bindgen_ty_1__bindgen_ty_1,
| ^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0588`.
error: could not compile `bindgen-tutorial-bzip2-sys` due to previous error
I tried with nightly toolchain (currently 1.66.0)
with cargo +nightly build
by adding some bindgen::Builder config in build.rs : .rust_target(bindgen::RustTarget::Nightly)
but I get the same error.
I first submitted an issue to the rust-lang repo (rust-lang/rust#102733) where it was answered that rustc is correct in rejecting the bindgen generated code with error :
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
Another issue rust-lang/rust#67383 with the same problem had been closed for the same kind of error, so maybe the error I'm getting comes from a different bindgen code path than the one fixed in the other issue.
If I manually remove the #[repr(align)] the build is OK.
Not sure if it is the right way to fix it, but 'cargo test' seems OK, so it may be sufficient.
The text was updated successfully, but these errors were encountered:
Hi @olivier-fs thanks for your report. I'm closing this issue as this is a duplicate of #2179 and it would be better to keep this discussion in a single place
Hi!
I'm trying to build the bindgen tutorial example from :
https://rust-lang.github.io/rust-bindgen/tutorial-0.html
=> https://github.com/fitzgen/bindgen-tutorial-bzip2-sys
=> https://fitzgeraldnick.com/2016/12/14/using-libbindgen-in-build-rs.html
It's an exemple binding to bzip2 (just as an exemple ; the author knows about bzip2 and bzip2-sys crates).
I'm using :
After adding some bindgen::Builder config in build.rs to set path to included <bzlib.h> :
I'm getting this error :
I tried with nightly toolchain (currently 1.66.0)
but I get the same error.
I first submitted an issue to the rust-lang repo (rust-lang/rust#102733) where it was answered that rustc is correct in rejecting the bindgen generated code with error :
cf. https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers
Excerpt from bindgen generated bindings.rs :
Another issue rust-lang/rust#67383 with the same problem had been closed for the same kind of error, so maybe the error I'm getting comes from a different bindgen code path than the one fixed in the other issue.
If I manually remove the #[repr(align)] the build is OK.
Not sure if it is the right way to fix it, but 'cargo test' seems OK, so it may be sufficient.
The text was updated successfully, but these errors were encountered: