Build is broken for target aarch64-linux-android
flxo opened this issue · 3 comments
flxo commented
The bionic interface slightly differs from glibc and others. The build is broken due to some type conflict:
error[E0605]: non-primitive cast: `&[u8; 129]` as `&[i8]`
--> src/core/deviceinfo.rs:44:35
|
44 | let uuid = str_from_c_str(&ioctl.uuid as &[i8]).ok_or_else(|| {
| ^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
error[E0605]: non-primitive cast: `&[u8; 128]` as `&[i8]`
--> src/core/deviceinfo.rs:71:32
|
71 | str_from_c_str(&ioctl.name as &[i8])
| ^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
error[E0308]: mismatched types
--> src/core/dm.rs:98:59
|
98 | let _ = name.as_bytes().read(mut_slice_from_c_str(&mut hdr.name))?;
| ^^^^^^^^^^^^^ expected slice `[i8]`, found array `[u8; 128]`
|
= note: expected mutable reference `&mut [i8]`
found mutable reference `&mut [u8; 128]`
error[E0308]: mismatched types
--> src/core/dm.rs:103:59
|
103 | let _ = uuid.as_bytes().read(mut_slice_from_c_str(&mut hdr.uuid))?;
| ^^^^^^^^^^^^^ expected slice `[i8]`, found array `[u8; 129]`
|
= note: expected mutable reference `&mut [i8]`
found mutable reference `&mut [u8; 129]`
error[E0308]: mismatched types
--> src/core/dm.rs:481:44
|
481 | let dst = mut_slice_from_c_str(&mut targ.target_type);
| ^^^^^^^^^^^^^^^^^^^^^ expected slice `[i8]`, found array `[u8; 16]`
|
= note: expected mutable reference `&mut [i8]`
found mutable reference `&mut [u8; 16]`
error[E0308]: mismatched types
--> src/core/dm.rs:586:50
|
586 | let target_type = str_from_c_str(&targ.target_type)
| ^^^^^^^^^^^^^^^^^ expected slice `[i8]`, found array `[u8; 16]`
|
= note: expected reference `&[i8]`
found reference `&[u8; 16]`
error[E0308]: mismatched types
--> src/core/dm_ioctl.rs:41:33
|
41 | &str_from_c_str(&self.name as &[libc::c_char]).unwrap_or("Could not parse string"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
|
= note: expected reference `&[i8]`
found reference `&[u8]`
error[E0308]: mismatched types
--> src/core/dm_ioctl.rs:45:33
|
45 | &str_from_c_str(&self.uuid as &[libc::c_char]).unwrap_or("Could not parse string"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
|
= note: expected reference `&[i8]`
found reference `&[u8]`
error[E0308]: mismatched types
--> src/core/dm_ioctl.rs:49:33
|
49 | &str_from_c_str(&self.data as &[libc::c_char]).unwrap_or("Could not parse string"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
|
= note: expected reference `&[i8]`
found reference `&[u8]`
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0308, E0605.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `devicemapper`
To learn more, run the command again with --verbose.
To reproduce run a cargo check --target aarch64-linux-android
I tested with NDK r19c.
mulkieran commented
Note: Perhaps libc::char
would have been better as i8
, which would work with at least two targets.
jbaublitz commented
@mulkieran If you want me to take a look at this, let me know! I may even be able to set up CI to test for musl and android (compile only) if that would be desirable.
mulkieran commented
@jbaublitz Please go ahead and attempt to set up CI for other architectures. Perhaps you can learn something from the record of failures so far in #641.