Saturday, May 18, 2013

Building Qt5 with MinGW

Building Qt with MinGW was always a nightmare: weird conflicts, a lot of patching and the result was not good.

Now with the recent release of Qt 5.0.2 things are a little better (hope they get even better with forthcoming Qt 5.1). I finally managed to build (or almost - QtWebkit fails to build, see below) it.

The steps I took are outlined below. If you want to try please let me know if they have worked for you too.

Qt building

Steps to Build

You'll need:
Steps
  • Make sure Perl, Python and MinGW are all in your PATH
  • Create a directory C:\Qt-build
  • Create a directory C:\Qt
  • Uncompress the Qt source distribution to C:\Qt-build
  • Remove directories qtwebkit and qtwebkit-examples-and-demos. For some reason they do not build
  • Create a directory C:\Qt-build\build. You will get a tree like this:
    C:\
      Qt-build
        build
        qt-everywhere-opensource-src-5.0.2
  • Open the "MinGW Command Prompt"
  • Enter cd C:\Qt-build\build
  • Enter touch ..\qt-everywhere-opensource-src-5.0.2\qtbase\.gitignore
  • Enter ..\qt-everywhere-opensource-src-5.0.2\configure -prefix C:\Qt -release -developer-build -opensource -shared -opengl desktop -qt-pcre -nomake tests
  • Enter mingw32-make
  • Enter mingw32-make install

The Qt headers and libraries will be installed in C:\Qt