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

ssl/qsslcertificate.cpp:288:68: Error: Illegal use of incomplete type ‘struct X509’



  • Development environment: Fedora 14, QT5.3.2, openssl1.1.1;
    when I make the code of QT5.3.2, error as follows:ssl/qsslcertificate.cpp:288:68: Error: Illegal use of incomplete type ‘struct X509’

    gmake[3]: Leaving the directory "/home/oneu/Downloads/qt-everywhere-opensource-src-5.3.2/qtbase/src/tools/qlalr"
    cd network/ && (test -e Makefile || /home/oneu/Downloads/qt-everywhere-opensource-src-5.3.2/qtbase/bin/qmake /home/oneu/Downloads/qt-everywhere-opensource-src- 5.3.2/qtbase/src/network/network.pro -o Makefile) && gmake -f Makefile
    gmake[3]: Enter the directory "/home/oneu/Downloads/qt-everywhere-opensource-src-5.3.2/qtbase/src/network"
    g++ -c -include .pch/Qt5Network -pipe -msse2 -mfpmath=sse -O2 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_USING_NAMESPACE -DQT_BUILD_NETWORK_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE = 0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -I ../../ mkspecs / linux-g ++ -I. -I ../../include -I../../include/QtNetwork -I../../include/QtNetwork/5.3.2 -I../../include/QtNetwork/5.3.2/QtNetwork -Ikernel -I../../include/QtCore/5.3.2 -I../../include/QtCore/5.3.2/QtCore -I../../include/QtCore -I.moc- o .obj/qsslcertificate.o ssl/qsslcertificate.cpp
    ssl/qsslcertificate.cpp: In the member function ‘QByteArray QSslCertificate::version() const’:
    ssl/qsslcertificate.cpp:288:68: Error: Illegal use of incomplete type ‘struct X509’
    /usr/local/include/openssl/ossl_typ.h:120:16: Error: forward declaration of ‘struct X509’
    ssl/qsslcertificate.cpp: In the member function ‘QByteArray QSslCertificate::serialNumber() const’:
    ssl/qsslcertificate.cpp:300:45: Error: Illegal use of incomplete type ‘struct X509’
    /usr/local/include/openssl/ossl_typ.h:120:16: Error: forward declaration of ‘struct X509’
    ssl/qsslcertificate.cpp: In the member function ‘QSslKey QSslCertificate::publicKey() const’:
    ssl/qsslcertificate.cpp:565:32: Error: Illegal use of incomplete type ‘struct X509’
    /usr/local/include/openssl/ossl_typ.h:120:16: Error: forward declaration of ‘struct X509’
    ssl/qsslcertificate.cpp:569:29: Error: illegal use of incomplete type ‘struct EVP_PKEY’
    /usr/local/include/openssl/ossl_typ.h:93:16: Error: forward declaration of ‘struct EVP_PKEY’
    ssl/qsslcertificate.cpp:573:36: Error: illegal use of incomplete type ‘struct EVP_PKEY’
    /usr/local/include/openssl/ossl_typ.h:93:16: Error: forward declaration of ‘struct EVP_PKEY’
    ssl/qsslcertificate.cpp:577:36: Error: illegal use of incomplete type ‘struct EVP_PKEY’
    /usr/local/include/openssl/ossl_typ.h:93:16: Error: forward declaration of ‘struct EVP_PKEY’
    gmake[3]: *** [.obj/qsslcertificate.o] error 1
    gmake[3]: Leaving the directory "/home/oneu/Downloads/qt-everywhere-opensource-src-5.3.2/qtbase/src/network"
    gmake[2]: *** [sub-network-make_first] error 2
    gmake[2]: leave the directory "/home/oneu/Downloads/qt-everywhere-opensource-src-5.3.2/qtbase/src"
    gmake[1]: *** [sub-src-make_first] error 2
    gmake[1]: Leave the directory "/home/oneu/Downloads/qt-everywhere-opensource-src-5.3.2/qtbase"
    gmake: *** [module-qtbase-make_first] error 2
    [root@localhost qt-everywhere-opensource-src-5.3.2]#
    

    When I use openssl1.0.2k to compile QT5.3, I also encounter the same error. I also link /usr/local/ssl/include/openssl to the openssl installation directory /usr/local/ssl/include/openssl, I can compile Passed.
    When I use openssl1.1.1 to compile QT5.3, I compiled failed and still reported the same error. Don't know what caused it?

    [root@localhost local]# ll /usr/local/include/openssl
    lrwxrwxrwx 1 root root 30 10月 24 19:36 /usr/local/include/openssl -> /usr/local/ssl/include/openssl
    

  • Lifetime Qt Champion

    Hi,

    As already explained in your other thread, OpenSSL 1.0 and 1.1 cannot just be switched. OpenSSL 1.1 is not backward compatible with 1.0.

    And as already wrote in that same other thread, support for OpenSSL 1.1 was implement in Qt 5.10.0.


Log in to reply