In part 1, we installed the tools that are required to build from source.

This post shows how to use them to compile Qt and the PostgreSQL libraries we need.


Qt is huge and building it from scratch takes a long time, typically several hours on a current desktop machine. Using pre-compiled binaries as available on the Qt site can be preferred, although it is only since quite recently (4.5.2?) that the pre-compiled version can be used to build manitou-mail (As I mentioned in this message to qt-interest, there was a problem with the pre-compiled qmake that precluded its use with autotools scripts launched in MSYS. But this appears to have been fixed).

If however a custom compilation is chosen, here are the steps to follow:

  1. Download Qt sources into c:\qt\4.5.2 or similar
  2. Open CMD.EXE and make sure g++ is in the PATH. Add it manually if necessary.
  3. Inside c:\qt\4.5.2, run configure.exe -platform win32-g++.
  4. Run mingw32-make as told at the end of configure, and don’t expect the result before several hours :)

Beware: contrary to the Unix way of installing from source, no make install is necessary nor possible with Qt/Windows : the build must happen directly inside the destination directory.

PostgreSQL’s libpq

  1. Grab postgresql source tar archive and untar it. I’ve used version 8.4.0, the latest available at the time of this post.
  2. If /mingw/include/libz.h doesn’t exist, grab and unpack the zlib dev archive in /mingw.
  3. cd into postgresql source directory and run ./configure
  4. cd into src/interfaces/libpq
  5. run make && make install

Once this is done, the headers files to be found in /usr/local/pgsql/include and the libraries (.a and .dll) in /usr/local/pgsql/lib

Conclusion of part 2

Now that Qt and PostgreSQL are built, in the next and final part of this series we’ll compile the manitou-mail application itself for windows, with the toolchain that we installed in part 1.