I have Qt 4.8.4 (default installation) with MSVC. In my application I'm using ssl connection to the server. QtNetworkd4.dll requires runtime libeay32.dll and ssleay32.dll If I put these libs inside my app directory everything works fine.
I was trying to compile openssl libs statically into my application, although compilation goes fine, during startup application complains about unresolved symbols until I place libeay32.dll and ssleay32.dll into application folder.
So question is: Is it true, that compiling these libs into my application is useless, because QtNetwordkd4.dll will not look for needed functions/symbols inside my application binary, and I should rather compile entire Qt with openssl built in? Like this:
configure -openssl -I C:\OpenSSL-Win32\include -L C:\OpenSSL-Win32\lib\VC\static
Or what I'm trying to do is actually doable, and I've just done something wrong, like wrong version of libeay32 and ssleay32, etc. ?
I'm trying to compile with static openssl for two reasons
- I wouldn't have to place libeay32 and ssleay32 inside my app dir
- I'm afraid that on some machines there can be openssl already installed in different version, and my app will interact with these libs from system directories.
Correct, statically compiling OpenSSL into your application is useless, as QtNetwork4.dll is expecting functions to be is the openssl DLLs, not in your application.
You two options are to compile OpenSSL into Qt, or to distribute libeay32 and ssleay32 with your application. Alternately, you could ask your users to install those DLLs on their own, but version mismatch can be a bad thing (there are some big differences between 0.9.x and 1.x builds).
When compiling Qt you can choose one of these options based on the
configure
command line:-no-openssl
)-openssl
; default)-openssl-linked
)The last one means dynamic linking (if Qt is built as a shared library), or static linking (when doing a static build of Qt, i.e.
-static
).So the ""solution"" to your problem is passing
-static -openssl-linked
to Qt'sconfigure
.I say ""solution"" because
Try like this: