sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

android compilation fails

Open doums opened this issue 2 years ago • 5 comments

Bug Description

Hi, we are using tauri to build a project for android. We have sqlx as a dependency with sqlite feature enabled. When we try to build the app on android, the compilation fails with this error:

Compiling ...
error: linking with `/home/pierre/.local/share/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android24-clang` failed: exit status: 1
  |app:rustBuildX86_64Debug
  = note: "/home/pierre/.local/share/android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android24-clang" "-m64" "/tmp/rustcxs0jcl/symbols.o" [...] "-Wl,--gc-sections" "-pie"
 "-Wl,-zrelro,-znow" "-nodefaultlibs" "-landroid" "-llog" "-lOpenSLES"
  = note: ld: error: undefined symbol: __extenddftf2
          >>> referenced by sqlite3.c:29950 (sqlite3/sqlite3.c:29950)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29952 (sqlite3/sqlite3.c:29952)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29980 (sqlite3/sqlite3.c:29980)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced 4 more times
          
          ld: error: undefined symbol: __lttf2
          >>> referenced by sqlite3.c:29963 (sqlite3/sqlite3.c:29963)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29996 (sqlite3/sqlite3.c:29996)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29997 (sqlite3/sqlite3.c:29997)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced 1 more times
          
          ld: error: undefined symbol: __trunctfdf2
          >>> referenced by sqlite3.c:29975 (sqlite3/sqlite3.c:29975)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29980 (sqlite3/sqlite3.c:29980)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29985 (sqlite3/sqlite3.c:29985)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced 4 more times
          
          ld: error: undefined symbol: __multf3
          >>> referenced by sqlite3.c:29980 (sqlite3/sqlite3.c:29980)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29992 (sqlite3/sqlite3.c:29992)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29992 (sqlite3/sqlite3.c:29992)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced 12 more times
          
          ld: error: undefined symbol: __addtf3
          >>> referenced by sqlite3.c:29980 (sqlite3/sqlite3.c:29980)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29981 (sqlite3/sqlite3.c:29981)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:30012 (sqlite3/sqlite3.c:30012)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          
          ld: error: undefined symbol: __gttf2
          >>> referenced by sqlite3.c:29990 (sqlite3/sqlite3.c:29990)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:84101 (sqlite3/sqlite3.c:84101)
          >>>               sqlite3.o:(sqlite3IntFloatCompare) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          
          ld: error: undefined symbol: __getf2
          >>> referenced by sqlite3.c:29992 (sqlite3/sqlite3.c:29992)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29993 (sqlite3/sqlite3.c:29993)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:29994 (sqlite3/sqlite3.c:29994)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced 1 more times
          
          ld: error: undefined symbol: __divtf3
          >>> referenced by sqlite3.c:29995 (sqlite3/sqlite3.c:29995)
          >>>               sqlite3.o:(sqlite3_str_vappendf) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:33174 (sqlite3/sqlite3.c:33174)
          >>>               sqlite3.o:(sqlite3AtoF) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:33194 (sqlite3/sqlite3.c:33194)
          >>>               sqlite3.o:(sqlite3AtoF) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          
          ld: error: undefined symbol: __fixtfsi
          >>> referenced by sqlite3.c:29563 (sqlite3/sqlite3.c:29563)
          >>>               sqlite3.o:(et_getdigit) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          
          ld: error: undefined symbol: __floatsitf
          >>> referenced by sqlite3.c:29564 (sqlite3/sqlite3.c:29564)
          >>>               sqlite3.o:(et_getdigit) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          
          ld: error: undefined symbol: __subtf3
          >>> referenced by sqlite3.c:29566 (sqlite3/sqlite3.c:29566)
          >>>               sqlite3.o:(et_getdigit) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          
          ld: error: undefined symbol: __floatditf
          >>> referenced by sqlite3.c:33174 (sqlite3/sqlite3.c:33174)
          >>>               sqlite3.o:(sqlite3AtoF) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:33177 (sqlite3/sqlite3.c:33177)
          >>>               sqlite3.o:(sqlite3AtoF) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced by sqlite3.c:33194 (sqlite3/sqlite3.c:33194)
          >>>               sqlite3.o:(sqlite3AtoF) in archive /home/pierre/Documents/nym/nym/nym-connect/src-tauri/target/x86_64-linux-android/debug/deps/liblibsqlite3_sys-5f379e2f837b94c7.rlib
          >>> referenced 2 more times
          clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

Environment

  • sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate"] }
  • OS: Arch Linux Unknown X64
  • rustup: 1.25.1
  • rustc: 1.66.1
  • cargo: 1.66.1
  • Rust toolchain: stable-x86_64-unknown-linux-gnu

doums avatar Jan 13 '23 11:01 doums

This seems to be issue with linker on the Android platform not being able to find dependencies. Do you have all required sqllite dev packages present?

VersBinarii avatar Jan 13 '23 20:01 VersBinarii

Hey, you mean on the android target device (which is an android emulator in my case)?

In nym-connect/src-tauri/gen/android/nym_connect/app/build.gradle.kts I added sqlite dependency

dependencies {
    [...]
    implementation("androidx.sqlite:sqlite:2.3.0")
    implementation("androidx.sqlite:sqlite-ktx:2.3.0")
    implementation("androidx.sqlite:sqlite-framework:$2.3.0")
}

But does not fix the issue

doums avatar Jan 14 '23 13:01 doums

@doums did you ever find a workaround for this issue?

goosetherumfoodle avatar May 09 '23 20:05 goosetherumfoodle

nope (since I stopped spending time on this issue)

doums avatar May 09 '23 20:05 doums

Running into the same issue but with postgres

ghostdevv avatar Aug 21 '24 05:08 ghostdevv

I had a similar issue and solved it like this: https://github.com/fzyzcjy/flutter_rust_bridge/issues/1844#issuecomment-2030148805

loikki avatar Dec 19 '24 20:12 loikki