-
Notifications
You must be signed in to change notification settings - Fork 56
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
Port to Ffigen #25
base: master
Are you sure you want to change the base?
Port to Ffigen #25
Conversation
the current problem seems to be that the ci cant properly run ffigen and the generated files are not present once the flutter build step runs, the generated bindings aren't present. I'm not sure how to fix this. |
I'm pretty sure the ffigen task isn't run by cargo make, at least it doesn't appear in the CI logs. This command only runs task flutterust/.github/workflows/ci.yml Lines 93 to 99 in d7243f2
I think you would want
or something similar ( |
ah, i thought the field in the name would be the command that is run. Never mind then. |
I got the Android part of the CI running with this commit (this is based on your changes here). Flutter SDK wasn't in I'm not sure what' happening in the iOS part of the CI and I don't have access to a mac to debug this locally. |
script = [ | ||
""" | ||
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME} | ||
dart run ffigen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be flutter pub run ffigen
?
script = [ | ||
""" | ||
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/${CARGO_MAKE_CRATE_FS_NAME} | ||
dart run ffigen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, try change it to
flutter pub run ffigen
@arctic-alpaca the IOS build seems to fail because of some defines in it (or probably rather in one of the headers) clashes with a definition in the build-in headers of the macos/ios c++ distribution. Thats probably because apple can't help themselves but deviate from upstream clang whenever they get the chance, so they probably define some stuff they need without a Maybe I can fix that by tweaking the cbindgen settings a bit. But goof to see that it can be made to work in generall. PS: Can i somehow pull in code from other forks into this PR? Or do I have to go in and copy paste the commit? |
I don't think pulling the code is possible, copy paste shouldn't be an issue since my changes are based on your last commit here. Copying over the changed files should suffice. Regarding the iOS issue, I think this might be related to |
So the new Problem is that ffigen can't find the llvm libraries on the build server. Again, the fix is probably easy, but I have no idea where the libraries would be aside from the places ffigen already searches. |
|
With this the port from dart-bindgen to ffigen should be done.
Only thing i see as slightly problematic is the fact that in the generated bindings,
store_dart_post_cobject
takes a int.This shouldn't be a big problem, as any safety guarantees on darts side are out of the window when calling rust anyways, so weather its passing a Pointer or just the address shouldn't matter (to my knowledge, darts pointer class is just a shim over a int anyways)
the second thing would be the fact that ffigen exposes char* as Pointer, where as flutter itself uses Pointer for string related operations. Again, casting them should not be much of a problem, since safety guarantees don't exist in the first place, but its additional friction when using the generated bindings. There seems to be ongoing discussions about this though, and the story will probably improve in the future as dart ffi matures.