SQLite4Unity3d
SQLite4Unity3d copied to clipboard
FTS support for Android
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
I'm not sure... So I would say most probably it wasn't.
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.
Sure, can you make a PR with this? I'll be glad to merge it.
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.
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.
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.