1

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?

riverofwind
  • 525
  • 4
  • 17
  • 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 Mar 08 '16 at 20:29
  • 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 http://stackoverflow.com/questions/35442599/qt-https-ssl-support-for-static-qt-static-program-build-getting-protocol-htt – riverofwind Mar 08 '16 at 20:32

2 Answers2

0

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

-L C:\OpenSSL-Win32\lib\MinGW\static
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • Thanks - the only files in the mingw lib dir are libeay32.a libeay32.def ssleay32.a and ssleay32.def. Also there is no static directory. – riverofwind Mar 03 '16 at 21:42
  • @JoshOrenberg `.a` looks like a static archive (a collection of `.o` files), but on mingw that's not a given. Perhaps you should check whether these are import libraries or true static libraries. If they aren't static, then you're out of luck and need to either statically build openssl yourself, or find another source of it. – Kuba hasn't forgotten Monica Mar 03 '16 at 22:19
0

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).

riverofwind
  • 525
  • 4
  • 17