Reputation: 320
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
Upvotes: 4
Views: 3655
Reputation: 21
Try like this:
-openssl -openssl-linked -I C:\OpenSSL-Win32\include -L C:\OpenSSL-Win32\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
Upvotes: 2
Reputation: 22734
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's configure
.
I say ""solution"" because
Upvotes: 1
Reputation: 8472
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).
Upvotes: 0