-
Notifications
You must be signed in to change notification settings - Fork 316
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
cargo-ndk 2.7.0 breaks with_flutter example for Android #419
Comments
Good issue description! So what do you suggest this library to do? Shall we just document this, or change some of the build script? /cc @Desdaemon What do you think? |
It's unfortunate that in trying to integrate with |
@Desdaemon Totally agree. This library is indeed just a code generator, but it is complex to integrate any Rust code with any Flutter code (even without this bridge). |
I think we can keep the current set up but change the |
@AlienKevin Good idea. Looking forward to your PR |
Sounds good, made a PR. |
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
Summary
cargo-ndk
2.7.0 breaks NDK 22. I attempted to bump NDK to latest version 24. The library -lgcc not found error is still not fixed. I then found a workaround that made the example app compile and run on Android successfully.cargo-ndk breaks NDK 22
Recently on Mar 22, 2022, the
cargo-ndk
package bumped its version to 2.7.0. Following the tutorial on setting up Android, I rancargo install cargo-ndk
which installed the latest 2.7.0 version ofcargo-ndk
. Then, I ran the following command to build for Android:cargo-ndk threw an error:
I tracked down the error and found that the a new function was added to cargo-ndk which checks for a
source.properties
file in the~/Library/Android/sdk
folder. For NDK version 22, the file is not present.Attempt to bump my NDK from 22 to 24
So I bumped my NDK version to
NDK (Side by side) 24.0.8215888
using the SDK manager in Android Studio. And I encountered an old bug related to libgcc:The PR to rust-lang/rust referenced by cargo-ndk is merged on Jun 4, 2021 but doesn't resolve the error for released Rust toolchains. Instead, it requires a custom std builds. The NDK on CI is still old, and will always result in linking to libgcc in released Rust toolchains.
Workaround for libgcc not found
libunwind.a
On PC, it's
and three other similar folders.
On macOS Monterey (Apple Silicon), it's
and three other similar folders.
The three other folders end with
aarch64
,arm
,i386
instead ofx86_64
.libgcc.a
in the four folders mentioned above with this contentsReference: rust-lang/rust#85806 (comment)
Result
After doing the workaround, the example app compiles and runs successfully on my Android phone.
Codegen logs with
RUST_LOG=debug
env variableTo Reproduce
No response
Expected behavior
No response
Generated binding code
No response
OS
macOS Monterey (Apple Silicon)
Version of
flutter_rust_bridge_codegen
No response
Flutter info
No response
Version of
clang++
No response
Version of
cbindgen
No response
Version of
ffigen
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: