Results 1 to 4 of 4

Thread: Building and using SSL with QSslSocket

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Thanked 3 Times in 1 Post

    Default Building and using SSL with QSslSocket

    I'm having zero luck in getting Qt4 to build in order to use the QsslSocket class. I've downloaded and installed the openssl for Windows, and copied the openssl folder into qt4\includes so that it can be used, but I'm getting the following when compiling:

    cl -c -FIqt_pch.h -Yuqt_pch.h -Fptmp\obj\debug_shared\QtNetworkd_pch.pch -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -W3 -w34100 -w34189 -GR -EHsc -DQT_SHARED -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_EDITION=QT_EDITION_DESKTOP -DQT_BUILD_NETWORK_LIB -DQT_NO_USING_NAMESPACE -DQT_MAKEDLL -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -D_USE_MATH_DEFINES -DQT_DLL -DQT_CORE_LIB -I"..\..\include\QtCore" -I"..\..\include\QtCore" -I"..\..\include" -I"..\..\include\QtNetwork" -I"tmp\rcc\debug_shared" -I"tmp" -I"..\3rdparty\zlib" -I"kernel" -I"..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"." -I"..\..\mkspecs\win32-msvc2008" -Fotmp\obj\debug_shared\ @c:\temp\nm6E1.tmp
    qsslcertificate.cpp
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ')' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ';' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2040: 'LPCSTR' : 'ocsp_response_st' differs in levels of indirection from 'const CHAR *'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2059: syntax error : ')'
    qsslkey.cpp
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ')' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ';' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2040: 'LPCSTR' : 'ocsp_response_st' differs in levels of indirection from 'const CHAR *'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2059: syntax error : ')'
    qsslsocket.cpp
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ')' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ';' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2040: 'LPCSTR' : 'ocsp_response_st' differs in levels of indirection from 'const CHAR *'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2059: syntax error : ')'
    qsslsocket_openssl.cpp
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ')' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ';' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2040: 'LPCSTR' : 'ocsp_response_st' differs in levels of indirection from 'const CHAR *'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2059: syntax error : ')'
    qsslsocket_openssl_symbols.cpp
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ')' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2143: syntax error : missing ';' before 'constant'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2040: 'LPCSTR' : 'ocsp_response_st' differs in levels of indirection from 'const CHAR *'
    C:\Qt\4.4.0\include\openssl/ossl_typ.h(176) : error C2059: syntax error : ')'

    FWIW, I'm using the commercial license version and VS2008, and openssl Win32OpenSSL-0_9_8h install. I've tried it with both configure -openssl and configure -openssl-linked

    Suggestions?

  2. #2
    Join Date
    Jul 2008
    Posts
    2
    Thanked 3 Times in 1 Post

    Default Re: Building and using SSL with QSslSocket

    I figured it out: in the openssl/ossl_typ.h header, there is a forward typedef at the bottom that reads:
    typedef struct ocsp_response_st OCSP_RESPONSE;
    the ocsp_response_st is defined in openssl/ocsp.h, but you cannot include that one before ossl_typ.h because it depends upon defines in the other - circular reference. Apparently other compilers are not as picky as VS2008.
    I fixed this by moving the typdef from the ossl_typ.h file to the ocsp.h file where the stuct ocsp_response_st is defined at.

  3. The following 3 users say thank you to nopcode for this useful post:

    arendjr (5th September 2008), jpn (2nd September 2008), wxisaac (22nd October 2008)

  4. #3
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Smile Re: Building and using SSL with QSslSocket

    According to OpenSSL recent patch towards file ossl_typ.h to fix this issue, the reason is "CryptoAPI uses this too". This explain the strange error message. So it's due to the difference of Windows SDK between v5.0 & v6.0 instead of the "pickyness" for VS2008 compiling fails while VS2005 works.

  5. #4
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building and using SSL with QSslSocket

    It's really nuisance to get name conflict while link components especially from different vendor. Namespace separation is really a good practice.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.