[Interest] Building Qt for Android with SSL (ie. how to avoid QT_NO_SSL define)

Kari Pahula kaol at iki.fi
Tue Nov 15 17:44:52 CET 2022


I'm trying to build Qt 6.4.0 from source for Android with SSL support
enabled, on Linux.  Tl;dr: how to avoid the QT_NO_SSL define?

I built a host Qt and the Android Qt with instructions at
https://doc.qt.io/qt-6/android-building.html

When I tried to use SSL with that with the instructions at
https://doc.qt.io/qt-6/android-openssl-support.html, I ran into
problems already with this example on it:

qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();

Turns out that the Qt for Android I built has QT_NO_SSL define set in
its configuration, making it hide all the SSL related functions from
all builds, including supportsSsl.  The Android Qt seems to be fine
otherwise, I could run the app after removing the parts where I used
SSL methods (none were essential in my program), but it would bail
immediately when it tried the HTTPS protocol, of course.

I've built OpenSSL with the instructions at
https://doc.qt.io/qt-6/android-openssl-support.html and have run make
install on it with --prefix=$SSL_PREFIX (and same for --openssldir).
Could someone give any pointers at how to pass that to Qt's configure?

I've tried it with -openssl-runtime OPENSSL_ROOT_DIR=$SSL_PREFIX but
the configure script will still have "OpenSSL ... no" in its status
display.

I've also tried -openssl-linked OPENSSL_ROOT_DIR=$SSL_PREFIX with both
OPENSSL_LIBS="-L$SSL_PREFIX/lib -lssl -lcrypto" and
OPENSSL_LIBS="-L$SSL_PREFIX/lib -lssl_1_1 -lcrypto_1_1" (just a wild
attempt) but neither had any difference.  I've also tried
OPENSSL_USE_STATIC_LIBS=ON, to no effect.

I'm targeting Android x86_64 both for the OpenSSL build and Qt for
Android build in the above.

I don't know what else to try.  Neither the Android build page or the
Android SSL support page covers how to enable SSL for the Qt build and
https://doc.qt.io/qt-6/configure-options.html#ssl didn't give me any
hints about what I could be missing either.

Any advice on how I should go about doing this?


More information about the Interest mailing list