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. Static linked openssl causes segfault in Qt application on https requests
Forum Update on Monday, May 27th 2025

Static linked openssl causes segfault in Qt application on https requests

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 1.5k Views
  • 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.
  • A Offline
    A Offline
    adnan
    wrote on 28 Apr 2018, 07:05 last edited by
    #1

    I have Qt 4.8 app which had been working fine so far on all Linux distros. It dynamically links with system installed the Qt libs on Ubuntu and other Linux distro.

    Recently, I added a libcurl dependency to my project, since I needed https, I statically compiled libcurl with openssl 1.1.0h support (to avoid openssl version lock). Now after linking libcurl.a, libcrypto.a and libssl.a with my app the curl functions work fine.

    But the existing code which uses QNetworkAccessManager starting seg faulting suddenly. Following is the stacktrace:

    (gdb) backtrace
    #0  __GI___libc_free (mem=0x55) at malloc.c:2951
    #1  0x00000000006916d4 in X509_VERIFY_PARAM_free ()
    #2  0x00007fffca7e1ee9 in SSL_free ()
       from /lib/x86_64-linux-gnu/libssl.so.1.0.0
    #3  0x00007ffff6e7fd54 in ?? ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    #4  0x00007ffff6e81627 in ?? ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    #5  0x00007ffff6e7889c in ?? ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    #6  0x00007ffff6e7381d in QSslConfiguration::defaultConfiguration() ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    #7  0x00007ffff6e09e53 in QNetworkRequest::sslConfiguration() const ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    #8  0x00007ffff6df2143 in QNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, QNetworkRequest const&, QIODevice*) ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    #9  0x00007ffff6deefc4 in QNetworkAccessManager::get(QNetworkRequest const&) ()
       from /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4
    

    If I use openssl 1.0.0 it starts runnig fine on Linux distros like Ubuntu which have default openssl version as 1.0.0 but segfaults on Fedora 27 which uses openssl version 1.1.0.

    It seems Qt tries to load system installed openssl lib and crashes if the version doesn't match with the one linked statically.

    Any possible solution, I am stuck with this for days now.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 28 Apr 2018, 21:57 last edited by
      #2

      Hi,

      Qt uses the 1.0.X branch of OpenSSL. Since 5.10, the support for OpenSSt 1.1 is available but you have to re-build Qt yourself.

      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
      • A Offline
        A Offline
        adnan
        wrote on 29 Apr 2018, 07:31 last edited by
        #3

        I tried linking Opens SSL 1.0.0 with my app and it doesn't interfere with Qt on Ubuntu. But on Fedora 27 openssl version is 1.1.0 and Qt is seemingly trying to load the 1.1 version even for Qt 4.8, which is causing a segfault.

        Since 5.10, the support for OpenSSt 1.1 is available but you have to re-build Qt yourself.
        Even openssl 1.0.0 is segfaulting on Fedora 27

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 29 Apr 2018, 11:56 last edited by
          #4

          The stack trace you show is using your distribution provided Qt.
          So which are you currently using ?
          If you built it, how did you do it ?

          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
          • A Offline
            A Offline
            adnan
            wrote on 30 Apr 2018, 07:13 last edited by
            #5

            I am using the Qt4.8 provided by Linux Distribution. Additionally, I am statically linking OpenSSL 1.1.0 with my app.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 30 Apr 2018, 07:17 last edited by
              #6

              How are you using OpenSSL in your application ?

              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
              • A Offline
                A Offline
                adnan
                wrote on 1 May 2018, 05:14 last edited by
                #7

                I am using libcurl and libcurl uses openssl for https requests. So I am linking openssl only because it is a libcurl dependency.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 2 May 2018, 21:06 last edited by
                  #8

                  From the looks of your error, in seems to come from QtNetwork in Qt 4. Isn't there already a problem there ?

                  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

                  1/8

                  28 Apr 2018, 07:05

                  • Login

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