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

Support arm64v8a and x86_64 (64-bit) in Sqlcipher #151

Closed
wants to merge 45 commits into from

Conversation

gmetal
Copy link

@gmetal gmetal commented Jan 18, 2015

With the 64-bit capable android devices already out there, it is necessary to be able to have native 64-bit compilation for increased performance. MIPS64 has not been included, because the corresponding AOSP version does not seem to compile.

gmetaxas added 20 commits October 16, 2014 14:13
…s64 libs are missing - compiled from master branch - will update the external library pointers accordingly)

Modifeid Makefiles to get 64-bit architectures - all64 not used yet

Modified Java code to use longs for the variables which store pointers, rather than int
Modifed C++ code to use longs rather than ints for pointers shared between java
…s64 libs are missing - compiled from master branch - will update the external library pointers accordingly)

Modifeid Makefiles to get 64-bit architectures - all64 not used yet

Modified Java code to use longs for the variables which store pointers, rather than int
Modifed C++ code to use longs rather than ints for pointers shared between java
Split String include files per architecture
Modified external/Android.mk to reflect different architecture needs
Removed unnecessary file from external/Android.mk
Aded armeabi-v7a arch in Application.mk
Conflicts:
	Makefile
	external/android-libs/arm64-v8a/libandroid_runtime.so
	external/android-libs/arm64-v8a/libbinder.so
	external/android-libs/arm64-v8a/libcutils.so
	external/android-libs/arm64-v8a/libnativehelper.so
	external/android-libs/arm64-v8a/libutils.so
	external/android-libs/x86_64/libandroid_runtime.so
	external/android-libs/x86_64/libbinder.so
	external/android-libs/x86_64/libcutils.so
	external/android-libs/x86_64/libnativehelper.so
	external/android-libs/x86_64/libutils.so
	jni/Application.mk
Added static openssl binaries for compilation
@developernotes
Copy link
Member

Hi @gmetal,

Thanks so much for this pull request, it is quite large! We look forward to reviewing and getting back with any feedback we may have.

@eeVoskos
Copy link

eeVoskos commented Mar 3, 2015

Any news on this? It would be a nice feature to have.

@developernotes
Copy link
Member

Hi @gmetal

With regard to this pull request, due to the number of changes we would need you to complete a contributor agreement before we can proceed, more information can be found here.

Next, we would like to ask you to par down the changes to only those required to adding support for arm64v8a and x86_64. You have included additional changes such as including alternative source locations for OpenSSL which we would prefer not to include. Also, there are changes to the minimum SDK version, we plan to continue to support Android 2.1 and up. As a point of reference, please make sure your changes are compatible with the current SQLCipher for Android test suite.

@gmetal
Copy link
Author

gmetal commented Mar 15, 2015

Hello,
I sent the contributor agreement earlier today. Hope that is in order.

Now in terms of the patch, I removed the partial mips64 support and the alternative OpenSSL source location.

My patch does not change the minimum SDK version. However, since 64-bit support was introduced in android-21, I did include some alternative submodules needed to compile the 64-bit version libraries. However, if you have a closer look, you'll see that the 32-bit versions of the library have not been touched, and are being built like they used too.

I also had my patched tested with the test suite, on an x86_64 emulator and on Nexus 9 (arm64-v8a) and in both cases all tests were successful.

@developernotes
Copy link
Member

Hello @gmetal,

Again, thank you for the time you have put into this pull request, we do certainly appreciate it. After reviewing the contents I do have one concern moving forward. We prefer to build all OpenSSL binary artifacts from source based on our submodule checkout, assembled using this script for the various platforms needed.

Your pull request includes libssl.a binaries for both arm64-v8a and x86_64 which are not used by SQLCipher, as well as libcrypto.a binaries which are not built from the script referenced above. It is important that we are able to rebuild libcrypto.a for all supported platforms in an ongoing basis. Without this we have no means to validate the origins of the binaries, nor update them as newer versions of OpenSSL are released.

Can you provide any feedback on this?

@gmetal
Copy link
Author

gmetal commented Mar 27, 2015

Hello @developernotes

The included libcrypto.a and libssl.a have been built from the AOSP openssl repository, which provides all the necessary support for building openssl for all AOSP platforms. I can understand not wanting to include such binaries in the codebase. However, after doing a quick check on the OpenSSL releases, it appears that they started supporting the arm64-v8a architecture only very recently (e.g. on the 1.0.2a). I can have a go at updating the build script with arm64-v8a support, but I will also have to bump the openssl repository to the 1.0.2a release.

@developernotes
Copy link
Member

Hi @gmetal,

That would be great, please note the OpenSSL submodule in external/openssl has already been updated to the 1.0.2a tag with our latest release.

@kayaatakan
Copy link

@developernotes Ok, so it has been some time, what is the status of support for arm64-v8a and x86_64?
This means that SqlCipher does not support Samsung S6 which is out on the market quite a while now. Is there any way of using SqlCipher for those architectures at the moment? If so, how?

@TheNephilim88
Copy link

@kayaatakan Why do you think its not running on Samsung Galaxy S6? Its working perfectly fine on x64-platforms - try it out on yourself... Its afaik just not optimized for x64...

@developernotes
Copy link
Member

Hello @kayaatakan

Per this portion of the thread, we are still awaiting direct support for building the arm64v8a and x86_64 versions of OpenSSL. This will require changes within the OpenSSL build system which appears to still be pending. Once OpenSSL directly supports targeting those platforms we will be able to proceed in adding support to SQLCipher for Android.

@kayaatakan
Copy link

@developernotes So, I see that there is no direct support for arm64-v8a and x86_64 yet.
But according to @TheNephilim88, he says it is not optimized for those. Is it possible to manually build the project, to get the .so files for those? Maybe by modifying below line at android-database-sqlcipher/jni/Application.mk
APP_ABI := armeabi armeabi-v7a x86
to
APP_ABI := armeabi armeabi-v7a x86 x86_64 arm64-v8a
and build the project to get those files? Even if it is not optimized, something that can enable us to run our application on Samsung S6 for example?

@atakankaya
Copy link

Basically is there any way of making SqlCipher work on those devices at the moment?

@dustedrob
Copy link

@atakankaya I got it to work with devices like the Samsung S6 by downloading the @gmetal fork and building from source.

@sjlombardo
Copy link
Member

@kayaatakan @atakankaya: What @TheNephilim88 was saying is simply that the library is not built specifically for that architecture, however, SQLCipher should run just fine on AArch64 platforms, since they will fall back to armv7a.

If you are actually seeing a crash when running on a device, then it is almost definitely related to including a different native library (i.e. other than SQLCipher) with arm64-v8a support due to Android’s preferential loading process.

To fix this, you can simply remove the packaging of any platform libraries for arm64-v8a, so that you are bundling the native libraries only for the versions supported by all components (e.g. armv7a). Once the architecture for all native components are consistent then the application should run fine on arm64-v8a devices.

Please let us know if that clarifies the situation, and if the suggestion resolves any issues you are seeing.

@GuillaumeBourge
Copy link

@atakankaya Can you help to build the @gmetal source or send me directly binairies please ?
I have already 64bits lib in my app, i do not want modify these lib to integrate cipher in my app..

@gmetal
Copy link
Author

gmetal commented Jan 22, 2016

Hello, I've setup a travis job to build my patch and upload the produced binaries in github. You can find my builds here: https://github.com/gmetal/android-database-sqlcipher/releases

@GuillaumeBourge
Copy link

Alright, a big thanks to you for your work and help !

2016-01-22 13:49 GMT+01:00 gmetal notifications@github.com:

Hello, I've setup a travis job to build my patch and upload the produced
binaries in github. You can find my builds here:
https://github.com/gmetal/android-database-sqlcipher/releases


Reply to this email directly or view it on GitHub
#151 (comment)
.

@kayaatakan
Copy link

Hi all, sorry for the late response. I used the suggestion of @sjlombardo
In my case, problem was the sqlcipher libs were unable to be found.
An example: Suppose you have another library that supports arm64-v8a. You would create a directory under libs named "arm64-v8a" and put that library there. However, sqlcipher does not have any libs for this ABI, and you would expect the system to use the sqlcipher libs from your arm64-v7a folder then. But that's not the case. On installation time, the installer looks for a matching folder under your libs folder with the ABI of your device. Then just copies that folder directly. Suppose the device has arm64-v8a ABI, then the arm64-v8a folder contents would be copied. But there is no sqlcipher libs for arm64-v8a. So the app would crash since it cannot find the sqlcipher library.
So my problem was not really related to Sqlcipher itself but the way I included them in my project.

@sjlombardo
Copy link
Member

Hello @kayaatakan - excellent, I'm very glad that worked for you!

@gmetal
Copy link
Author

gmetal commented Mar 2, 2016

@developernotes my patch to openssl has been rejected, since the functionality has been implemented in their master branch. When 1.1.0 is released, you will be able to produce 64-bit android openssl builds without any additional patches, etc.

@GuillaumeBourge
Copy link

Hi !

Thanks you for notice me, i will look at their version ! :)

2016-03-02 15:56 GMT+01:00 gmetal notifications@github.com:

@developernotes https://github.com/developernotes my patch to openssl
has been rejected, since the functionality has been implemented in their
master branch. When 1.1.0 is released, you will be able to produce 64-bit
android openssl builds without any additional patches, etc.


Reply to this email directly or view it on GitHub
#151 (comment)
.

@developernotes
Copy link
Member

Hi @gmetal

Thank you for the follow up, we are looking forward to their 1.1.0 release. Take care!

@sqlcipher sqlcipher locked and limited conversation to collaborators Mar 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.