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

FTS support for Android #103

Open
brookman opened this issue Sep 13, 2019 · 6 comments
Open

FTS support for Android #103

brookman opened this issue Sep 13, 2019 · 6 comments

Comments

@brookman
Copy link

Has the android .so (armeabi-v7a, 32bit) been built with FTS support? I am getting an error "No such module: fts4" when trying to run FTS queries on my Android device. On desktop it is working fine.

Unity: 2019.2.5f1
Build: Mono, ARMV7
Phone: Google Pixel 2XL, Android 10

@robertohuertasm
Copy link
Owner

I'm not sure... So I would say most probably it wasn't.

@brookman
Copy link
Author

Thank you for the quick reply.
We need the feature for our project, so I have manually compiled the Android libs with the corresponding flags (-DSQLITE_ENABLE_FTS4 and -DSQLITE_ENABLE_FTS5) from source.
Let me know if you are interested in the binaries.

@robertohuertasm
Copy link
Owner

Sure, can you make a PR with this? I'll be glad to merge it.

@brookman
Copy link
Author

I can try, but I am not an expert in SQLite (or C/compilers, cmake and Android native for that matter) and not entirely sure about the compile flags. For our use-cases I have built it with:
-Os -s -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE

This means:

  • Optimized for file size
  • Stripping enabled
  • Not thread safe (so no dependency to pthreads)
  • No dynamic loading (not sure what that even is)
  • Extensions FTS4, FTS5, JSON1, RTREE

There are more flags listed in the documentation: https://www.sqlite.org/howtocompile.html
For example -DSQLITE_ENABLE_EXPLAIN_COMMENTS. Which ones should I include?

For cmake I call it like this:
cmake -DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk/20.0.5594570/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=24
And the same with arm64-v8a and x86.
I took API level 24 (Android 7.0, Nougat) as the minimum because our app needs that. But I can also go lower if needed.

Now there is also the question if the API 3.29 is still compatible with the C# code. I have only tested some very basic features which seem to work fine.

I am glad to make PR with the binaries if we can work out the build parameters.

@robertohuertasm
Copy link
Owner

I see your point. Maybe we can leave it here. In case anyone else faces the same issue it will be enough to read this thread to find the solution.

I'm thinking it might be cool to have your compiled android libs in another repo folder just in case someone else wanted to use them but I'm not sure if that would confuse people or not.

@chaoslife
Copy link

Thank you for the quick reply. We need the feature for our project, so I have manually compiled the Android libs with the corresponding flags (-DSQLITE_ENABLE_FTS4 and -DSQLITE_ENABLE_FTS5) from source. Let me know if you are interested in the binaries.

Hello, does your binary file have the RTree module enabled? I need a so under the Android platform.

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

3 participants