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. QSslSocket cannot resolve and Permission Denied error
Forum Updated to NodeBB v4.3 + New Features

QSslSocket cannot resolve and Permission Denied error

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 5 Posters 2.4k Views 2 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.
  • K Offline
    K Offline
    Kosta
    wrote on last edited by
    #1

    The error messages are the following:

    qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method

    qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method

    qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method

    qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method

    qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto

    qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb

    qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated

    qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos

    qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb

    qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected

    I run a Windows 7 machine, with openssl 1.1.0 installed on my D: drive. And I am using Qt5.9.0

    My .pro file

    QT += core network
    QT -= gui
    
    CONFIG += c++11 console
    CONFIG -= app_bundle
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += main.cpp \
        server.cpp \
        commands.cpp \
        packet.cpp
    
    HEADERS += \
        server.h \
        commands.h \
        packet.h
    
    INCLUDEPATH += D:\OpenSSL-Win32\include\openssl
    INCLUDEPATH += D:\OpenSSL-Win32\bin
    LIBS += -L D:\OpenSSL-Win32\lib -llibcrypto
    LIBS += -L D:\OpenSSL-Win32\lib -llibssl
    

    And this is the code that triggers the error:

    QString Commands::getPublicIp()
    {
    
        QString temp;
    
        QNetworkAccessManager networkManager;
        QUrl url("http://api.ipify.org");
    
        QString query = "format=json";
    
        url.setQuery(query);
    
        QNetworkReply* reply = networkManager.get(QNetworkRequest(url));
    
        QObject::connect(
                    reply
                    , &QNetworkReply::finished
                    , [&](){
    
                            if(reply->error() != QNetworkReply::NoError) {
                                return QString();
                            } else {
                                    QJsonObject jsonObject= QJsonDocument::fromJson(reply->readAll()).object();
                                    QHostAddress ip(jsonObject["ip"].toString());
    
                                    temp = QString("002 " + ip.toString());
                            }
    
                    reply->deleteLater();
                    }
                );
    
        return temp;
    
    }
    

    I kept getting the qt.network.ssl errors, and after linking openssl I keep getting a compile error:

    :-1: error: cannot find D:\OpenSSL-Win32\lib: Permission denied

    :-1: error: cannot find -llibssl

    collect2.exe:-1: error: error: ld returned 1 exit status

    Even though I am not currently using OpenSSL, I am willing to use it later.

    aha_1980A 1 Reply Last reply
    0
    • K Kosta

      The error messages are the following:

      qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method

      qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method

      qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method

      qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method

      qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto

      qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb

      qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated

      qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos

      qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb

      qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected

      I run a Windows 7 machine, with openssl 1.1.0 installed on my D: drive. And I am using Qt5.9.0

      My .pro file

      QT += core network
      QT -= gui
      
      CONFIG += c++11 console
      CONFIG -= app_bundle
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which as been marked deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      SOURCES += main.cpp \
          server.cpp \
          commands.cpp \
          packet.cpp
      
      HEADERS += \
          server.h \
          commands.h \
          packet.h
      
      INCLUDEPATH += D:\OpenSSL-Win32\include\openssl
      INCLUDEPATH += D:\OpenSSL-Win32\bin
      LIBS += -L D:\OpenSSL-Win32\lib -llibcrypto
      LIBS += -L D:\OpenSSL-Win32\lib -llibssl
      

      And this is the code that triggers the error:

      QString Commands::getPublicIp()
      {
      
          QString temp;
      
          QNetworkAccessManager networkManager;
          QUrl url("http://api.ipify.org");
      
          QString query = "format=json";
      
          url.setQuery(query);
      
          QNetworkReply* reply = networkManager.get(QNetworkRequest(url));
      
          QObject::connect(
                      reply
                      , &QNetworkReply::finished
                      , [&](){
      
                              if(reply->error() != QNetworkReply::NoError) {
                                  return QString();
                              } else {
                                      QJsonObject jsonObject= QJsonDocument::fromJson(reply->readAll()).object();
                                      QHostAddress ip(jsonObject["ip"].toString());
      
                                      temp = QString("002 " + ip.toString());
                              }
      
                      reply->deleteLater();
                      }
                  );
      
          return temp;
      
      }
      

      I kept getting the qt.network.ssl errors, and after linking openssl I keep getting a compile error:

      :-1: error: cannot find D:\OpenSSL-Win32\lib: Permission denied

      :-1: error: cannot find -llibssl

      collect2.exe:-1: error: error: ld returned 1 exit status

      Even though I am not currently using OpenSSL, I am willing to use it later.

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Kosta

      Qt is loading the SSL library dynamic at runtime, so you don't need to link against.

      IIRC, Qt 5.9 only supports OpenSSL 1.0, as 1.1 is binary incompatible.

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • K Offline
        K Offline
        Kosta
        wrote on last edited by Kosta
        #3

        I just reinstalled version 0.9 and removed links, still getting the errors, and I am not getting any answer from the http request @aha_1980

        1 Reply Last reply
        0
        • Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @Kosta maybe this post can help a little. I guess you're missing files libeay32.dll, libssl32.dll and
          ssleay32.dll available to your application in the path (it's usual to copy them in same folder as your .exe)

          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
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            As @aha_1980 wrote, Qt 5.9 supports the 1.0 series. You should use the latest of it. There's no reason to use an outdated and unsupported version like 0.9.

            On a side note, why not print something in case of an error to have a clue about what is happening ?
            The reply also provides an error signal that you should connect to.

            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
            2
            • N Offline
              N Offline
              NikMiller
              wrote on last edited by
              #6

              C:\Qt\your version QT\Tools\mingw491_32\opt\bin : libeay32.dll, ssleay32.dll
              copy them in same folder as your .exe

              1 Reply Last reply
              0

              • Login

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