Closed kturney closed 2 years ago
Thanks for the excellent detailed bug report. :grin: It does seem odd that dart:ffi doesn't yet provide an extension for Long
... as far as I can tell we would need it to convert any ffi.Long value into a Uint8List via the asTypedList
method.
However from the first error this is looking like a change in how ffigen interprets C types between version 4.* and 5.0. In our membrane_types/src/c.rs
module we generate the C types that are used to write the .h
files that ffigen ingests. We've been using signed long
and up until now ffigen created a Pointer<ffi.Int64>
from that, in 5.0.0 it begins generating a more literal Pointer<ffi.Long>
and all the code downstream then begins failing with type errors. If we make the membrane generated C types more explicit by changing c.rs
from signed long
to an int64_t
that may fix the compatibility issue.
I guess minimum rust version for tests to pass is 1.54 due to iterable arrays
Thanks for this contribution Kyle, great work as always!
On your last comment above that error is coming from https://github.com/dtolnay/trybuild which I use to guard against compiler errors changing from something that's helpful into something misleading / unhelpful. On older Rust versions the compiler emits very slightly different messages (usually just different whitespace or spanning) and so that test diff fails despite the Membrane code still being correct.
One very tiny change I made was to switch chain([])
to chain(vec![])
so we could keep Rust 1.49 compat (we only build against 1.49 and test against stable
). I don't know if anyone is using this project with older versions but for now I guess I'll keep it since it's low effort. :man_shrugging:
Help me Jerel, you're my only hope.
![Save me Jerel](https://c.tenor.com/94c-LWTF2b0AAAAC/leia-youre-my-only-hope.gif)I've gone down a bit of a rabbit hole trying to get M1 support without resorting to hacks like symlinking the Homebrew llvm. Latest
ffigen
works great on the M1, but we've got some membrane type issues to iron out.Tests are allllllmost passing, as seen in https://github.com/jerel/membrane/commit/35b8da1e8982805a1ed91c487a96f9e896617e80
Without the test in that commit skipped, the first error we get is (https://github.com/jerel/membrane/commit/1ea6cdd9b03ee9f7602adb95c9ab0eb3463251f7)
Okay. Easy enough, right? Change
Int64
toLong
(https://github.com/jerel/membrane/commit/3219c7f9d5e8f4e81f0953a2818d39242897a205).Now the fun error happens.
Digging in, it looks like there is no
extension LongPointer on Pointer<Long>
like there is forextension Int64Pointer on Pointer<Int64>
and most of the other types. We can see where they recently added theextension BoolPointer
during some native type work.Do we need a feature request to the Dart SDK? And then we will wait for another language release?
I'm not entirely sure why we need the
asTypedList
part. Is there a way we can work around the lack of it?Potential other solution is finding some way to get the bindings to generate with
Int64
instead ofLong
for Rusti64
.