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

Compiling 5.15.0 for Android : problem with the openssl library



  • I'm trying to compile I'm using Qt 5.15.0 and OpenSSL 1.1.1d and NDK r20b and Ubuntu 19.10

    The weird thing is that openssl's x509.h file doesn't contain the q_X509_free function actually. How can this be explained?

    With my thanks,
    to test the fix: https://codereview.qt-project.org/c/qt/qtbase/+/290253

    When I compile without ssl, everything works fine. On the other hand, when I compile with :

    ./configure -xplatform android-clang -android-ndk /root/Android/Sdk/ndk/20.1.5948944 -android-sdk /root/Android/Sdk/  -skip qttranslations -skip qtserialport -no-warnings-are-errors -android-abis armeabi-v7a -prefix /opt/Qt/5.15.0/android --ccache -openssl -release -nomake tests -nomake examples -no-sql-mysql -no-dbus -no-use-gold-linker -no-qpa-platform-guard -opengl es2  -I /opt/Qt/Tools/OpenSSL/src/include
    

    I'm getting error messages:

    ssl/qsslcertificate_p.h:101:13: error: use of undeclared identifier 'q_X509_free'
                q_X509_free(x509);
                ^
    ssl/qsslcertificate_qt.cpp:64:15: error: no member named 'derData' in 'QSslCertificatePrivate'
        return d->derData == other.d->derData;
               ~  ^
    ssl/qsslcertificate_qt.cpp:64:35: error: no member named 'derData' in 'QSslCertificatePrivate'
        return d->derData == other.d->derData;
                             ~~~~~~~  ^
    ssl/qsslcertificate_qt.cpp:86:15: error: no member named 'subjectMatchesIssuer' in 'QSslCertificatePrivate'
        return d->subjectMatchesIssuer;
               ~  ^
    ssl/qsslcertificate_qt.cpp:131:15: error: no member named 'subjectAlternativeNames' in 'QSslCertificatePrivate'
        return d->subjectAlternativeNames;
               ~  ^
    ssl/qsslcertificate_qt.cpp:157:12: error: no member named 'publicKeyAlgorithm' in 'QSslCertificatePrivate'
        if (d->publicKeyAlgorithm != QSsl::Opaque) {
            ~  ^
    ssl/qsslcertificate_qt.cpp:158:27: error: no member named 'publicKeyAlgorithm' in 'QSslCertificatePrivate'
        key.d->algorithm = d->publicKeyAlgorithm;
                           ~  ^
    ssl/qsslcertificate_qt.cpp:159:25: error: no member named 'publicKeyDerData' in 'QSslCertificatePrivate'
        key.d->decodeDer(d->publicKeyDerData);
                         ~  ^
    ssl/qsslcertificate_qt.cpp:167:15: error: no member named 'extensions' in 'QSslCertificatePrivate'
        return d->extensions;
               ~  ^
    ssl/qsslcertificate_qt.cpp:194:15: error: no member named 'derData' in 'QSslCertificatePrivate'
        return d->derData;
               ~  ^
    ssl/qsslcertificate_qt.cpp:273:22: error: no member named 'parse' in 'QSslCertificatePrivate'
            if (!cert.d->parse(data))
                 ~~~~~~  ^
    ssl/qsslcertificate_qt.cpp:277:32: error: no member named 'derData' in 'QSslCertificatePrivate'
            data.remove(0, cert.d->derData.size());
                           ~~~~~~  ^
    ssl/qsslcertificate_qt.cpp:293:30: error: out-of-line definition of 'parse' does not match any declaration in 'QSslCertificatePrivate'
    bool QSslCertificatePrivate::parse(const QByteArray &data)
                                 ^~~~~
    ssl/qsslcertificate_qt.cpp:360:5: error: use of undeclared identifier 'subjectMatchesIssuer'
        subjectMatchesIssuer = issuerDer == subjectDer;
        ^
    ssl/qsslcertificate_qt.cpp:367:5: error: use of undeclared identifier 'publicKeyDerData'
        publicKeyDerData.resize(certStream.device()->pos() - keyStart);
        ^
    ssl/qsslcertificate_qt.cpp:379:9: error: use of undeclared identifier 'publicKeyAlgorithm'
            publicKeyAlgorithm = QSsl::Rsa;
            ^
    ssl/qsslcertificate_qt.cpp:381:9: error: use of undeclared identifier 'publicKeyAlgorithm'
            publicKeyAlgorithm = QSsl::Dsa;
            ^
    ssl/qsslcertificate_qt.cpp:383:9: error: use of undeclared identifier 'publicKeyAlgorithm'
            publicKeyAlgorithm = QSsl::Ec;
            ^
    ssl/qsslcertificate_qt.cpp:385:9: error: use of undeclared identifier 'publicKeyAlgorithm'
            publicKeyAlgorithm = QSsl::Opaque;
            ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    

    I'm using Qt 5.15.0 and OpenSSL 1.1.1d and NDK r20b and Ubuntu 19.10

    The weird thing is that openssl's x509.h file doesn't contain the q_X509_free function actually. How can this be explained?

    With my thanks,


  • Qt Champions 2019

    @Francky033 said in Compiling 5.15.0 for Android : problem with the openssl library:

    Qt 5.15.0

    This version is not finished yet as far as I know.
    Why not using a stable version?



  • @Francky033 said in Compiling 5.15.0 for Android : problem with the openssl library:

    https://codereview.qt-project.org/c/qt/qtbase/+/290253

    The problem is that the bugfix https://codereview.qt-project.org/c/qt/qtbase/+/290253 will probably not be integrated in version 5.14.2. Also, the patch is not applicable on version 5.14.2.

    And I absolutely need this feature.

    Thanx!


  • Qt Champions 2019

    @Francky033 Maybe you need a different openssl lib version for Qt 5.15.0?



  • Yeah, I finally understand. We need the boringssl from Google! But the compilation fails again!

    In file included from ssl/qsslsocket_openssl_symbols.cpp:58:
    ssl/qsslsocket_openssl_symbols_p.h:238:40: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a);
                                           ^
    ssl/qsslsocket_openssl_symbols_p.h:239:46: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *));
                                                 ^
    ssl/qsslsocket_openssl_symbols_p.h:240:19: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null();
                      ^~~~~~~~~~~~~
                      OPENSSL_BLOCK                                                                                                                                                                                                                                                
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    In file included from ssl/qsslsocket_openssl_symbols.cpp:58:
    ssl/qsslsocket_openssl_symbols_p.h:241:42: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT void q_OPENSSL_sk_push(OPENSSL_STACK *st, void *data);
                                             ^
    ssl/qsslsocket_openssl_symbols_p.h:242:42: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT void q_OPENSSL_sk_free(OPENSSL_STACK *a);
                                             ^
    ssl/qsslsocket_openssl_symbols_p.h:243:45: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT void * q_OPENSSL_sk_value(OPENSSL_STACK *a, int b);
                                                ^
    ssl/qsslsocket_openssl_symbols_p.h:249:71: error: unknown type name 'CRYPTO_EX_new'
    int q_CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
                                                                          ^
    ssl/qsslsocket_openssl_symbols_p.h:323:29: error: unknown type name 'BIO_ADDR'
    int q_DTLSv1_listen(SSL *s, BIO_ADDR *client);
                                ^
    ssl/qsslsocket_openssl_symbols_p.h:324:1: error: unknown type name 'BIO_ADDR'
    BIO_ADDR *q_BIO_ADDR_new();
    ^
    ssl/qsslsocket_openssl_symbols_p.h:325:22: error: unknown type name 'BIO_ADDR'
    void q_BIO_ADDR_free(BIO_ADDR *ap);
                         ^
    ssl/qsslsocket_openssl_symbols.cpp:151:33: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return)
                                    ^~~~~~~~~~~~~
                                    OPENSSL_BLOCK                                                                                                                                                                                                                                  
    ssl/qsslsocket_openssl_symbols_p.h:88:34: note: expanded from macro 'DEFINEFUNC'
        typedef ret (*_q_PTR_##func)(arg); \
                                     ^
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    ssl/qsslsocket_openssl_symbols.cpp:151:33: error: unknown type name 'OPENSSL_STACK'
    DEFINEFUNC(int, OPENSSL_sk_num, OPENSSL_STACK *a, a, return -1, return)
                                    ^
    ssl/qsslsocket_openssl_symbols.cpp:152:40: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
                                           ^~~~~~~~~~~~~
                                           OPENSSL_BLOCK                                                                                                                                                                                                                           
    ssl/qsslsocket_openssl_symbols_p.h:100:34: note: expanded from macro 'DEFINEFUNC2'
        typedef ret (*_q_PTR_##func)(arg1, arg2);         \
                                     ^
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    ssl/qsslsocket_openssl_symbols.cpp:152:40: error: unknown type name 'OPENSSL_STACK'
    DEFINEFUNC2(void, OPENSSL_sk_pop_free, OPENSSL_STACK *a, a, void (*b)(void*), b, return, DUMMYARG)
                                           ^
    ssl/qsslsocket_openssl_symbols.cpp:153:12: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return)
               ^~~~~~~~~~~~~
               OPENSSL_BLOCK                                                                                                                                                                                                                                                       
    ssl/qsslsocket_openssl_symbols_p.h:88:13: note: expanded from macro 'DEFINEFUNC'
        typedef ret (*_q_PTR_##func)(arg); \
                ^
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    ssl/qsslsocket_openssl_symbols.cpp:153:12: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    DEFINEFUNC(OPENSSL_STACK *, OPENSSL_sk_new_null, DUMMYARG, DUMMYARG, return nullptr, return)
               ^~~~~~~~~~~~~
               OPENSSL_BLOCK                                                                                                                                                                                                                                                       
    ssl/qsslsocket_openssl_symbols_p.h:90:5: note: expanded from macro 'DEFINEFUNC'
        ret q_##func(arg) { \
        ^
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    ssl/qsslsocket_openssl_symbols.cpp:154:36: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    DEFINEFUNC2(void, OPENSSL_sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG)
                                       ^~~~~~~~~~~~~
                                       OPENSSL_BLOCK                                                                                                                                                                                                                               
    ssl/qsslsocket_openssl_symbols_p.h:100:34: note: expanded from macro 'DEFINEFUNC2'
        typedef ret (*_q_PTR_##func)(arg1, arg2);         \
                                     ^
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    ssl/qsslsocket_openssl_symbols.cpp:154:36: error: unknown type name 'OPENSSL_STACK'
    DEFINEFUNC2(void, OPENSSL_sk_push, OPENSSL_STACK *a, a, void *b, b, return, DUMMYARG)
                                       ^
    ssl/qsslsocket_openssl_symbols.cpp:155:35: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG)
                                      ^~~~~~~~~~~~~
                                      OPENSSL_BLOCK                                                                                                                                                                                                                                
    ssl/qsslsocket_openssl_symbols_p.h:88:34: note: expanded from macro 'DEFINEFUNC'
        typedef ret (*_q_PTR_##func)(arg); \
                                     ^
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
                  ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    In file included from ssl/qssldiffiehellmanparameters_openssl.cpp:43:
    ssl/qsslsocket_openssl_symbols_p.h:238:40: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT int q_OPENSSL_sk_num(OPENSSL_STACK *a);
                                           ^
    ssl/qsslsocket_openssl_symbols_p.h:239:46: error: unknown type name 'OPENSSL_STACK'
    Q_AUTOTEST_EXPORT void q_OPENSSL_sk_pop_free(OPENSSL_STACK *a, void (*b)(void *));
                                                 ^
    ssl/qsslsocket_openssl_symbols_p.h:240:19: error: unknown type name 'OPENSSL_STACK'; did you mean 'OPENSSL_BLOCK'?
    Q_AUTOTEST_EXPORT OPENSSL_STACK *q_OPENSSL_sk_new_null();
                      ^~~~~~~~~~~~~
                      OPENSSL_BLOCK                                                                                                                                                                                                                                                
    /home/karlhal/boringssl/include/openssl/base.h:437:15: note: 'OPENSSL_BLOCK' declared here
    typedef void *OPENSSL_BLOCK;
    


  • The compilation of the android version of Qt 5.14.2 works perfectly well!

    Thanks for your help!


Log in to reply