Skip to content
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

Compiling on aarch64 fails with mismatched size for IdentifyControllerDataStructure #1

Open
PandaZ3D opened this issue Jul 10, 2023 · 2 comments

Comments

@PandaZ3D
Copy link
Contributor

Compiling this library on a 64-bit ARM target fails. The compiler returns this error:

error[E0308]: mismatched types
   --> src/ds/identify/controller.rs:133:37
    |
133 | const _SIZE_CHECKER: [u8; 0x1000] = [0; std::mem::size_of::<IdentifyControllerDataStructure>()];
    |                           ------    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a fixed size of 4096 elements, found one with 4112 elements
    |                           |
    |                           help: consider specifying the actual array length: `4112`

This can be tested by cloning the repo and compiling it on a 64-bit ARM machine. This was tested with an ARM-based M1 Mac (Apple Darwin) and a Raspberry Pi 4 (Linux). It works fine on an x86_64 server, but does not compile on aarch64.

@dbittman
Copy link
Collaborator

Try cbddee4.

@PandaZ3D
Copy link
Contributor Author

After playing around with it, something funky is definitely happening with the alignment/type layout. If I remove the repr(C), then its fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants