Skip to content
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

Tracking issue: Android Support #68

Open
asg017 opened this issue Aug 7, 2024 · 3 comments
Open

Tracking issue: Android Support #68

asg017 opened this issue Aug 7, 2024 · 3 comments

Comments

@asg017
Copy link
Owner

asg017 commented Aug 7, 2024

sqlite-vec successfully compiles and run on Android (from what I tried on Termux on an old phone).

But how can we package and distribute sqlite-vec to make it easier for Android developers to use?

I don't know much about Android development or packages, so any help and insight would be greatly appreciated. I specifically have the following questions, so please answer in this thread if you know of an answer!

  • What Android SQLite client libraries are popular, and do they support dynamically loading SQLite extensions?
  • What "package managers" exist for 3rd party Android libraries?
  • How do Android libraries typically bundle pre-compiled shared object files?

P.S. - if you're company or organization would benefit from sqlite-vec on Android, I'd love to have you as a sponsor!

@Vali-98
Copy link

Vali-98 commented Aug 23, 2024

On the react-native side, expo-sqlite is capable of loading .so files as sqlite3 plugins with a bit of patching, as demonstrated in this patch file I made for my react-native app: https://github.com/Vali-98/ChatterUI/blob/master/patches/expo-sqlite%2B14.0.5.patch

Said function is unfortunately not exposed to the JS side of the library as of writing, but can be worked around.

For whatever reason, .so files in react-native seem to cause issues if not following the convention of lib<name>.so stemming from some mechanism in the SoLoader library used to load source files. I found that if proguard rules stripped the SoLoader errors, it will lead to a crash.

I would recommend the android source files be named libsqlitevec.so or something of that nature.

@waqasakram117
Copy link

waqasakram117 commented Aug 25, 2024

  • What Android SQLite client libraries are popular, and do they support dynamically loading SQLite extensions?
  • What "package managers" exist for 3rd party Android libraries?
  • How do Android libraries typically bundle pre-compiled shared object files?
  • Room is a popular library for sqlite3 and official ORM from Google. No, it doesn't support dynamic loading.
  • Maven Center can be used to distribute native/java/kotlin libraries
  • Shared objects should be compiled through NDK (Android Native Development Kit) then they can't be shared/embedded through cmake.

@ospfranco
Copy link

Hey, I'm the author of op-sqlite. I want to integrate sqlite-vec into my library. The best way you can help RN, Android (and IOS) devs is by adding a make file rule that compiles an .so for android and a .a for iOS with a rule in the makefile.

For Android you need to be able to compile to 4 archs:

"x86_64-apple-ios", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-linux-android", "armv7-linux-androideabi", "x86_64-linux-android", "i686-linux-android"

At least on Rust those are the name of the archs, no idea on how to compile C to those specific archs. Once the files are generated it's a matter of packaging them to be consumed on iOS (via an xcframework) and Android (via an AAR or just a file structure).

If you can provide some compilation instructions I can then integrate it into my library (and also expo-sqlite would follow the same steps)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants