Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Building OpenSSL for android



  • Hi,

    I am trying to follow: http://doc.qt.io/qt-5/opensslsupport.html
    But when doing

    make build_libs
    

    I get:

    cryptlib.h:62:21: fatal error: stdlib.h: No such file or directory
    

    Is there an newer version of the documentation?



  • Well, I used the prebuild libraries from: https://github.com/emileb/OpenSSL-for-Android-Prebuilt.git



  • For linux on arm I fixed this. Fix was required because armv7 was not supported by openssl Configure.
    First I changed Configure file:
    Searched for line starting with "linux-armv4" and included my own configuration line here.
    "linux-armv7", "gcc: -DTERMIO -D__ARM_ARCH_7A__ -O3 -march=armv7-a -I$(SYSROOT)/usr/include/ -B$(SYSROOT)/lib -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.$(SHLIB_MAJOR).$(SHLIB_MINOR)",

    The line is references in the following build steps:
    Adapt the make to your environment.

    ToolChainName=arm-linux-gnueabihf
    ToolChainInstallDirectory=/myfolder/linux-devkit/sysroots/i686-arago-linux/usr/bin
    export SYSROOT=/myfolder/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi
    export CC="$ToolChainInstallDirectory/$ToolChainName-gcc -march=armv7-a --sysroot=$SYSROOT"
    make depend
    make build_libs
    
    


  • Personally I am paranoid about packaging prebuilt OpenSSL libs I find laying bout the Internet in my customer's apps. I will NOT use them.

    Reverting to use Android NDK r10e solved build problems I had on macOS.

    This script builds arm, arm7, and x86. I could not get Ubuntu 18.04 build of OpenSSL to work even with r10e.

    FIle: myproject.pro

    android {
        # Copy build-output of https://github.com/esutton/android-openssl
        # to /platform/android/lib/openssl/
        # Android >= 6.0 requires apps to install their own libcrypto.so and libssl.so
        equals(ANDROID_TARGET_ARCH, armeabi-v7a) {
            ANDROID_EXTRA_LIBS += $$files($${PWD}/platform/android/lib/openssl/arch-armeabi-v7a/*.so)
        }
        equals(ANDROID_TARGET_ARCH, x86)  {
            ANDROID_EXTRA_LIBS += $$files($${PWD}/platform/android/lib/openssl/arch-x86/*.so)
        }
    }
    
    

Log in to reply