I've cross-compiled Mosquitto successfully with SSL support, here is how I got it working:
- Download the OpenSSL source code.
- Follow the guide to compile sources against the Android toolchain https://github.com/openssl/openssl/blob/master/NOTES-ANDROID.md
- Now we must embed OpenSSL directly into the Mosquitto library, for some obscure reasons we cannot simply link OpenSSL including .so files in jniLibs. To achieve this, add the following options to cmake script:
-DOPENSSL_LIBRARIES="../Mosquitto_TLS_Android-master/openssl-3.0.2" \ -DOPENSSL_CRYPTO_LIBRARY="../Mosquitto_TLS_Android-master/openssl-3.0.2/libcrypto.a" \ -DOPENSSL_SSL_LIBRARY="../Mosquitto_TLS_Android-master/openssl-3.0.2/libssl.a" \ -DOPENSSL_INCLUDE_DIR="../Mosquitto_TLS_Android-master/openssl-3.0.2/include" \
I've cross-compiled Mosquitto successfully with SSL support, here is how I got it working:
-DOPENSSL_LIBRARIES="../Mosquitto_TLS_Android-master/openssl-3.0.2" \ -DOPENSSL_CRYPTO_LIBRARY="../Mosquitto_TLS_Android-master/openssl-3.0.2/libcrypto.a" \ -DOPENSSL_SSL_LIBRARY="../Mosquitto_TLS_Android-master/openssl-3.0.2/libssl.a" \ -DOPENSSL_INCLUDE_DIR="../Mosquitto_TLS_Android-master/openssl-3.0.2/include" \