Application using OpenSSL 1.1.1d only working if I launch application from QtCreator
-
wrote on 19 Aug 2020, 16:29 last edited by
I am running Linux Mint 18.3 and QtCreator (Qt version 5.15) and developing a C++ GUI application. Because of the openSSL mismatch between Mint repository SSL version and that used by Qt5.12 onwards, I have installed the OpenSSL1.1.1d binaries via the Qt Maintenance Tool and have explicitly added these libraries to my application project.
Without this step the application does not work (as expected). With this step, my application runs successfully but ONLY when launched WITHIN QtCreator. It does not work when I try running the binary in any other way.
I know that I must be missing something simple here, but what is QtCreator doing that enables access to SSL?
I would like to be able to run my application without having to do so inside of QtCreator but so far I can find no workaround to allow this. Can anyone suggest what I am missing?
I can confirm that the output of calls to my QSslSocket::sslLibraryVersionString() function are returning empty string and "OpenSSL 1.1.1d" respectively, so I am convinced this is a runtime linking problem.
-
Hi and welcome to devnet,
What version does your Mint installation provide ?
-
wrote on 19 Aug 2020, 17:17 last edited by
@SGaist If I run >openssl version I get this output
OpenSSL 1.0.2g 1 Mar 2016
I recently upgraded to 5.15 from 5.9 and because of the change to use SSL 1.1 in Qt 5.12 I had to download the libs in the tools with the maintenance tool.
It all builds properly and it runs properly inside QtCreator but if I just execute the binary outside of it the SSL is not picked up. I am very confused. If I run one instance inside and another outside I can see from a ps ux that no command line params are being used. Looks like 2 identical instances of the binaries runner.Strangely, if I run ldd on my output binary I see no reference to either libssl.so or libcrypto.so despite explicitly adding these to the .pro file.
-
Qt does not link to OpenSSL due to export constraints in some countries with regard to cryptographic software. It dlopens the library if you provide them.
I wonder if using LD_LIBRARY_PATH would be enough in your case.
-
Qt does not link to OpenSSL due to export constraints in some countries with regard to cryptographic software. It dlopens the library if you provide them.
I wonder if using LD_LIBRARY_PATH would be enough in your case.
wrote on 19 Aug 2020, 18:05 last edited by@SGaist The paths to these Qt supplied binaries is contained within LD_LIBRARY_PATH for this project. What hidden magic is going on inside QtCreator such that everything works when I launch the binary from there but not elsewhere? I am really confused.
Is it perhaps a better option to simply build and install openSSL from source so that it matches what Qt5.15 now uses?
-
Check the Environment in the Run part of the Project panel.
-
wrote on 19 Aug 2020, 18:47 last edited by
@nerdman OK I think I know what QtCreator must be doing. If I change LD_LIBRARY_PATH to include the path to Qt supplied SSL libs then run my binary from the console, it DOES now pick this up.
I suppose that QtCreator is doing this prior to running the binary when launched from there.It is not an ideal solution but it at least allows me to do what is required. Many thanks @SGaist for your input that has helped me to get to this stage.
1/8