labstreaminglayer / liblsl-rust

Rust wrapper for liblsl.
MIT License
12 stars 5 forks source link

Mismatched types i8/u8 on Linux Aarch64 because of C's char type's sign ambiguity #6

Open npeekhaus opened 2 months ago

npeekhaus commented 2 months ago

I tried to compile on two systems: Raspberry Pi 5 running Ubuntu 24.04 and Virtual Machine on an Apple M2 running Ubuntu 22.04. On both machines compilation fails with the same errors:

image image

I do not understand the cause of this to its full extend, but I learned that C's char type (referred to by Rust as ::std::os::raw::c_char) has some ambiguity which integer type (signed or unsigned) it refers to (see Rust docs).

Some functions in lsl-sys/src/generated.rs use ::std::os::raw::c_char to specify the type of their arguments which on Aarch64 translates to u8 (instead of i8 as on x86_64) while functions in src/lib.rs expect it to be i8.

Changing lines 418 and 811 in lsl-sys/src/generated.rs to use i8 instead of ::std::os::raw::c_char makes the project compile without errors, however, I have not tested whether it has effect on the streamed data, causes data corruption, etc.

image