-
Notifications
You must be signed in to change notification settings - Fork 303
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
codegen produces dart code with incorrect types, including on examples - caused by external tool ffigen
fail to find stdarg.h
headers
#53
Comments
Hi! Thanks for opening your first issue here! 😄 |
Hi, let me have a look. |
could you plz provide
It runs well on my machine, on GitHub CI's linux (ubuntu), macos, and windows. (see the CI workflow for your reference: https://github.com/fzyzcjy/flutter_rust_bridge/blob/master/.github/workflows/codegen.yml )So I guess there may be a configuration problem? Maybe also related to external tools like ffigen and cbindgen that I use internally. Thus more info is needed before I figure out what is happening. |
By the way, that is most probably not problems in my code but problems related to ffigen/cbindgen. Since those "wire" things are not generated by my code, but generated by ffigen/cbindgen. But of course I will debug it. |
I'm happy to take a swing at debugging this if you would prefer, just wanted to confirm that it was actually a problem caused by my setup first. OS is void linux, it's up to date and a normal enough rolling release linux distro (like arch) except for not using systemd (not relevant here).
Note, flutter_rust_bridge_codgen was installed from git commit
(incidentally, cbindgen 0.19.0 doesn't work properly, I was failing with that earlier)
(Note: Had to change extension from .dart to .log to get github to let me attach that) |
😄 Looking at your bridge_generated.dart it is quite strange (I paste below for convenience). It seems to not understand types. Moreover, seems that Could you plz provide more info?
|
How did you make that collapsable details tag? Generated rust code is the same C output
Debug log |
by the way I have add: 7e5b194
|
you need to have a newline between < details > and the ``` |
Well, cbindgen (rust->c) seems good. Maybe a bug in ffigen(c->dart)? could you plz print its version notice that all these has nothing related to this lib indeed ;) what my lib generates is those wrappers against raw c pointers and types |
|
oops wait a bit
log clearly indicates this problem
|
Wait... that's slightly old (4.1.0 exists), let me try updating that |
conclusion: maybe this is the problem |
Hmm, ok... 4.1.0 doesn't change anything by the way. stdarg.h does exist... Actually this is probably the right instance of stedarg.h, anyways a lot of copies of it exist: |
let me add some logs, such that you can easily reproduce it in a shell by yourself. |
I think I can reproduce this, the command I need is in the logs
|
yes. but that temp file (config) will be deleted after run imho. my new commit: 3ff8340 prints out whole config. so you can copy and paste. maybe use that new commit, and reproduce it in your shell, and see. |
Awesome, thanks |
You are welcome! |
btw you may create an issue in ffigen if it still errors. |
It is still erroring, I may end up doing that, but want to see if I can debug it first (even if I can debug it, I may end up doing that...) dart-lang/native#389 is similar, but I can actually build the .c file into a .o with clang, so it's not the case here that clang can't find the header at all... |
Hmm then I cannot help you much, since I am not an expert in But if you find the solution and need me to change code in this repo, feel free to ask! |
ffigen
fail to find headers
Heh, so I can get it it find stdarg.h, by cd-ing to It's been a long day for me today, so I'm going to put this down for the night and figure out how to fix it properly tomorrow (and open issues in the relevant places then). I'm pretty sure this is purely a ffigen (or even libclang) issue, so you could close this out for now, or leave it open and I'll close it out once the issue is fully resolved. Thanks for all your help and super prompt response! |
You are welcome! Happy to hear that you find out something towards the solution! Just leave this issue open, and we can close it after everything is finished. |
ffigen
fail to find headersffigen
fail to find stdarg.h
headers
Seems to be same issue: dart-lang/native#417 |
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue. |
Hey, I'm trying to try this out, and I'm having an issue even get basic examples to work. The generated
store_dart_post_cobject
method has an incorrect type, resulting in an error:This happens even when trying to regenerate the example code! Is it possible the code generator is out of sync with the library code? (I installed it for these tests directly from the most recent master, but first ran into the issue with the version on crates.io)
Specifically for the example - running
flutter_rust_bridge_codegen --rust-input rust/src/api.rs --dart-output dart/lib/bridge_generated.dart
infrb_example/pure_dart/dart
results in the non-whitespace changes (generated with:git diff -w --word-diff-regex='[^[:space:]]' lib/bridge_generated.dart
) far below, and attempting to run the code results in the error immediately below:The text was updated successfully, but these errors were encountered: