-
Notifications
You must be signed in to change notification settings - Fork 309
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
I am trying to use sqlx for sqlite through rust frb v2
#1719
Comments
Looks like this symbol is not found, thus this may not be a bug of flutter_rust_bridge, but related to how the Rust code is copiled. One reason may be that, sqlx/sqlite needs some special configurations in order to be used on android. |
Yeah, it is working on real device, but not on emulator. |
Aha, then is it possible because sqlx/sqlite does not have things like precompiled binaries for x86/x64? |
yeah exactly, trying to figure out whether there is any other way around. btw tried rusqlite, that too didn't worked on emulator. |
Then one way may be to ask in wrapper libs like sqlx, e.g. I guess maybe they will add x64 files. |
Seems like even Mozilla also faced similar issues there is some NDK version issues, and setting up the compiler for x86_x64 |
@debojyoti452 How do you have your project configured? I am currently using sqlcipher with sqlx via FRB. I had to configure Here's a snippet from my libsqlite3-sys = { version = "*", features = [
"bundled-sqlcipher-vendored-openssl",
] }
sqlx = { version = "0.7", features = [
"sqlite",
"runtime-tokio",
"macros",
"uuid",
"chrono",
] } |
Thanks @gridbox for the suggestion. I am currently shifted to rusqlite. But not working on android emulator. Working fine on real device though. And working fine all other platforms too. |
@fzyzcjy btw is there any way we can set NDK version? |
x86 emulator working fine, but not at all able to make it work on x86_x64 emulator 😢 |
Since flutter_rust_bridge is using cargokit for the default template (assuming you are using the default template), I guess cargokit may have some options to configure that. |
@fzyzcjy trying to find it in |
I had a problem getting sqlite projects to build for Android using uniffi. This comment pointed me in the right direction. This is what my use std::env;
fn main() {
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
if target_arch == "x86_64" && target_os == "android" {
let android_home = env::var("ANDROID_HOME").expect("ANDROID_HOME not set");
const ANDROID_NDK_VERSION: &str = "26.1.10909125";
const LINUX_X86_64_LIB_DIR: &str =
"toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/";
println!("cargo:rustc-link-search={android_home}/ndk/{ANDROID_NDK_VERSION}/{LINUX_X86_64_LIB_DIR}");
println!("cargo:rustc-link-lib=static=clang_rt.builtins-x86_64-android");
}
} Modified from this build.rs. Note that I haven't tried this with frb yet so this might not work as is. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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
I am trying to use sqlx for sqlite through
rust frb v2
but getting this error on android run. Building is working fine.Steps to reproduce
Hint: A simple way to reproduce is to clone and modify the https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/dart_minimal example package according to your needs.
Logs
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of
flutter_rust_bridge_codegen
No response
Flutter info
No response
Version of
clang++
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: