Compile OpenSSL for Android



  • When I set a source properties into an QML Image as an https URL and run it on an Android devise I have an error:

    QML Image: TLS initialization failed
    

    The kit by default is Android for armeabi-v7a (Clang Qt 5.12.0 for Android ARMv7). But on my GNU\Linux OS it works properly. I thought that the problem was in the OpenSSL library and decided to compile it by this instruction.
    I've set _ANDROID_ARCH=arch-arm and others options to the correct value (I hope) but when I launched make the gcc Linker catch the error:

    cannot find crtbegin_so.o
    

    I've created a link to this file through the
    ln -s /home/usrname/Android/Sdk/ndk-bundle/platforms/android-28/arch-arm/usr/lib/crtbegin_so.o
    And now I have the error

    crtbegin_so.o: error adding symbols: file in wrong format
    

    I'v been trying other files 32 and 64 bits and another OpenSSL versions (openssl-1.0.2r and openssl-1.1.0j) and even changed compiler into makefile to the clang but have the same error.
    Anyone can help with this issue?
    Thanks a lot


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You can try @ekkescorner helper script that can be found here.

    Hope it helps


  • Qt Champions 2016

    or try this fork of my scripts for more platforms: https://github.com/akontsevich/openssl-android-build



  • @ekkescorner Tank you so much!
    P.S. By the way, Build steps by GCC doesn't work properly it runs clang as I see
    (clang: error: unknown argument: '-mandroid')
    But the clang script works fine
    Thanks again.


Log in to reply