QSslSocket HostNotFoundError QT 5.13

  • I developed small Qt App for sending mails over smtp 465 port. It works on my developer linux mint 19.2 machine. When I deploy the app with all the libs to Mint 17.3 machine I get QAbstractSocketError::HostNotFoundError. I am using QSslSocket.

    If I deploy my app and libs to another linux mint 19.2 machine it works without any problems. So the problem is the difference in mint 19.2 and 17.3. I exhausted all my possibilities/ideas.

    The OpenSsl is the same installed on both machines! QSslSocket::sslLibraryBuildVersionString() shows 1.1.1b OpenSsl version- the same as installed on deploying machine.

  • @Tomaz if your issue is solved now, please don't forget to mark your post as such!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Might be a silly question, but are you sure you can access the server from that specific machine ?

  • @Tomaz said in QSslSocket HostNotFoundError QT 5.13:

    deploy my app and li

    Yes. Thunderbird works with the same settings. With thunderbird I can send and receive mails on the same server.

  • Lifetime Qt Champion

    Are you also using the same version of Qt on both machines ?
    Are you using the one provided by the distribution ?
    If not, please try this one.

  • On deploying machine is no Qt framework installed. All libs come with the app elf file (deployed with linuxdeployqt). There is also another glibc loader so elf file is not running- loading- I provided newer loader from mint 19.2 and patched elf file with patchelf app to run the app on mint 17.3 machine. Everything works except part of my app sending mails. Deploying machine is minimalistic only things needed are installed. Mint 17.3 is used because the machine is to slow for newer mint versions. If I deploy the app with libs on the same machine mint 19.2 installed (and running slow) and no Qt framework installed everything works fine. So there is some kind of a problem between mint 17.3 and 19.2. I tried everything...have no idea anymore...

  • Lifetime Qt Champion

    Looks like your are using some convoluted way to deploy your application.

    Can you give more detail ?

  • Well, I use linuxdeployqt app to change the path to needed dynamical linked files or dependency .so files to my lib folder. Thats all. And it works. Second I use patchelf app to change the loader for my app. So I copy my loader from mint 19.2 because at compile time my app links to newer loader that comes with mint 19.2. I am compiling on machine with mint 19.2 installed- I just copy the loader beside my app and change the elf loader (found in /lib/x86_64-linux-gnu/) with patchelf to use my loader from mint 19.2. ld or loader manuall page states that the loader is a portable file and it is encouraging to move the loader beside the elf or app file! My app runs with no problems on mint 17.3 with loader from mint 19.2. Thats it. Now I am asking myself if there is a problem with different glibc files (standard C library - mallock, alock,..etc). Perhaps (after almost every linux app links against glibc) there could be a problem with functions in glibc that differ from mint 17.3 to mint 19.2 when the qabstractsocket/QSslSocket is used/methods called? Does this class uses functions from glibc when the hostlookup is done?

  • Lifetime Qt Champion

    Is OpenSSL also included along your deployed app ?

  • In previus answer I forgot to write that deployed glibc.so.6 in lib folder shows dependency to local ld or loader on deployed machine that differs from loader on my development machine. I did change that but it didnt help. Yes... I am suspecting also OpenSSL. But I do not know wich files or .so I have to put beside my elf/app file. Installed version on deployed machine is the same as the method QSslSocket::sslLibraryBuildVersionString() is showing or Qt is compiling against- 1.1.1b OpenSsl version. Could it be that my executable is looking for .so or OpenSsl files in some Qt folder on deployed machine? And those folders and files do not exists?

  • Lifetime Qt Champion

    Did you check with ldd if everything can load ?

  • Hi. First, thanks for helping me out! Yes ldd shows everything is loading. Output of ldd is:

    tomaz@tomaz-HP-350-G1:~/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release$ ldd mail
    linux-vdso.so.1 (0x00007fff70180000)
    libQt5Widgets.so.5 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libQt5Widgets.so.5 (0x00007fc18794f000)
    libQt5Network.so.5 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libQt5Network.so.5 (0x00007fc18759f000)
    libQt5Core.so.5 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libQt5Core.so.5 (0x00007fc186df2000)
    libstdc++.so.6 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libstdc++.so.6 (0x00007fc186a27000)
    libgcc_s.so.1 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libgcc_s.so.1 (0x00007fc18680e000)
    libc.so.6 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libc.so.6 (0x00007fc186416000)
    libQt5Gui.so.5 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libQt5Gui.so.5 (0x00007fc185bc9000)
    libpthread.so.0 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libpthread.so.0 (0x00007fc1859a8000)
    libGL.so.1 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libGL.so.1 (0x00007fc18570a000)
    libm.so.6 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libm.so.6 (0x00007fc185369000)
    libz.so.1 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libz.so.1 (0x00007fc18514b000)
    libdl.so.2 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libdl.so.2 (0x00007fc184f46000)
    libicui18n.so.56 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libicui18n.so.56 (0x00007fc184aad000)
    libicuuc.so.56 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libicuuc.so.56 (0x00007fc1846f5000)
    libicudata.so.56 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libicudata.so.56 (0x00007fc182d12000)
    libgthread-2.0.so.0 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libgthread-2.0.so.0 (0x00007fc182b0f000)
    libglib-2.0.so.0 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libglib-2.0.so.0 (0x00007fc1827ee000)
    ld-2.27.so => /lib64/ld-linux-x86-64.so.2 (0x00007fc1883b0000)
    libGLX.so.0 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libGLX.so.0 (0x00007fc1825bc000)
    libGLdispatch.so.0 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libGLdispatch.so.0 (0x00007fc182305000)
    libpcre.so.3 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libpcre.so.3 (0x00007fc182092000)
    libX11.so.6 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libX11.so.6 (0x00007fc181d54000)
    libxcb.so.1 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libxcb.so.1 (0x00007fc181b27000)
    libXau.so.6 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libXau.so.6 (0x00007fc181922000)
    libXdmcp.so.6 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libXdmcp.so.6 (0x00007fc18171b000)
    libbsd.so.0 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/libbsd.so.0 (0x00007fc181505000)
    librt.so.1 => /home/tomaz/QtProjekti/build-mail-Desktop_Qt_5_13_0_GCC_64bit-Release/./lib/librt.so.1 (0x00007fc1812fc000)

  • Lifetime Qt Champion

    Next I would go with strace, OpenSSL is not linked by default but dlopened so it won't appear using ldd.

  • I tried strace. In did there were some ssl files missing. I copied them to my lib folder after strace showed my app searched for them in lib folder. It didnt helped. Now...after it didnt resolved dns and strace shows that app or sslsocket opens etc/hosts file to resolve domain name I just added ip and domain name of smtp server. And now it works. So my app resolves domain from my hosts file. Strange. I cant understand why it dint resolve smtp name from outer dns server? Do you have any explanation?

  • Lifetime Qt Champion

    Nice !

    That's a good question that I currently do not have an answer for, sorry. Maybe the folks from the linuxdeployqt project might have an idea.

  • Huh it turn out that on deployed machine the openssl version must be the same as on developing machine in qts folder. That in my case 1.1.1b. So if deploying machine has diffrent version of openssl istalled you have to move some so.1.1 files like ssl, dns, crypto and some other files into deployed machine lib folder or aside elf/app executable. Strace did help. Thank you.

  • @Tomaz if your issue is solved now, please don't forget to mark your post as such!