Results 1 to 7 of 7

Thread: How to resolve OpenSSL library dependency ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2015
    Posts
    91
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to resolve OpenSSL library dependency ?

    Hi Everyone,

    I'm using REST api, using QNetworkAccessManager and QNetworkRequest.

    For this I need OpenSSL installed in my system, but if somehow user doesn't have OpenSSL installed in his system then my tool creates a problem by giving an error like below,

    Error creating SSL context ()
    So just to resolve this, I want to add this library dependency on my project file.

    So can someone will help me how I can proceed with this, regarding which version of library or path dependency of headers/lib/dll and all.

    Note: I need this for both Linux and Windows platform.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve OpenSSL library dependency ?

    I doubt this will be a problem on Linux, it is simply too unlikely that any system would not have OpenSSL installed.

    For Windows you need to bundle the SSL lib used by your Qt build.

    Cheers,
    _

  3. #3
    Join Date
    Jun 2015
    Posts
    91
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve OpenSSL library dependency ?

    I haven't tested on Linux yet and now that issue is on Windows only.
    I have downloaded some pre-compiled lib and dll and tried to add in .pro file. (Source: https://indy.fulgan.com/SSL/openssl-...4_86-win64.zip)
    unix:!macx|win32: LIBS += -L$$PWD/../../../thirdparty/openssl/lib/ -llibeay32 -lssleay32

    INCLUDEPATH += $$PWD/../../../thirdparty/openssl/include
    DEPENDPATH += $$PWD/../../../thirdparty/openssl/include
    dependencies.files += $$PWD/../../../thirdparty/openssl/bin/libeay32.dll
    dependencies.files += $$PWD/../../../thirdparty/openssl/bin/ssleay32.dll
    export(INCLUDEPATH)
    export(LIBS)
    export(dependencies.files)
    By doing this above, now I can have .dll besides my application, but still on running it causing this same error.
    Again I have tried to check with this below and gets false result
    Qt Code:
    1. qDebug()<<"Suppport"<<QSslSocket::supportsSsl();
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve OpenSSL library dependency ?

    OpenSSL isn't linked, it is dynamically opened. Like a plugin.

    If Qt is correctly built, there is no need for any change in the application's .pro file.

    Did you build Qt yourself with the library you've downloaded or do you use a pre-built Qt?

    Cheers,
    _

  5. #5
    Join Date
    Jun 2015
    Posts
    91
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve OpenSSL library dependency ?

    I'm using pre-built Qt.
    And that I didn't understand how I can make OpenSSL to open it dynamically?

  6. #6
    Join Date
    Jun 2015
    Posts
    91
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve OpenSSL library dependency ?

    Now I have compiled openssl-1.1.1c.tar, which created .dll (libcrypto-1_1-x64.dll and libssl-1_1-x64.dll).
    In the project file, I just have added these below lines,
    dependencies.files += $$PWD/../../../thirdparty/openssl/bin/libcrypto-1_1-x64.dll
    dependencies.files += $$PWD/../../../thirdparty/openssl/bin/libssl-1_1-x64.dll
    In above I have tried with renaming libcrypto-1_1-x64 to libcrypto and libssl-1_1-x64 to libssl.

    Note: Path is correct I have checked with debugging (message()).

    Also, I have tried with adding INCLUDEPATH/DEPENDPATH/LIBS

    But still, it doesn't look working. What I'm missing? Does that version is not supporting for me ?

  7. #7
    Join Date
    Jun 2015
    Posts
    91
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve OpenSSL library dependency ?

    Hi,

    I have found a solution.
    The problem I'm facing is that I haven't chosen the right version, so first choose the right version of OpenSSH, use below command to get the version QT looking for and find the nearest version of OpenSSH
    Qt Code:
    1. qDebug()<<"SSL Lib Version "<<QSslSocket::sslLibraryBuildVersionString()
    To copy to clipboard, switch view to plain text mode 

    Now find and download that nearest or exact version of OpenSSH on ftp://ftp.openssl.org/source

    You need Perl, so install it from https://www.activestate.com/products...erl/downloads/. I have used ActivePerl 5.26 version.
    Open compiler as an administrator, VS2015 x64 Native Tools Command Prompt (hope you have that as we need nmake tool to build it).

    Follow the path of your SSH lib and use below command to build it.
    - perl Configure VC-WIN64A no-asm --prefix=E:\ssl
    - ms\do_nasm.bat
    - nmake -f ms\ntdll.mak
    - nmake -f ms\ntdll.mak install

    Hope now you will have all dll/lib/includes in E:\ssl folder.
    Now in project file just add below two lines which will copies that dll beside your application.
    Qt Code:
    1. dependencies.files += $${YOURPATH}/ssl/bin/libeay32.dll
    2. dependencies.files += $${YOURPATH}/ssl/bin/ssleay32.dll
    To copy to clipboard, switch view to plain text mode 

    Horrreeyyy, now you shlould get rid-off from this error (Error creating SSL context () )

    Cheers

Similar Threads

  1. How to resolve library (.so) dependancy ?
    By npatil15 in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2019, 16:11
  2. Static Library Dependency Issues
    By while_e in forum Qt Programming
    Replies: 6
    Last Post: 16th May 2017, 19:31
  3. Add openssl library to my project
    By davinciomare in forum Newbie
    Replies: 7
    Last Post: 1st October 2016, 17:57
  4. Library dependency issue
    By jepessen in forum Newbie
    Replies: 1
    Last Post: 28th May 2011, 07:59
  5. Library dependency in Qt 4.6
    By Tino in forum Installation and Deployment
    Replies: 1
    Last Post: 7th December 2009, 18:28

Tags for this Thread

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.