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
[Bug] Compiles with 1.51, does not compile with 1.53. #877
Comments
Hi! Thanks for opening your first issue here! 😄 |
maybe try to upgrade frb_dart dependency as well |
Can confirm I can replicate this bug too, and that 1.51 seems to work ok. Whilst this is worked on it might be worth rolling back to 1.51? It took an amount of troubleshooting to realise why this was happening only in CI because if you use the semver ^ notation locally (such as ^1.48.0) then you wouldn't see this problem without running flutter pub upgrade. (which is what happened to me - might be nice to save others the trouble) |
/cc @rogurotus who implemented the wonderful opaque feature - maybe we forget to generate those functions under the conditions mentioned in this port? |
cargo.toml use flutter_rust_bridge 1.53? |
it looks like an old version of frb is used for rust |
Checking this morning using 1.54.0 in both it does seem to work correctly, at least on my end. |
Same issue for me using 1.53.0 and unfortunately 1.54.0, I have tried clearing the various caches, restarting the machine and the device. |
@stevehayles have you updated the cargo.toml to use latest version? please paste the toml and lock files |
Hi @fzyzcjy , thanks for your response. The code all looks correct, clearly something not right on my machine, I have done a cargo update and the lock file contains 1.54.0 but the new opaque functions are not being generated. I'll reboot this machine (which is slow!) and then pull the repo to another dev machine to test it there. I have read through the recent commits now, something is wrong my end sorry |
Hi @fzyzcjy , further to my last post, on two machines this is not working for me lock file is large but contains
the flutter pub cache only contains '.pub-cache\hosted\pub.dartlang.org\flutter_rust_bridge-1.54.0' and no other versions Dart analyzer complains with the following and the methods are missing in bridge_generated.dart
I can roll back to 1.51 and it works fine but would be great to try the new opaque types!! |
/cc @rogurotus |
code-generating not through build.rs? |
I do think I had to directly call codegen when I got mine to work, the build.rs in the docs wasn't auto generating it. |
running |
Could you try the build.rs in the docs to check that it automatically regenerates still? |
@rob-mur I will try it now yes. Having got rid of the analyzer errors and the wrapper code being correctly generated I actually can't succesfully compile code that was working fine before the 'updates'. I get the error
Not totally sure if it's related or not, but immediately prior to the update to 1.54 and the installation of the flutter_rust_bridge_codegen package it compiled fine |
Interesting, could you post the full verbose log? (With the -v as it suggests) |
I am not sure the -v has been passed to the right part of the script but here is the invocation log
|
Don't personally recognise ldart so unsure why it would be missing/a problem. Does the crate build if you just run cargo build in the rust project? I would try a full clean i.e. flutter pub cache clean and cargo clean before trying to rebuild to see if that helps. Then if not potentially try building the example project on your pc to see if it's specific to your project or not. |
It's a strange one, I agree probably something around my specific problem. Just for other people's information, a full clean and rebuild on both the Flutter and Rust side does not fix it. Reverting back to version 1.51 of all packages is an instant fix, I'll try the sample project and move my project to another machine to see if it becomes clearer. Thanks for your help to date |
I upgraded to 1.54.0 and everything seems to work again. I ran the following, inspired by what was suggested above:
I would personally be happy to close the issue, but enough other discussion has happened that I wouldn't want to shut it down unilaterally. Thanks to everyone for your help! |
I would also like to keep it open a little longer as now having some problems with my web builds - may be entirely unrelated but want to double check first! |
Was indeed unrelated - happy for this to be closed! |
I will close this on Tuesday morning if nobody else sees a reason for it to remain open. |
This appears to be a problem that effects Windows machines, I can compile my fairly complex project and the basic example in a linux container but neither will compile on my Windows laptop under 1.53 or 1.54. In this code it appears that there needs to be a compiler flag set on Windows to statically link dart.lib. I am a fairly new Rust 'guy' and can't quite see how to fix this from my application code but I do think it's a persistent problem that will be seen again within FRB It's slightly drifted off-topic from the original issue raised here but the version numbers are relevant so it would be great to get one of the core team to have a look at it |
My working version is being built on Linux (both locally and in CI) so could well be a windows thing. I can see the build.rs differs from the one described in the user guide. Is it possible to try your usecase using frb_codegen? |
The rust binary builds without issue, the issue comes when running In the dart_sys github repo there is a comment that states "According to https://dart.dev/server/c-interop-native-extensions#appendix-compiling-and-linking-extensions only on windows we need linking with dart.lib, so we can simply skip this step on unix." That original link is now replaced but I have read about dart.lib needing to be linked on Windows only in other places online and I am fairly sure it's where the issue lies here |
I think I have found the problem! Since the inclusion of the dart-sys package the dart.lib library needs linking but only on Windows targets. Looking at the dart-sys source code the build.rs script is aware of this and tries to deal with it
The issue is that in a build.rs file the cfg(windows) attribute relates to the host and not the target so even though we are targetting an Android OS the
I have checked that this correctly still works targetting Windows. I can try and create a pull request to dart-sys but I would like someone more conversant with this library than me to comment on whether that's the right way to fix it |
Thanks @stevehayles. I recompiled again today, and I actually ran into this same problem - it looks like my previous posting of success was premature. Still not sure why it worked one day and failed another. So it goes. Even reverting to 1.51.0 did not solve the problem. Here's the linker error message:
Looking forward to the patch. |
@gjf2a I was very surprised that you had not seen the issue on Windows in version +1.53 as it seemed to be a fairly certain bug. I have created a PR for my suggestion of a fix in the dart-sys library but it's a third party library that hasn't been touched in three years so we will have to see how that goes... If it's not successful then the owners of FRB can make a call on whether they fork that library or include it's code directly. It is clear that the problem exists for anyone developing or compiling on windows and it would be great to get it fixed properly |
@stevehayles actually my problems began when I upgraded to 1.53. At 1.51, where I had been until last week, everything had worked fine. I'm currently struggling to revert - no matter what I do, it keeps using 1.54 when I'm compiling with Rust. I've cargo-cleaned, cleaned the cargo cache, deleted the git and registry directories, even deleted my project and re-cloned from GitHub. I'm ready to try uninstalling Rust entirely and reinstalling it, but I have so much in place for various projects that I am loath to do so. |
I've seen similar issues, normally manually deleting the obvious files from your ~/.cargo directory can solve this sort of problem. Rust almost exclusively uses this for packages and binaries. |
Yeah, I've had success with that in the past. But I've deleted git, registry, and .package-cache. I can't fathom where else it is hanging on to this. |
/cc @rogurotus What do you think? |
+1 same issue |
I think we just need to remove |
have you tried this? |
@rogurotus I've tried this already and it did not help. |
Try running |
see #893 |
1.54.1 is released |
1.54.1 did the trick! I will leave this open for a day or two in case any related troubles emerge again. Thanks everyone for all your help! |
I can confirm that dropping all previous changes and updating to 1.54.1 solves the issue for me. Thanks to @rogurotus for the fix and everyone else for their help |
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. |
Describe the bug
My project is at https://github.com/gjf2a/groundline.
It compiles and runs perfectly well with frb 1.51.0.
It does not compile with frb 1.53.0. I was careful to run
flutter pub upgrade
and then regenerate the bridge code after upgrading. If I switch back to 1.51.0, it compiles and runs with no trouble whatsoever.Here is the error message:
Codegen logs with
RUST_LOG=debug
environment variableTo Reproduce
Clone https://github.com/gjf2a/groundline
flutter run
Expected behavior
I expected the app to run.
Generated binding code
OS
Windows
Version of
flutter_rust_bridge_codegen
1.53.0
Flutter info
Version of
clang++
No response
Version of
ffigen
7.2.2
Additional context
No response
The text was updated successfully, but these errors were encountered: