Compiling OpenSSL with MinGW
Jump to navigation
Jump to search
Compiling OpenSSL with MinGW
Qt 5 / QtWebkit can make use of OpenSSL, which MinGW distributions do not ship.
Pre-built packages
The Win32OpenSSL project [slproweb.com] provides pre-compiled libraries for both 32 and 64 bit. However, these depend on the Microsoft Visual C++ 2008 runtime being installed.
Compiling on your own
Requirements
- MSYS command prompt (an sh shell + some UNIX tools, get it from http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.11/MSYS-1.0.11.exe/download?use_mirror=garr. It’s also an (optional) part of mingw.org installer.)
- Perl
- Working MinGW, or MinGW-w64 toolchain
How to build
- Download latest OpenSSL from http://www.openssl.org/source (e.g. openssl-1.0.1c.tar.gz)
- Start a MSYS command prompt (C:\msys\1.0\msys.bat)
- Extract tar.gz using MSYS tar (and ignore the symlink warnings)
- don’t use 7zip or other apps, since they fail to set up any symlinks! tar will also complain about symlinks, but compilation will still succeed.
Check that gcc is in PATH, otherwise add it, e.g.
for MinGW (32 bit) do:
for MinGW-w64 do:
Compile & install:
Errors
If you run into
check out http://openssl.6102.n7.nabble.com/Compile-error-with-MinGW-w64-td36657.html
- Use MSYS perl
- or change crypto/perlasm/x86_64-xlate.pl as mentioned in the e-mail thread.
Using it
Add the bin, include, lib folders to your compilation environment, e.g. for cmd.exe:
When you now run Qt’s configure.exe openssl should be detected, and Qt links against the libraries.