A number of libraries applications depend on OpenSSL, to name a few: cURL, QtNetwork, WebKit, your IMAP or secure SMTP client, etc. Building of OpenSSL is painstaking, unless you know some tricks. Read more for guidance.
- If you yet to have MinGW, read to learn how to install it.
- Download Perl from ActiveState site: . Choose version that match your Windows. MSI installer is recommended, unless you are so fluent in Windows and don’t mind spending time with little tweaks like adding PATH, etc
- Run the MSI installer and point path to C:\develop\tools\perl . You may choose different path, but that’s what on my machine.
- Having installed with Perl, now let’s fetch OpenSSL: (the latest version of OpenSSL 0.9.8 at the time of writing). I wouldn’t recommend chasing after the version 1.0 for now.
- Extract openssl to C:\develop\tools\ and you will obtain directory C:\develop\tools\openssl-0.9.8n . Get inside it.
- Before you start building anything, take note that the macro OPENSSL_IMPLEMENT_GLOBAL causes fatal errors. Find it inside the files openssl-0.9.8n\e_os2.h , openssl-0.9.8n\include\openssl\e_os2.h and openssl-0.9.8n\outinc\openssl\e_os2.h . Find the macro’s definition and change
static type _hide_##name
/* static type _hide_##name */ type _hide_##name
- Now let’s build shared & static versions of OpenSSL with a single command (you are now inside C:\develop\tools\openssl-0.9.8n):
Navigate to YouTube and have some snack. It may take 15-20 mins to finish building.
- When building is finished, you can copy outinc\openssl to your mingw\include directory. You also can copy generated *.a and *.dll files to mingw\lib directory and the *.dll to mingw\bin directory. If you hate copying, remember to make use of -I and -L flags to appropriate folders when building with MinGW.
Building & installation of OpenSSL is done.
Edit: As noted by Darrell Walisser in the comments part, Perl distributed with msys was the culprit. Installing ActiveState Perl will solve the issue without this workaround. Thanks Darrell!