[Interest] Adding OpenSSL Support to Android 6.0 - Provided instructions fail to build

Nuno Santos nunosantos at imaginando.pt
Tue Nov 3 13:30:34 CET 2015


Hi,

I’m trying to cross build openssl in order to bundle it with my APK. I don’t know if the instructions are imprecise or outdated but I couldn’t manage to build openssl with the provide instructions: http://doc.qt.io/qt-5/opensslsupport.html <http://doc.qt.io/qt-5/opensslsupport.html>

What I have done:

- Opened terminal on Mac OSX
- Extracted openssl source
- Set CC env var pointing to /Users/nsantos/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc
- Set AR env var pointing to /Users/nsantos/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar
- Set ANDROID_DEV to /Users/nsantos/android/ndk/platforms/android-9/arch-arm/usr/include
- Called ./Configure shared android-armv7
- Called make build_libs

At this point the first problem arises:

- The CC var inside the make file is simply pointing to gcc, which is actually clang when called. It complains about an unknown flag “-mandroid”

I decided to edit the Makefile and manually change the CC and AR values to the ones above and called make build_libs again

Now the problem was that it couldn’t find stdlib.h. To fix this I have added -I/Users/nsantos/android/ndk/platforms/android-9/arch-arm/usr/include to CFLAG var inside Makefile. Tried to call make build_libs again. The output was better as it actually started to compile, however, when it got to the final phase this error occurred:

MACKIE:openssl-master nsantos$ make build_libs
making all in crypto...
making all in crypto/objects...
make[2]: Nothing to be done for `all'.
making all in crypto/md4...
/Users/nsantos/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar  r ../../libcrypto.a md4_dgst.o md4_one.o
/Users/nsantos/android/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar: ../../libcrypto.a: Malformed archive
make[2]: *** [lib] Error 1
make[1]: *** [subdirs] Error 1
make: *** [build_crypto] Error 1

Should I do what I have done? Why are we setting env vars if their are not being used by Makefile? What’s the point? Why are we defining ANDROID_DEV if then it isn’t used? What am I missing? 

Any help here would be great.

Thanks in advance,

Regards,

Nuno

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151103/0e0a413b/attachment.html>


More information about the Interest mailing list