1
votes

Hi I am trying to compile a QT program I made for Windows statically with the openssl libraries compiled into the executable. I thought I succeeded however I can't run the porgram without the Openssl dlls present. I looked all over the net trying to find a solution but couldn't. Here's what I've done:

I passed this to configure.bat by editing the windows powershell script for building qt statically and then run it to build:

-openssl-linked
-I C:\OpenSSL-Win32\include
-L C:\OpenSSL-Win32\lib\MinGW
OPENSSL_LIBS=""-lUser32 -lAdvapi32 -lGdi32 -lCrypt32""
OPENSSL_LIBS_DEBUG=-""-lssleay32 -llibeay32""
OPENSSL_LIBS_RELEASE=""-lssleay32 -llibeay32""

The executable won't work without the openssl dlls now. Am I doing something wrong?

2
Some extra things to consider when performing this qt static build - use -L C:\OpenSSL-Win32\lib without the MinGW dir on the end, when editing the powershell script for qt static build you must do two things - use double quotes as shown above for the parameters in order to pass sucessfully to configure.bat, also I had trouble inserting newlines in the powershell script so I ended up going to the end of an exising lines, holding down shift then pressing right arrow key to select the newline and then pasting it over the newlines I had already created - this was necessary make the script to work - riverofwind
Also if you have to rebuild QT statically just delete the static dir to start over from scratch and once the mingw static qt build is done you will need to put the openssl dlls in the same dir as the exe. This is a continuation of a previous thread stackoverflow.com/questions/35442599/… - riverofwind

2 Answers

0
votes

You're linking with the dynamic version of OpenSSL. You should link with the static one instead:

-L C:\OpenSSL-Win32\lib\MinGW\static
0
votes

Answer from Shining Light Productions:

Dependency Walker will show you what DLLs your executable depends on. The MinGW libraries are "built" using the VC++ DLLs as the source. IIRC, there are no static MinGW builds (why the generated .a files are so massive has always been a mystery to me).