Building Qt-4.8.7 and qtwebkit-2.3.4 separately with VS2012 on Windows

  • Building Qt on Windows is quite a difficult work, while the work on OS X and Ubuntu is really simple. The main problem is QtWebKit. Official release provides precompiled Qt4 SDKs for VS2010 but not VS2012; project qt64ng on also provides Qt4 SDKs for VS2012 and VS2013, but not detail building steps.

    Tutorials on internet provide some instructions on building Qt-4.8 with VS2012, but the generated QtWebKit4.dll doesn't work, encountering error StackHash_0a9e (tested on Win7 and Win10). This tutorial focus on details of building Qt-4.8.7, qtwebkit-2.3.4 and qtcreator-2.8.1.


    Install Visual Studio 2012 Express for Desktop
    Use tool 'Developer Command Prompt for VS2012' for following jobs.

    Install perl

    Build OpenSSL
    Download source code:
    Decompress to directory: C:\Users\username\Downloads\openssl-1.0.2d
    Compile and install(installing directory: C:\OpenSSL)

    cd C:\Users\username\Downloads\openssl-1.0.2d
    perl Configure VC-WIN32 no-asm --prefix=C:\OpenSSL
    nmake -f ms\ntdll.mak
    nmake -f ms\ntdll.mak install

    Append C:\OpenSSL\bin to system path

    Build Qt-4.8.7 without qtwebkit(-no-webkit)

    Change work directory to Qt source root directory, and run:
    configure -mp -prefix C:\Qt\4.8.7 -release -confirm-license -opensource -qt-zlib -qt-libjpeg -qt-libpng -qt-libmng qt-libtiff -no-qt3support -no-webkit -nomake demos -nomake examples -openssl -I C:\OpenSSL\include -L C:\OpenSSL\lib

    Compile Qt source:
    (It takes about 2hr to finish compiling.)

    Install Qt SDK:
    namke install

    Append C:/Qt/4.8.7/bin to system path

    Build QtWebKit-2.3.4

    Download source code from
    Note that the lastest WebKit source code from doesn't support .

    Install necessary tools for building qtwebkit:

    or from gnuwin32 in Qt-5.5.0 source code directory



    perl(already installed)

    Make sure binaries directories of above tools are in system path.

    sqlite source code
    Decompress it to:

    Compile qtwebkit:

    set SQLITE3SRCDIR=C:\Users\username\Downloads\sqlite3
    set QTDIR=C:\Qt\4.8.7
    perl Tools\Scripts\build-webkit --qt --release

    It takes about 4hr to finish compiling.

    Install QtWebKit:

    cd WebKitBuild/Release
    nmake install

    Test QtWebKit

    In fact,after buidling QtWebKit,a test program called QtTestBrowser.exe is located in WebKitBuild/Release/bin directory.

    Your can also build project browser in Qt source directory(say %QTSRC%/demos):

    cd %QTSRC%/demos/browser

    Building QtCreator-2.8.1 with Qt-4.8.7 and MSVC 2012

    qmake CONFIG+=release
    namke install INSTALL_ROOT=C:\Qt\qtcreator-2.8.1

    You will encouter following errors:
    _p.h(49) : fatal error C1083: Cannot open include file: 'private\qwineventnotifi
    er_p.h': No such file or directory
    Generating Code...
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 11.0\VC\BI
    N\cl.EXE"' : return code '0x2'
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 11.0\VC\BI
    N\nmake.exe"' : return code '0x2'
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    NMAKE : fatal error U1077: 'cd' : return code '0x2'
    NMAKE : fatal error U1077: 'cd' : return code '0x2'

    The reason is that some headers haven't been installed, you should copy headers in directory

    then, run nmake to continue.

    Enjoy Qt built by yourself!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should rather create a wiki article with your guide, it will be easier to find there

  • @SGaist
    I'm a newbie to this forum. Would you please give me some instructions on how to create a wiki article? Thank you!

  • Lifetime Qt Champion

    The wiki is located here and you should have everything explained there

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.