Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Cannot get SSL to work with Qt6.5.2 on Linux
Forum Updated to NodeBB v4.3 + New Features

Cannot get SSL to work with Qt6.5.2 on Linux

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 2 Posters 867 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.
  • M Offline
    M Offline
    Michel de Boer
    wrote on last edited by
    #1

    Hi, I am using Qt6.5.2 to send a HTTPS request. I am getting an error that SSL versions are incompatible:

    • Incompatible version of OpenSSL (built with OpenSSL >= 3.x, runtime version is < 3.x)

    However I have in stalled openssl 3:

    > openssl version -a
    
    OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
    built on: Wed May 24 17:12:55 2023 UTC
    platform: debian-amd64
    options:  bn(64,64)
    compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -ffile-prefix-map=/build/openssl-Z1YLmC/openssl-3.0.2=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
    OPENSSLDIR: "/usr/lib/ssl"
    ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-3"
    MODULESDIR: "/usr/lib/x86_64-linux-gnu/ossl-modules"
    Seeding source: os-specific
    CPUINFO: OPENSSL_ia32cap=0x7ffaf3bfffebffff:0x40000000029c67af
    
    

    I added this debug info to see what version Qt thinks it is dealing with:

    qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();
    qDebug() << "OpenSSL lib:" << QSslSocket::sslLibraryVersionString();
    qDebug() << "OpenSSL lib build:" << QSslSocket::sslLibraryBuildVersionString();
    

    I get the following output:

    18:52:04.135 debug Xrpc::Client::Client'12 Device supports OpenSSL:  false
    18:52:04.135 debug Xrpc::Client::Client'13 OpenSSL lib: ""
    18:52:04.135 debug Xrpc::Client::Client'14 OpenSSL lib build: ""
    

    It does not find any SSL versions, not in the build, not on the system. Yet the error says it is built with version 3.x

    I am using open source version of Qt 6.5.2 installed with the maintenance tool.

    Can someone help me on how to fix this?

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

      Hi,

      Can you start your application with strace ? This should show where the OpenSSL library is searched for.

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

      M 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Can you start your application with strace ? This should show where the OpenSSL library is searched for.

        M Offline
        M Offline
        Michel de Boer
        wrote on last edited by
        #3

        @SGaist Thanks for your quick reaction!

        I ran it with strace and grepped its output for ssl. There are some errors in there:

        readlink("/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so", 0x7ffd79596810, 1023) = -1 EINVAL (Invalid argument)
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so", O_RDONLY|O_CLOEXEC) = 36
        readlink("/home/michel/Qt/6.5.2/gcc_64/plugins/tls/qopensslbackend.debug", 0x7ffd79596810, 1023) = -1 EINVAL (Invalid argument)
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so.avx2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
        access("/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so.avx2", F_OK) = -1 ENOENT (No such file or directory)
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so", O_RDONLY|O_CLOEXEC) = 35
        openat(AT_FDCWD, "/usr/local/ssl/lib/libcrypto.so", O_RDONLY|O_CLOEXEC) = 35
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/lib/libssl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
        openat(AT_FDCWD, "/usr/local/ssl/lib/libssl.so", O_RDONLY|O_CLOEXEC) = 35
        
        

        Not sure if the "Invalid argument" errors are fatal. The "no such file" errors seems to suggest I am missing some libs from the Qt installation.

        I also grepped for "tls". That gives a lot of output. Here are the first few lines:

        readlink("/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so", 0x7ffd79596810, 1023) = -1 EINVAL (Invalid argument)
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so", O_RDONLY|O_CLOEXEC) = 36
        readlink("/home/michel/Qt/6.5.2/gcc_64/plugins/tls/qopensslbackend.debug", 0x7ffd79596810, 1023) = -1 EINVAL (Invalid argument)
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so.avx2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
        access("/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so.avx2", F_OK) = -1 ENOENT (No such file or directory)
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/plugins/tls/libqopensslbackend.so", O_RDONLY|O_CLOEXEC) = 35
        openat(AT_FDCWD, "/usr/local/ssl/lib/libcrypto.so", O_RDONLY|O_CLOEXEC) = 35
        openat(AT_FDCWD, "/home/michel/Qt/6.5.2/gcc_64/lib/libssl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
        openat(AT_FDCWD, "/usr/local/ssl/lib/libssl.so", O_RDONLY|O_CLOEXEC) = 35
        

        Similar errors pointing at missing libs.

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

          Something is looking strange, why do you have OpenSSL in /usr/local/ssl ? That's not a standard place for a distribution provided library.

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

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            Something is looking strange, why do you have OpenSSL in /usr/local/ssl ? That's not a standard place for a distribution provided library.

            M Offline
            M Offline
            Michel de Boer
            wrote on last edited by
            #5

            @SGaist You are right!
            Several months ago I had an issue with openssl 3. To work around it I installed openssl 1 in /usr/local. I just removed it and now it all works!
            Thanks for your help!

            SGaistS 1 Reply Last reply
            0
            • M Michel de Boer

              @SGaist You are right!
              Several months ago I had an issue with openssl 3. To work around it I installed openssl 1 in /usr/local. I just removed it and now it all works!
              Thanks for your help!

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Great !

              Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)

              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
              • M Michel de Boer has marked this topic as solved on

              • Login

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