SQLCipher Android 64bit support

Currently the SQLCipher library does not have ndk support for 64bit cpu architecture on the Android devices and crashes; As we’d like to enable full 64bit support on our apps for newer devices like the S6, we would like to request an enhancement on the SQLCipher library for this support. Are there already plans to do so?

Thanks!

This sample app works perfectly fine on a Nexus 9, which has an arm64 CPU. 64-bit CPUs should gracefully degrade to using NDK binaries for 32-bit architectures. While there may be advantages to having 64-bit binaries for SQLCipher, you cannot make a blanket statement that SQLCipher crashes on 64-bit CPUs in its present form.

Thanks for the reply! And I apologize for not being clear in the previous post, I didn’t mean to use the crash as a blanket statement.

To be more specific, when building a universal ndk app, if there is at least one library in the app that has 64bit ndk, we see that Android expects all other libraries to support 64bit, hence the crash. We currently have a workaround for this by using the abiFilter to filter out the 64bit native code from the apk during build time, but would like to enable full support for 64bit architectures in the near future.

Hello @csoon,

While there is a pending pull request to add both arm64v8a and x86_64 support to SQLCipher for Android, we are still awaiting integration [2] from OpenSSL directly on these specific platforms before we can continue with the merge. We are unaware of the priority the OpenSSL team has on adding direct support for those platforms within their build process. As soon as that becomes available we will revisit adding support to SQLCipher for Android.

That said, as @commonsguy mentioned, the 32 bit binaries will continue to work on a 64 bit device, however you can not include any other 64 bit binaries within the application. We look forward to expanding further platform support for SQLCipher for Android, however we need OpenSSL to officially support those platforms first.

[1] https://github.com/sqlcipher/android-database-sqlcipher/pull/151
[2] https://github.com/openssl/openssl/pull/251

Hi @csoon

I would like to add, I would recommend that you communicate your interest for 64 bit Android support to the OpenSSL team via the existing pull request, and/or through the OpenSSL mailing list. Increasing awareness of the interest in those platforms may help to drive support. Thanks!

I also filed https://github.com/openssl/openssl/issues/333 to ask when the OpenSSL project can look at the changes in https://github.com/openssl/openssl/pull/251.

Thank you Nick for the quick response on this and the info on the pending pull request with openSSL! We will continue to use the 32 bit binaries for now and will also drop a comment on OpenSSL regarding the 64 bit support! Thanks!

Just debugging this issue with our StoryMaker app, and we discovered that your wonderful cwac-anddown library contains a native arm64 binary that is triggering this crash with SQLCipher. I guess we can rebuild it without that target.

You may be able to use ndk.abiFilter in defaultConfig to whitelist the NDK binaries that you want, though I have not tried this.

Or, you could download the AAR, nuke the .so files that you do not want, then use your local AAR copy.

If you have further concerns, can we take this off of Zetitec’s list (since it’s kinda off-topic here) and discuss this separately?

I just wanted to emphasize here both how tricky it can be to discover the source of this crash, since it is often not clear when a third-party library is taking advantage of 64-bit native code.

Fortunately, the resolution is quite easy enough.

Thanks!

Hi,

Could you please share your plans regarding the release of a new version of SQLCipher with support for 64-bit Android?

I’m using the Xamarin component for SqlCipher and considering the price I’ve paid for it, I’d really like this feature to be added … :slight_smile:

Thanks !

Hello @tranb3r

SQLCipher for Xamarin Android has a dependency on OpenSSL which did not previously build on 64-bit Android CPU’s without modification of their build system. OpenSSL 1.1.0 was just released near the end of last month. That release should include expanded support for the Android platform. With our next SQLCipher release we will investigate the Android support found within the latest OpenSSL release. Thanks!

Thanks for your answer.

Assuming there is everything you need in OpenSSL 1.1.0, how long do you think it will take to release a new version of SQLCipher (for xamarin) ?

Hello @tranb3r

We do not have a date for the next SQLCipher release at this time. We tend to merge the latest upstream SQLite release within a SQLCipher release, along with stable OpenSSL changes. We often allow for a settling time with regard to SQLite to allow for any bugs to shake out from their release. The latest release of SQLite came out less than a month ago. We will announce new releases here when they become available.

Ok…
But xamarin component (https://components.xamarin.com/gettingstarted/sqlcipher-for-xamarin-android) is still based on SQLCipher 3.4.0, right ?
Have you planned an update for Android N (SQLCipher 3.5.x) ? (and hopefully 64bits …)

Hello @tranb3r

Yes, The latest SQLCipher for Xamarin Android is based on SQLCipher core 3.4.0. SQLCipher for Xamarin Android works on both Android N and 64-bit devices; for the latter you must only select armeabi, armeabi-v7a, and x86 within the list of supported ABI’s within your project Options → Build → Android Build → Advanced tab.