Qt 5.6.2 on Windows, static build with openssl 1.0.2L and MinGW492_32
-
wrote on 3 Oct 2017, 07:16 last edited by
hi,
I have only one version installed.
I realized that I didn't use the right Qt prompt, I was in dynamic environment.
But, I still have problems in static environment.
Do I need to link to -lssl, -lcrypto -llibeay32 -lssleay32, in the OPENSSL_LIBS ??I don't really understand the difference between -openssl and -openssl-linked.
Is it possible to link statically openssl when I build my project instead of link to the Qt build?
Best regards, -
wrote on 3 Oct 2017, 13:19 last edited by
When I execute in debug mode my application, I get this error :
qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback 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 Auto configuration failed 5672:error:02001015:system library:fopen:Is a directory:.\crypto\bio\bss_file.c:126:fopen('d:/test/openssl098kvc6/openssl.cnf','rb') 5672:error:2006D002:BIO routines:BIO_new_file:system lib:.\crypto\bio\bss_file.c:131: 5672:error:0E078002:configuration file routines:DEF_LOAD:system lib:.\crypto\conf\conf_def.c:199: QMutex: destroying locked mutex
What I need to do to fix this, please?
-
It looks like you didn't explicitly state that you wanted OpenSSL to be linked to Qt (
-openssl-linked
) so it tries to load the library but it can't find it. One way to check that is to go the Run part of the Project panel and modify the PATH environment variable there to include the path to the OpenSSL .dlls. -
wrote on 3 Oct 2017, 13:47 last edited by Matthieu 0 10 Mar 2017, 13:48
So I need to build with -openssl-linked.
But do I need to add some build options? like -lssl -lcrypto -lssleay -llibeay32?In dependency walker, there is no openssl dll.
-
Because by default Qt loads the .dll it doesn't link against it.
-
wrote on 5 Oct 2017, 12:22 last edited by
Is it possible to build qt without openssl dll dependencies?
I don't know if I am on the wrong way. -
Yes, use
-openssl-linked
and a static build of OpenSSL. -
wrote on 12 Oct 2017, 07:36 last edited by Matthieu 0 10 Dec 2017, 12:18
Hello,
To answer myself, I found the solution and here is how I did it.First, I build openssl in static mode. You need to install active perl, mingw-get-setup.exe and mysys-1.0.11.exe (i'm not sure if this one is really required). I downloaded the openssl-1.0.2l sources and I followed this guide: http://www.stringcat.com/company_blog/2015/12/07/compiling-openssl-on-windows-mingw32/
To build, start mingw, go to the openssl root directory and run:perl Configure mingw no-shared
At the end, I created a subdirectory named lib in the openssl dir and copied libssl.a and libcrypo.a into it.
To build Qt, I used this script:
https://sourceforge.net/p/qtlmovie/code/ci/v1.2.16/tree/build/windows-build-qt-static.ps1?format=raw
I added these parameters to the configure line:-openssl-linked -I c:\openssl\include -L c:\openssl\lib
In this script, I added a pause between configure and make to be able to modify a file juste before the compilation phase. Just write a new line below configure and write: pause.
Execute the script.
When the script is paused, open the qtbase/mkspecs/qmodule.pri file and change:
-lssleay32 -llibeay32
to:
-lssl -lcrypto -lgdi32
and save the file.
Press any key to continue the pause. Wait, enjoy.
I think this is a bug in the Qt build system, with openssl-linked we shouldn't have linked to *eay32...
-
IIRC, it's Windows VS *nix naming issue with OpenSSL so not a bug.
-
wrote on 13 Oct 2017, 06:29 last edited by
So, it's a bug, for me :D
14/14