Enabling OpenSSL for Qt C++ on Windows

By default, Nokia Qt does not ship its Qt C++ framework with OpenSSL enabled. This degrades value of the framework and you won’t be able to access HTTPS pages or SSL enabled web services. The examples that require SSL won’t work as well. Take examples\webkit\googlechat for example. This post gives an approach to enable OpenSSL for Qt C++ framework on Windows.

Make sure you have readandbefore proceeding.

  1. Open CMD console & go to the directory C:\Qt\2010.02.1\qt\src\network (given that you have Qt 4.6.2. installed using standard options offered by the installer)
  2. Make sure the directories C:\Qt\2010.02.1\qt\bin and C:\Qt\2010.02.1\mingw\bin are in the environment variable PATH. If you are unsure, enter this command:

set PATH=%PATH%;C:\Qt\2010.02.1\mingw\bin;C:\Qt\2010.02.1\qt\bin;

  1. Configure QtNetwork build using this one-liner:

qmake "PWD=C:\Qt\2010.02.1\qt\src\network" "QMAKE_LIBS_NETWORK = -lws2_32 -lcrypto -leay32 -lssl32 -lssl -lgdi32" "DEFINES += QT_LINKED_OPENSSL" "DEFINES -= QT_NO_SSL"

It’s your responsibility to ensure that OpenSSL is installed and visible to MinGW.

  1. Go ahead with building with this single command:

mingw32-make

Wait for 5-10 mins and you have QtNetwork with OpenSSL enabled. Enjoy!

Installing Qt, QtCreator and MinGW for Windows

Ever thought of developing simple & nice cross-platform applications without sweating? Nokia Qt C++ frameworks empowers you to do so. To get started, first install the Qt SDK with IDE and of course famous GNU compiler chain GCC, branded under MinGW for Windows.

Get the framework, IDE & tool chain from: http://qt.nokia.com/downloads/sdk-windows-cpp

If you are interested in particular parts of MinGW, look here: http://sourceforge.net/projects/mingw/files/

Just follow default steps and you are safe. If you are interested in free M$ C/C++ compiler, just download the Qt source and build it yourself.

Now you are ready to play with magic. To appreciate Qt, run QtDemo and also watch some clips & read some stuff:

http://labs.trolltech.com/blogs/author/qtdeclarative/

Building OpenSSL with MinGW on Windows

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.

  1. If you yet to have MinGW, read to learn how to install it.
  2. 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
  3. Run the MSI installer and point path to C:\develop\tools\perl . You may choose different path, but that’s what on my machine.
  4. 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.
  5. Extract openssl to C:\develop\tools\ and you will obtain directory C:\develop\tools\openssl-0.9.8n . Get inside it.
  6. 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

to

/* static type _hide_##name */ type _hide_##name

  1. Now let’s build shared & static versions of OpenSSL with a single command (you are now inside C:\develop\tools\openssl-0.9.8n):

ms\mingw32.bat shared

Navigate to YouTube and have some snack. It may take 15-20 mins to finish building.

  1. 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!

References:

[1]

NTFS for Mac made easy

There are only 2 steps to enabled write option to NTFS partitions on Mac.

1. Install MacFUSE: http://code.google.com/p/macfuse/

2. Install NTFS-3G: http://macntfs-3g.blogspot.com/ , http://sourceforge.net/projects/catacombae/files/

You will be required to reboot and upon next start-up, you can write to NTFS partitions with ease. Successful installation will similar screenshot (MacFUSE & NTFS-3G at the bottom):

Successful installation of MacFUSE and NTFS-3G
Successful installation of MacFUSE and NTFS-3G