Closed bburdette closed 3 months ago
The same problem happened when I used crate sqlite
in my app.
The same problem happened when I used crate
sqlite
in my app.
yeah think I'll try removing the server code altogether and see if it works then.
Ok I commented out the server dependent parts from the code, recompiled and it starts up without crashing. So that should rule out something weird in my setup that prevents any tauri android app from working.
For reference, this is the "Finished dev" bit from the build including my server (with sqlite statically linked and etc).
Finished dev [unoptimized + debuginfo] target(s) in 4.54s
Info symlinking lib "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" in jniLibs dir "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/x86_64"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libandroid.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libdl.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "liblog.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libm.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libc.so"
And here is the same part without the server linked in. Identical list of libs. But perhaps there is another dependency that is not reported here.
Finished dev [unoptimized + debuginfo] target(s) in 11.71s
Info symlinking lib "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" in jniLibs dir "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/x86_64"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libandroid.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libdl.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "liblog.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libm.so"
Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libc.so"
Running with @meowtec 's idea, I put rusqlite in as a dependency (but 'bundled' so should statically link) and got the error again.
So in rusqlites libsqlite3-sys/build.rs there's an env variable, CARGO_CFG_TARGET_OS which can be set to "android". So that's promising. But doing a cargo clean and then a build like this:
CARGO_CFG_TARGET_OS=android cargo tauri android dev
Still has the same crash behavior.
FWIW, a rusqlite maintainer on their discord says rusqlite is in firefox for android, and works there. And that CARGO_CFG_TARGET_OS should be set automatically by cargo.
Digging in a bit more; $ nm libapp_lib.so
reveals:
00000000006a5740 t exprSetHeight
0000000000669180 t exprStructSize
000000000069fdd0 t exprTableColumn
000000000069fcb0 t exprTableRegister
00000000006635e0 t exprToRegister
0000000000664f20 t exprVectorRegister
U __extenddftf2
000000000066ed70 t extendFJMatch
U fchmod
U fchown
U fcntl
00000000005fd5a0 t fcntlSizeHint
0000000000c5e7d0 t fe_0
0000000000c5ba30 t fe_1
0000000000c5bc40 t fe_add
0000000000c5bbc0 t fe_carry
0000000000c63ce0 t fe_cmov
And this symbol is part of libgcc.
So presumably there's a libgcc binary on android that contains this function? Does android need to be told somehow that libgcc is needed for libapp_lib.so?
After doing a bit of reading today, I found out this problem supposedly occurs on x86-64, but not x86. Fired up an x86 android vm and voila, it runs and doesn't crash immediately like before. Hopefully the same will be true of arm targets.
This comment, when translated from the chinese, indicates success with clang compilation.
Its maybe possible an update in the android NDK would fix things, or reverting to an earlier version that still has libgcc in it would help.
There's this mozilla issue. They had a similar approach to our friend above, linking libclang_rt.builtins-x86_64-android for the x86-64 target.
Coming back to this to report success with arm builds too, at least it works with my oneplus 6.
Waiting a solution for x86_64 ABI😫
I'll close this one since it's not under our control, it's a rusqlite thing. See https://github.com/rusqlite/rusqlite/issues/1380 I've faced this issue before and the solution on this repo worked well: https://github.com/smartvaults/smartvaults/blob/be6fc3e1377a29942395c41fdd1ae7de86985286/bindings/smartvaults-sdk-ffi/build.rs#L16
Describe the bug
The error:
`cargo tauri android dev` succeeds (with a lot of rust warnings, sorry):
``` [bburdette@HOSS:~/code/zknotes/zknotes/tauri/src-tauri]$ cargo tauri android dev Info Detected connected device: Pixel_3a_API_33_x86_64 (sdk_gphone64_x86_64) with target "x86_64-linux-android" Warn Waiting for your frontend dev server to start on http://10.0.0.85:8010/... Warn Waiting for your frontend dev server to start on http://10.0.0.85:8010/... Warn Waiting for your frontend dev server to start on http://10.0.0.85:8010/... Info detected host target triple "x86_64-unknown-linux-gnu" warning: skipping duplicate package `api` found at `/home/bburdette/.cargo/git/checkouts/tauri-9dcc2f9152472c1a/38d0bed/examples/web/core/api` warning: skipping duplicate package `app` found at `/home/bburdette/.cargo/git/checkouts/tauri-9dcc2f9152472c1a/38d0bed/tooling/cli/node/test/jest/fixtures/app/src-tauri` Compiling wry v0.28.3 Compiling tauri v2.0.0-alpha.10 (https://github.com/tauri-apps/tauri?rev=38d0bed8ebb6c5872fc54903051d146d386b721e#38d0bed8) warning: unused import: `warn` --> orgauth/rustlib/src/endpoints.rs:12:24 | 12 | use log::{error, info, warn}; | ^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused variable: `reg_key` --> orgauth/rustlib/src/endpoints.rs:118:20 | 118 | Some(ref reg_key) => { | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_reg_key` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `name` --> orgauth/rustlib/src/endpoints.rs:508:10 | 508 | let (name, token) = dbfun::change_email(&conn, uid, cp.clone())?; | ^^^^ help: if this is intentional, prefix it with an underscore: `_name` warning: unused variable: `token` --> orgauth/rustlib/src/endpoints.rs:508:16 | 508 | let (name, token) = dbfun::change_email(&conn, uid, cp.clone())?; | ^^^^^ help: if this is intentional, prefix it with an underscore: `_token` warning: unused `Result` that must be used --> orgauth/rustlib/src/endpoints.rs:53:5 | 53 | self.session.insert("token", uuid); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default warning: `orgauth` (lib) generated 5 warnings (run `cargo fix --lib -p orgauth` to apply 4 suggestions) warning: unused import: `actix_web::HttpRequest` --> server-lib/src/interfaces.rs:5:5 | 5 | use actix_web::HttpRequest; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `std::io::Read` --> server-lib/src/lib.rs:35:5 | 35 | use std::io::Read; | ^^^^^^^^^^^^^ warning: variable does not need to be mutable --> server-lib/src/lib.rs:72:7 | 72 | let mut staticpath = data.static_path.clone().unwrap_or(PathBuf::from("static/")); | ----^^^^^^^^^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: unused import: `Tokener` --> server-lib/src/lib.rs:27:51 | 27 | use orgauth::endpoints::{ActixTokener, Callbacks, Tokener}; | ^^^^^^^ warning: function `search_zknotes_simple` is never used --> server-lib/src/search.rs:243:8 | 243 | pub fn search_zknotes_simple( | ^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: function `build_simple_sql` is never used --> server-lib/src/search.rs:321:8 | 321 | pub fn build_simple_sql( | ^^^^^^^^^^^^^^^^ warning: `zknotes-server-lib` (lib) generated 6 warnings (run `cargo fix --lib -p zknotes-server-lib` to apply 3 suggestions) Compiling zknotes-app v0.1.0 (/home/bburdette/code/zknotes/zknotes/tauri/src-tauri) Compiling tauri-runtime-wry v0.13.0-alpha.6 (https://github.com/tauri-apps/tauri?rev=38d0bed8ebb6c5872fc54903051d146d386b721e#38d0bed8) warning: unused import: `zknotes_server_lib::err_main` --> tauri/src-tauri/src/commands.rs:3:5 | 3 | use zknotes_server_lib::err_main; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused imports: `Callbacks`, `Tokener` --> tauri/src-tauri/src/commands.rs:5:46 | 5 | use zknotes_server_lib::orgauth::endpoints::{Callbacks, Tokener, UuidTokener}; | ^^^^^^^^^ ^^^^^^^ warning: unused variable: `e` --> tauri/src-tauri/src/commands.rs:36:9 | 36 | Err(e) => ServerResponse { | ^ help: if this is intentional, prefix it with an underscore: `_e` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `e` --> tauri/src-tauri/src/commands.rs:56:9 | 56 | Err(e) => ServerResponse { | ^ help: if this is intentional, prefix it with an underscore: `_e` warning: unused variable: `e` --> tauri/src-tauri/src/commands.rs:78:9 | 78 | Err(e) => WhatMessage { | ^ help: if this is intentional, prefix it with an underscore: `_e` warning: `zknotes-app` (lib) generated 5 warnings (run `cargo fix --lib -p zknotes-app` to apply 5 suggestions) Finished dev [unoptimized + debuginfo] target(s) in 5.39s Info symlinking lib "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" in jniLibs dir "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/x86_64" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libandroid.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libdl.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "liblog.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libm.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libc.so" Info symlink at "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/x86_64/libapp_lib.so" points to "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" Info Accepting new connection 1/100 Error WS transport error: i/o error: Broken pipe (os error 32); terminate connection: 0 warning: skipping duplicate package `api` found at `/home/bburdette/.cargo/git/checkouts/tauri-9dcc2f9152472c1a/38d0bed/examples/web/core/api` warning: skipping duplicate package `app` found at `/home/bburdette/.cargo/git/checkouts/tauri-9dcc2f9152472c1a/38d0bed/tooling/cli/node/test/jest/fixtures/app/src-tauri` Compiling wry v0.28.3 Compiling tauri v2.0.0-alpha.10 (https://github.com/tauri-apps/tauri?rev=38d0bed8ebb6c5872fc54903051d146d386b721e#38d0bed8) warning: unused import: `warn` --> orgauth/rustlib/src/endpoints.rs:12:24 | 12 | use log::{error, info, warn}; | ^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused variable: `reg_key` --> orgauth/rustlib/src/endpoints.rs:118:20 | 118 | Some(ref reg_key) => { | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_reg_key` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `name` --> orgauth/rustlib/src/endpoints.rs:508:10 | 508 | let (name, token) = dbfun::change_email(&conn, uid, cp.clone())?; | ^^^^ help: if this is intentional, prefix it with an underscore: `_name` warning: unused variable: `token` --> orgauth/rustlib/src/endpoints.rs:508:16 | 508 | let (name, token) = dbfun::change_email(&conn, uid, cp.clone())?; | ^^^^^ help: if this is intentional, prefix it with an underscore: `_token` warning: unused `Result` that must be used --> orgauth/rustlib/src/endpoints.rs:53:5 | 53 | self.session.insert("token", uuid); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default warning: `orgauth` (lib) generated 5 warnings (run `cargo fix --lib -p orgauth` to apply 4 suggestions) warning: unused import: `actix_web::HttpRequest` --> server-lib/src/interfaces.rs:5:5 | 5 | use actix_web::HttpRequest; | ^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `std::io::Read` --> server-lib/src/lib.rs:35:5 | 35 | use std::io::Read; | ^^^^^^^^^^^^^ warning: variable does not need to be mutable --> server-lib/src/lib.rs:72:7 | 72 | let mut staticpath = data.static_path.clone().unwrap_or(PathBuf::from("static/")); | ----^^^^^^^^^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: unused import: `Tokener` --> server-lib/src/lib.rs:27:51 | 27 | use orgauth::endpoints::{ActixTokener, Callbacks, Tokener}; | ^^^^^^^ warning: function `search_zknotes_simple` is never used --> server-lib/src/search.rs:243:8 | 243 | pub fn search_zknotes_simple( | ^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: function `build_simple_sql` is never used --> server-lib/src/search.rs:321:8 | 321 | pub fn build_simple_sql( | ^^^^^^^^^^^^^^^^ warning: `zknotes-server-lib` (lib) generated 6 warnings (run `cargo fix --lib -p zknotes-server-lib` to apply 3 suggestions) Compiling zknotes-app v0.1.0 (/home/bburdette/code/zknotes/zknotes/tauri/src-tauri) Compiling tauri-runtime-wry v0.13.0-alpha.6 (https://github.com/tauri-apps/tauri?rev=38d0bed8ebb6c5872fc54903051d146d386b721e#38d0bed8) warning: unused import: `zknotes_server_lib::err_main` --> tauri/src-tauri/src/commands.rs:3:5 | 3 | use zknotes_server_lib::err_main; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused imports: `Callbacks`, `Tokener` --> tauri/src-tauri/src/commands.rs:5:46 | 5 | use zknotes_server_lib::orgauth::endpoints::{Callbacks, Tokener, UuidTokener}; | ^^^^^^^^^ ^^^^^^^ warning: unused variable: `e` --> tauri/src-tauri/src/commands.rs:36:9 | 36 | Err(e) => ServerResponse { | ^ help: if this is intentional, prefix it with an underscore: `_e` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `e` --> tauri/src-tauri/src/commands.rs:56:9 | 56 | Err(e) => ServerResponse { | ^ help: if this is intentional, prefix it with an underscore: `_e` warning: unused variable: `e` --> tauri/src-tauri/src/commands.rs:78:9 | 78 | Err(e) => WhatMessage { | ^ help: if this is intentional, prefix it with an underscore: `_e` warning: `zknotes-app` (lib) generated 5 warnings (run `cargo fix --lib -p zknotes-app` to apply 5 suggestions) Finished dev [unoptimized + debuginfo] target(s) in 4.54s Info symlinking lib "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" in jniLibs dir "/home/bburdette/code/zknotes/zknotes/tauri/src-tauri/gen/android/app/src/main/jniLibs/x86_64" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libandroid.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libdl.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "liblog.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libm.so" Info "/home/bburdette/code/zknotes/zknotes/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libc.so" Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/8.0/userguide/command_line_interface.html#sec:command_line_warnings Performing Streamed Install Success Starting: Intent { cmp=com.zknotes.zknotes_app/.MainActivity } ```On the android VM, the app appears and immediately disappears again. But I don't get any crash messages.
Then, if I find the app in the android menu and start it, I get this
![image](https://github.com/tauri-apps/tauri/assets/157330/9f716ab1-8b78-4cc5-a272-02882885d7df) And in the console: ``` Info Watching /home/bburdette/code/zknotes/zknotes/zkprotocol for changes... Info Watching /home/bburdette/code/zknotes/zknotes/server for changes... Info Watching /home/bburdette/code/zknotes/zknotes/server-lib for changes... Info Watching /home/bburdette/code/zknotes/zknotes/orgauth/rustlib for changes... Info Watching /home/bburdette/code/zknotes/zknotes/tauri/src-tauri for changes... --------- beginning of main 07-12 08:17:11.247 5418 5418 I tes.zknotes_app: Late-enabling -Xcheck:jni 07-12 08:17:11.357 5418 5418 W tes.zknotes_app: Unexpected CPU variant for x86: x86_64. 07-12 08:17:11.357 5418 5418 W tes.zknotes_app: Known variants: atom, sandybridge, silvermont, kabylake, default 07-12 08:17:11.433 5418 5418 W ziparchive: Unable to open '/data/app/~~NzbfTP5fr--KRanTlXYCmQ==/com.zknotes.zknotes_app-LiJxE8nxNzlZ5FWeGRretw==/base.dm': No such file or directory 07-12 08:17:11.434 5418 5418 W ziparchive: Unable to open '/data/app/~~NzbfTP5fr--KRanTlXYCmQ==/com.zknotes.zknotes_app-LiJxE8nxNzlZ5FWeGRretw==/base.dm': No such file or directory --------- beginning of crash 07-12 08:17:11.613 5418 5418 E AndroidRuntime: FATAL EXCEPTION: main 07-12 08:17:11.613 5418 5418 E AndroidRuntime: Process: com.zknotes.zknotes_app, PID: 5418 07-12 08:17:11.613 5418 5418 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__extenddftf2" referenced by "/data/app/~~NzbfTP5fr--KRanTlXYCmQ==/com.zknotes.zknotes_app-LiJxE8nxNzlZ5FWeGRretw==/base.apk!/lib/x86_64/libapp_lib.so"... 07-12 08:17:11.613 5418 5418 E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1077) 07-12 08:17:11.613 5418 5418 E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:998) 07-12 08:17:11.613 5418 5418 E AndroidRuntime: at java.lang.System.loadLibrary(System.java:1661) 07-12 08:17:11.613 5418 5418 E AndroidRuntime: at com.zknotes.zknotes_app.WryActivity.my repo at the point where this error occurred.
Reproduction
Expected behavior
successful start, or at least no crash
Platform and versions
Stack trace