wiki:BuildingQtOnWindows

Version 22 (modified by dbates@webkit.org, 10 years ago) (diff)

Replaced outdated Trolltech website link to Qt download with Nokia link

Build Instructions for the QtWebKit build on Windows

Dependencies

First of all you need a version of Qt for Windows. If you are an Open Source developer then you can download the Open Source Edition of Qt for Windows from the Nokia Website: http://qt.nokia.com/downloads

The following external GNU tools are needed from the GnuWin32 Project:

  • Make
  • Bison
  • Gperf
  • Flex
  • LibIconv (needed for bison)

In addition you need Perl. ActiveState Perl works fine for example. You can download it from the ActivePerl Website.

Make sure the GnuWin32 packages are in your PATH as well as Perl. You also need to have %QTDIR% set and have %QTDIR%\bin in your PATH.

Please note that building inside Cygwin is currently not supported.

Building QtWebKit

  • Open for example a Qt Command Prompt from the Start Menu
  • Change into the WebKit source tree
  • Run perl WebKitTools\Scripts\build-webkit --qt
  • Wait :)
  • build-webkit is likely to abort with an error when compiling testkjs if you're compiling with MingW g++. This is safe to ignore for now.
  • Try to run WebKitBuild\Release\bin\QtLauncher.exe

Notes about building QtWebKit with the Qt/Windows OpenSource Edition

  • Make sure that you are using Qt >= 4.3.2. Otherwise you may run into build problems with the Moc at the very end of the build process.
  • If you haven't set up your PATH already to include the GnuWin32 packages then you may want to execute the following command: set PATH=C:\GnuWin32\bin;C:\Perl\bin;%PATH% Provided that the GnuWin32 packages are installed in C:\GnuWin32\bin and Perl in C:\Perl\bin.
  • If you get build errors in JavaScriptCore\bindings\NP_jsobject.cpp or similar then please make sure that the Microsoft Platform SDK is NOT in your %INCLUDE% path because it conflicts with your MingW headers.
  • If you get build errors after makefile generation ("Makefile:178: * Multiple target patterns. Stop.") then you're probably still using the Cygwin version of make. Try removing Cygwin from your %PATH% for the time being (it's not currently supported, as mentioned above).
  • I had troubles with m4 when the GnuWin32 packages were installed in C:\Program Files\GnuWin32 (something choked on the whitespace), it worked when installing them into C:\GnuWin32 instead.
  • When I try to build using Qt 4.4.3 on windows, the above procedure throws error. all the build (perl) scripts are using unix style dir-paths. Example buildQMakeProject perl method in webkitdirs.pm uses unix style dir-path and also reading pro file. I am amazing that the people could build Qt port of Webkit on Windows.

Please Let me know exact steps / modification required to build the Webkit in Qt command prompt.

A 'Works For Me' Step-by-Step Guide to Building QtWebKit on Windows

  1. The following external GNU tools are needed from the GnuWin32 Project:
    • Download Bison
    • Download GPerf
    • Download Flex
    • LibIconv
    • Make
    • It is safer to install the gnuwin32 tools to C:\GnuWin32 rather than C:\Program Files\GnuWin32. This is because, depending on your luck with the webkit build, the space in Program Files can prevent the windows shell from locating the binaries correctly. The error message below is what you will see if you get this problem.
      make[2]: Entering directory `C:/Users/robert/Development/webkit/WebKitBuild/Release/WebCore'
      bison -d -p jscyy ..\..\..\JavaScriptCore\parser\Grammar.y -o Grammar.tab.c && move Grammar.tab.c tmp\Grammar.cpp && move Grammar.tab.h tmp/Grammar.h
      m4: cannot open `Files\GnuWin32/share/bison': No such file or directory
      m4: cannot open `C:\Program': No such file or directory
      m4: cannot open `Files\GnuWin32/share/bison/m4sugar/m4sugar.m4': No such file or directory
      bison: I/O error
      
  2. Download QT SDK (and QT Creator) and Download ActivePerl
  3. Open for example a Qt Command Prompt from the Start Menu. Click Start->Program Files->Qt->QT Command Prompt. In fact, you really do need to use Qt Command Prompt for this rather than the normal windows command prompt.
  4. Make sure the GnuWin32 packages are in your PATH as well as Perl (set PATH=C:\program files\gnuwin32\bin;C:\Perl\site\bin;%PATH%.
  5. You also need to have %QTDIR% set and have %QTDIR%\bin in your PATH.
  6. Trim your PATH down as much as possible. Remove Git and Mingw from your PATH if you have them installed, their presence can cause odd build failures. For example, the PATH that works for me is:
     set Path=C:\Program Files\GnuWin32\bin;c:\GnuWin32\bin;c:\Qt\2009.01\qt\bin;c:\Qt\2009.01\bin;C:\Perl\bin;C:\Windows\system32;c:\Qt\2009.01\mingw\bin;C:\Perl\site\bin;C:\Windows;C\\Program Files\SlikSvn\bin\
    
    • Note that c:\Qt\2009.01\qt above will vary depending on the QT SDK that you downloaded. You should modify it appropriately.
  7. Download WebKit from svn (make sure you've left the location of your svn client in your %PATH% above):
    $ svn checkout http://svn.webkit.org/repository/webkit/trunk %HOME%\WebKit
    $ cd %HOME%/WebKit
    
  8. Change into the WebKit source tree: cd c:\location\of\webkit
  9. For some reason, the build command was unable to create the WebKitBuild\Release folders by itself on my PC. I had to do mkdir WebKitBuild and mkdir WebKitBuild\Release before building.
  10. You may need to do a mkdir c:\tmp. The WebKit build relies on the existence of c:\tmp when building in Windows.
  11. Build the patched webkit (release mode): $perl WebKitTools\Scripts\build-webkit --qt --release
  12. The webkit build takes forever, so if you have more than one CPU on your machine you should use --makeargs=j4 (for 4 CPUs). This will speed up the build no end. Other recommendations are --no-svg. There is even a --minimal flag available in recent webkit versions:
        $perl WebKitTools\Scripts\build-webkit --qt --release --makeargs=j4
        $perl WebKitTools\Scripts\build-webkit --qt --release --no-svg
        $perl WebKitTools\Scripts\build-webkit --qt --release --minimal