Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting "qt.network.ssl: QSslSocket: cannot call unresolved function..." when trying to send network request
Forum Updated to NodeBB v4.3 + New Features

Getting "qt.network.ssl: QSslSocket: cannot call unresolved function..." when trying to send network request

Scheduled Pinned Locked Moved Solved General and Desktop
25 Posts 10 Posters 17.3k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T TheMushroom

    What I'm trying to do is to send a simple request to a URL using Qt, however when I try to run the program I get these errors in the console: (The program doesn't crash, it only logs this in the console)

    qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
    qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
    qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
    qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
    qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
    

    I browsed around for solutions for a while and managed to find several ones :

    1. Add "QT += network" in the pro file. (Didn't work)
    2. Add libeay32.dll and ssleay32.dll to the project .exe file. (Didn't work)
    3. Add libeay32.dll and ssleay32.dll to System32 folder. (Didn't work)
    4. Add libeay32.dll and ssleay32.dll to "D:\Qt\Tools\mingw530_32\bin" folder. (Didn't work)

    Here's the networking part of my code:

        QString requestUrl = "https://api.darksky.net/forecast/[key]/[latitude],[longitude]";
        requestUrl = requestUrl.replace("[key]", key);
        requestUrl = requestUrl.replace("[latitude]", latitude);
        requestUrl = requestUrl.replace("[longitude]", longitude);
    
        qDebug() << "Request URL: " << requestUrl;
    
        QNetworkRequest request = QNetworkRequest(QUrl(requestUrl));
    
        m_callback = callback;
        m_netMgr->connect(m_netMgr, &QNetworkAccessManager::finished, DarkSkyAPI::m_callback);
    
        m_netMgr->get(request);
    

    And here's the function which is assigned to the DarkSkyAPI::m_callback function pointer variable:

    void MainWindow::DarkSkyCallback(QNetworkReply *reply)
    {
        qDebug() << "Content:";
        qDebug() << reply->readAll();
    }
    
    

    Not sure what I'm doing wrong here :/

    raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #2

    @TheMushroom
    Either your application loads (older) OpenSSL libraries from the PATH, or it can't find the OpenSSL libraries you've provided.

    In QtCreator you can check the modules panel to see what libraries are loaded by your application.

    Keep in mind that when you run your application from within QtCreator, the run directory isn't the directory the exe relies. For a deployed application it's fine to also deploy the libraries next to your exe.

    What Qt version are you actually using?
    What OpenSSL version did you try to copy?

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    T 1 Reply Last reply
    0
    • raven-worxR raven-worx

      @TheMushroom
      Either your application loads (older) OpenSSL libraries from the PATH, or it can't find the OpenSSL libraries you've provided.

      In QtCreator you can check the modules panel to see what libraries are loaded by your application.

      Keep in mind that when you run your application from within QtCreator, the run directory isn't the directory the exe relies. For a deployed application it's fine to also deploy the libraries next to your exe.

      What Qt version are you actually using?
      What OpenSSL version did you try to copy?

      T Offline
      T Offline
      TheMushroom
      wrote on last edited by
      #3

      @raven-worx

      Where can I find the modules panel?
      I'm using Qt version 5.2.2, and my OpenSSL version is OpenSSL v1.0.2n.

      I tried running the program from the .exe directly, which has both openssl dlls in its directory, however it seems like the same error is still occurring there. I checked this by just setting a labels text to reply->readAll(), which resulted in an empty label with nothing in it.

      raven-worxR 1 Reply Last reply
      0
      • T TheMushroom

        @raven-worx

        Where can I find the modules panel?
        I'm using Qt version 5.2.2, and my OpenSSL version is OpenSSL v1.0.2n.

        I tried running the program from the .exe directly, which has both openssl dlls in its directory, however it seems like the same error is still occurring there. I checked this by just setting a labels text to reply->readAll(), which resulted in an empty label with nothing in it.

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by raven-worx
        #4

        @TheMushroom
        oh... the Modules panel is hidden by default.
        You can make it visible from the menu (Window -> Views -> Modules)

        Did you override the run environment (in the project settings) - specifically the PATH variable - maybe?

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        T 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi,

          To add to @raven-worx, are you sure that your OpenSSL libraries are built for MinGW and in 32 bit ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          raven-worxR 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            To add to @raven-worx, are you sure that your OpenSSL libraries are built for MinGW and in 32 bit ?

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #6

            @SGaist
            OpenSSL binaries should only expose a C-interface, so there shouldn't be a problem regarding this.
            I know that the 1.1.x libraries do append -x64 in the library filename, but i don't know if that was also the case prior v1.1.x

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • raven-worxR raven-worx

              @TheMushroom
              oh... the Modules panel is hidden by default.
              You can make it visible from the menu (Window -> Views -> Modules)

              Did you override the run environment (in the project settings) - specifically the PATH variable - maybe?

              T Offline
              T Offline
              TheMushroom
              wrote on last edited by
              #7

              @raven-worx
              For some reason my Window->Views button is greyed out and can't be clicked.

              Is this the "project settings" tab? :
              Screenshot
              There doesn't seem to be any upper case PATH value, only a "Path" one.

              @SGaist
              I'm not sure what they were compiled for actually. I downloaded them off this site.

              raven-worxR 1 Reply Last reply
              0
              • T TheMushroom

                @raven-worx
                For some reason my Window->Views button is greyed out and can't be clicked.

                Is this the "project settings" tab? :
                Screenshot
                There doesn't seem to be any upper case PATH value, only a "Path" one.

                @SGaist
                I'm not sure what they were compiled for actually. I downloaded them off this site.

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by raven-worx
                #8

                @TheMushroom said in Getting "qt.network.ssl: QSslSocket: cannot call unresolved function..." when trying to send network request:

                For some reason my Window->Views button is greyed out and can't be clicked.

                you need to be in the Debug view (big Tab selected on the left side), then the menu item is enabled.

                Is this the "project settings" tab? :

                yes. Your environment isn't overridden.

                I downloaded them off this site.

                I just used OpenSSL today successfully with Qt 5.10.1 and mingw. I've downloaded it from here.

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                T 1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  @raven-worx indeed there shouldn't. However it's usually better to have everything from one compiler if possible to avoid surprises.

                  I was also thinking about 32 VS 64 bit builds.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • raven-worxR raven-worx

                    @TheMushroom said in Getting "qt.network.ssl: QSslSocket: cannot call unresolved function..." when trying to send network request:

                    For some reason my Window->Views button is greyed out and can't be clicked.

                    you need to be in the Debug view (big Tab selected on the left side), then the menu item is enabled.

                    Is this the "project settings" tab? :

                    yes. Your environment isn't overridden.

                    I downloaded them off this site.

                    I just used OpenSSL today successfully with Qt 5.10.1 and mingw. I've downloaded it from here.

                    T Offline
                    T Offline
                    TheMushroom
                    wrote on last edited by TheMushroom
                    #10

                    @raven-worx
                    How would I link the OpenSSL to Qt?

                    I tried using the "Add Library..." feature in Qt, which generated the following lines in my .pro file:

                    win32:CONFIG(release, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/MinGW/ -lssl-1_1
                    else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/MinGW/ -lssl-1_1d
                    else:unix: LIBS += -LD:/OpenSSL-Win32/lib/MinGW/ -lssl-1_1
                    
                    INCLUDEPATH += D:/OpenSSL-Win32/include
                    DEPENDPATH += D:/OpenSSL-Win32/include
                    
                    win32:CONFIG(release, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/ -llibcrypto
                    else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/ -llibcryptod
                    else:unix: LIBS += -LD:/OpenSSL-Win32/lib/ -llibcrypto
                    
                    INCLUDEPATH += D:/OpenSSL-Win32/include
                    DEPENDPATH += D:/OpenSSL-Win32/include
                    

                    I also added the libssl-1_1.dll and libcrypto-1_1.dll into the same places as I did with the libeay32.dll and ssleay32.dll files.

                    Still the same errors :(

                    raven-worxR 1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      You don't link. By default Qt loads the OpenSSL .dll.

                      However from the looks of it, you downloaded the 1.1 series which is not compatible with the 1.0.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      T Jasmin QuinnJ 2 Replies Last reply
                      0
                      • T TheMushroom

                        @raven-worx
                        How would I link the OpenSSL to Qt?

                        I tried using the "Add Library..." feature in Qt, which generated the following lines in my .pro file:

                        win32:CONFIG(release, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/MinGW/ -lssl-1_1
                        else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/MinGW/ -lssl-1_1d
                        else:unix: LIBS += -LD:/OpenSSL-Win32/lib/MinGW/ -lssl-1_1
                        
                        INCLUDEPATH += D:/OpenSSL-Win32/include
                        DEPENDPATH += D:/OpenSSL-Win32/include
                        
                        win32:CONFIG(release, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/ -llibcrypto
                        else:win32:CONFIG(debug, debug|release): LIBS += -LD:/OpenSSL-Win32/lib/ -llibcryptod
                        else:unix: LIBS += -LD:/OpenSSL-Win32/lib/ -llibcrypto
                        
                        INCLUDEPATH += D:/OpenSSL-Win32/include
                        DEPENDPATH += D:/OpenSSL-Win32/include
                        

                        I also added the libssl-1_1.dll and libcrypto-1_1.dll into the same places as I did with the libeay32.dll and ssleay32.dll files.

                        Still the same errors :(

                        raven-worxR Offline
                        raven-worxR Offline
                        raven-worx
                        Moderators
                        wrote on last edited by
                        #12

                        @TheMushroom said in Getting "qt.network.ssl: QSslSocket: cannot call unresolved function..." when trying to send network request:

                        How would I link the OpenSSL to Qt?

                        for that you would have to reconfigure and recompile Qt. As @SGaist said by default the OpenSSL libs are loaded dynamically.

                        What does the modules view show now?

                        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                        If you have a question please use the forum so others can benefit from the solution in the future

                        1 Reply Last reply
                        0
                        • SGaistS SGaist

                          You don't link. By default Qt loads the OpenSSL .dll.

                          However from the looks of it, you downloaded the 1.1 series which is not compatible with the 1.0.

                          T Offline
                          T Offline
                          TheMushroom
                          wrote on last edited by
                          #13

                          @SGaist
                          Downloaded the 1.0 version and copied the libeay32.dll, ssleay32.dll and libssl32.dll to the same places as before and it's all working now. No errors and everything seems to be working.

                          @SGaist @raven-worx
                          Thanks a lot for the help! :)

                          Pablo J. RoginaP Jasmin QuinnJ 2 Replies Last reply
                          1
                          • T TheMushroom

                            @SGaist
                            Downloaded the 1.0 version and copied the libeay32.dll, ssleay32.dll and libssl32.dll to the same places as before and it's all working now. No errors and everything seems to be working.

                            @SGaist @raven-worx
                            Thanks a lot for the help! :)

                            Pablo J. RoginaP Offline
                            Pablo J. RoginaP Offline
                            Pablo J. Rogina
                            wrote on last edited by
                            #14

                            @TheMushroom great you solved your problem. Please don't forget to mark your post as such. Thanks.

                            Upvote the answer(s) that helped you solve the issue
                            Use "Topic Tools" button to mark your post as Solved
                            Add screenshots via postimage.org
                            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                            1 Reply Last reply
                            0
                            • Q Offline
                              Q Offline
                              QtFlorian
                              wrote on last edited by
                              #15

                              Had the same problem. Thought I was on MinGW, but somehow was on MSCV2015. Switching the Kit (back) to Desktop Qt 5.10.1 MinGW 32bit did the trick for me.

                              Taz742T 1 Reply Last reply
                              0
                              • Q QtFlorian

                                Had the same problem. Thought I was on MinGW, but somehow was on MSCV2015. Switching the Kit (back) to Desktop Qt 5.10.1 MinGW 32bit did the trick for me.

                                Taz742T Offline
                                Taz742T Offline
                                Taz742
                                wrote on last edited by
                                #16

                                @QtFlorian
                                Do you have

                                @TheMushroom said in Getting "qt.network.ssl: QSslSocket: cannot call unresolved function..." when trying to send network request:

                                libeay32.dll, ssleay32.dll and libssl32.dll

                                dlls in your application?

                                Do what you want.

                                1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  You don't link. By default Qt loads the OpenSSL .dll.

                                  However from the looks of it, you downloaded the 1.1 series which is not compatible with the 1.0.

                                  Jasmin QuinnJ Offline
                                  Jasmin QuinnJ Offline
                                  Jasmin Quinn
                                  wrote on last edited by
                                  #17

                                  @SGaist Hello, I have the same issue but and i don't know which version should i download and copy in my debug folder ! can you help me please

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • Jasmin QuinnJ Jasmin Quinn

                                    @SGaist Hello, I have the same issue but and i don't know which version should i download and copy in my debug folder ! can you help me please

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #18

                                    @Jasmin-Quinn Qt Online Installer and Qt Maintenance Tool provide the possibility to install OpenSSL, use that.

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    Jasmin QuinnJ 1 Reply Last reply
                                    0
                                    • T TheMushroom

                                      @SGaist
                                      Downloaded the 1.0 version and copied the libeay32.dll, ssleay32.dll and libssl32.dll to the same places as before and it's all working now. No errors and everything seems to be working.

                                      @SGaist @raven-worx
                                      Thanks a lot for the help! :)

                                      Jasmin QuinnJ Offline
                                      Jasmin QuinnJ Offline
                                      Jasmin Quinn
                                      wrote on last edited by Jasmin Quinn
                                      #19

                                      @TheMushroom can you please tell me where did you place them exactly and from where u downloaded it

                                      1 Reply Last reply
                                      0
                                      • jsulmJ jsulm

                                        @Jasmin-Quinn Qt Online Installer and Qt Maintenance Tool provide the possibility to install OpenSSL, use that.

                                        Jasmin QuinnJ Offline
                                        Jasmin QuinnJ Offline
                                        Jasmin Quinn
                                        wrote on last edited by
                                        #20

                                        @jsulm I looked for it but didn't find the possibility to install OpenSsl . However, even if I did I still don't know which version is compatible with my Qt 5.9.9

                                        jsulmJ 1 Reply Last reply
                                        0
                                        • Jasmin QuinnJ Jasmin Quinn

                                          @jsulm I looked for it but didn't find the possibility to install OpenSsl . However, even if I did I still don't know which version is compatible with my Qt 5.9.9

                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #21

                                          @Jasmin-Quinn According to https://doc.qt.io/archives/qt-5.9/ssl.html it is 1.0.x

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          1 Reply Last reply
                                          1

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved