OpenSSL for android and Qt 5.12.4

  • Just to clear up some stuff to see if I understand right.
    Based on Qt-5-12-4-released-support-openssl-1-1-1 we now have to use the openssl 1.1.1 version and 1.0.2 won't work.

    There is some "tutorial" android-openssl-support on how to build, I put the quotes because it's outdated, if I'm not wrong. NDK 18+ has stand-alone toolchains which is not supported by the script, additionally Configure command is for openssl 1.0.2

    I managed to find a guide on how to build openssl 1.1.1 with NDK 18+ (in case anyone else will need), and after the build there is more than just the standard and, the new ones are libcrypto.a and libssl.a, since that are archive libraries, are they also required for Qt to work, or are the normal so files enough?

    If anyone could clarify what exactly is needed, or if I'm mistaken in something.

    It seems trivial, but for someone like me who only used the libs because they need to be there it seems like a huge jump from 1.0.2 to 1.1.1

    I built 1.0.2 to remind myself how the build folder looks like, it also has the .a files, so I assume they are not required at all for Qt, just the .so?

  • I agree with you... the transition to OpenSSL 1.1.1 is not easy at all. The guide you found is OK.

    You need Linux or Mac to compile the OpenSSL libraries and be ready to use the Terminal.

    This is the procedure I used on a mac, but should work also on Linux... on Windows forget it...

    Open the Documents folder and create a new folder, call it openSSL

    Download openssl-1.1.1c :
    Download NDK r19c :

    extract everything in the folder "openSSL" and create a file named "", open it and paste the following code

    export ANDROID_NDK_HOME=$SCRIPTPATH/android-ndk-r19c
    # Can be android-arm, android-arm64, android-x86, android-x86 etc
    #set clang compiler
    ./Configure $architecture -D__ANDROID_API__=28
    mkdir -p $OUTPUT_INCLUDE
    mkdir -p $OUTPUT_LIB
    cp -RL include/openssl $OUTPUT_INCLUDE
    cp $OUTPUT_LIB
    cp $OUTPUT_LIB

    Now open a terminal and run the following commands

    cd ~/Documents/openSSL
    chmod +x

    If everything is Ok, after a couple of minutes you will find your .so files in the output folder... and is all you need.

    Once they are compiled, you can copy paste in the resources of your project. This is what I have in my .pro file:

    equals(ANDROID_TARGET_ARCH, arm64-v8a) {
        ANDROID_EXTRA_LIBS += $$PWD/../libs/lib/android-arm64/
        ANDROID_EXTRA_LIBS += $$PWD/../libs/lib/android-arm64/
    else: equals(ANDROID_TARGET_ARCH, armeabi-v7a) {
        ANDROID_EXTRA_LIBS += $$PWD/../libs/lib/android-arm/
        ANDROID_EXTRA_LIBS += $$PWD/../libs/lib/android-arm/
    else: equals(ANDROID_TARGET_ARCH, x86)  {
        ANDROID_EXTRA_LIBS += $$PWD/../libs/lib/android-x86/
        ANDROID_EXTRA_LIBS += $$PWD/../libs/lib/android-x86/

  • Your way should work too, I finished all the builds with the guide I found so didn't try yours yet. Only difference is I also put the shared flag for config, only because the old Qt guide did the same ( so I assume it needs it here as well)

    Just one thing to point out (at least in my case) the and are links to the actual libs called and, so thats what you need in your project.

    I was confused about the .a files because the guide mentioned to copy those too, but I assume it's only in case for Android studio.
    I confirmed the libs to work after testing on some https content.

  • There are some updates from Qt:
    Here you find OpenSSL prebuilt libraries

    Here you find updated instructions:

  • Qt 5.12.4
    NDK 19c
    QT creator 4.9.2
    Windows 10
    Developing Android 4.4.4 apk.

    I swicth to Utuntu, downloaded NDK for linux run . After that everythings goes well. It created and files. I put in my project, and i always get eror like :

    ..... QSslSocket: cannot resolve X509_get_version QSslSocket: cannot resolve OpenSSL_version_num QSslSocket: cannot resolve OpenSSL_version Incompatible version of OpenSSL

    Also then i build apk file i see problem then is loading file:

    .dynamic section for "" is not at the expected address (wrong library or version mismatch?)

    I try to use QSslSocket::sslLibraryBuildVersionString() and it tel me that it is version 1.1.1b. I compiled .so files from OpenSsl 1.1.1c. Why it show another version?

    After that i try to compile .so files from version 1.1.1b. But i still get the same erorr.

    Im working with this erorr about a week, and still nothing....

  • @fXs. Openssl 1.1.1 doesn't work with android 4.4, you need openssl 1.0.2 and with that Qt 5.12.3.

Log in to reply