wiki:BuildingQtOnWindows

Version 30 (modified by Laszlo Gombos, 14 years ago) ( diff )

few words on how to generate MSVC project files

Build Instructions for the QtWebKit build on Windows

Dependencies

Please install these tools in a path without spaces (i.e. not in "C:\Program Files")

Make sure the GnuWin32 packages are in your PATH as well as Perl and Python. You also need to have %QTDIR% set and have %QTDIR%\bin in your PATH.
If you have Cygwin's bin directory in your path, make sure that it comes after ActiveState Perl and GnuWin32. You might have to remove it completely from your PATH if you have problems with slashes and backslashes while building using MinGW. mingw32-make and GnuWin32's make will use sh.exe to run commands if they find it in the PATH.

Building QtWebKit

  • Open for example a Qt Command Prompt from the Start Menu.
    You need an MSVC or MinGW command line environment that matches the version of Qt you downloaded.
    Note that building inside Cygwin or MSYS is currently not supported. Please use a Windows command prompt.
  • Change into the WebKit source tree
  • Run perl WebKitTools\Scripts\build-webkit --qt --release
  • Wait :)
  • Try to run WebKitBuild\Release\bin\QtLauncher.exe

Notes about building QtWebKit with the Qt/Windows OpenSource Edition

  • If you want to compile using multiple cores:
    • On MinGW you can try set MAKE_COMMAND=mingw32-make -j%NUMBER_OF_PROCESSORS%.
      If this do not work you might have to Ctrl-C build-webkit's execution, go in the WebKitBuild\Release\ directory and run:
      mingw32-make -C JavaScriptCore -f Makefile.Release -j%NUMBER_OF_PROCESSORS% && mingw32-make -C WebCore -f Makefile.Release -j%NUMBER_OF_PROCESSORS% && mingw32-make
      
    • On MSVC use the CL environment variable along with the /MP switch:
      set CL= /MP
      
  • If you can't access HTTPS pages and you compiled Qt from sources, make sure that you configured it with OpenSSL support. You will need the non-light version of Win32 OpenSSL libraries.
  • 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).
  • If you want to generate MSVC project files (e.g. so that you can debug/work from within MSVC) you can do it with the following steps
    • Run perl WebKitTools\Scripts\build-webkit --qt and cancel the script after the derived sources are all generated
    • Run perl WebKitTools\Scripts\build-webkit --qt --qmakeargs "-tp vc". This will generate MSVC project files and than it will fail
    • Open WebKit.sln from MSVC and build from MSVC. Build should succeed and you should be able to debug and work from within MSVC.

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

  1. The the mentioned GnuWin32 tools
  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:\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, you can shorten it using the build-webkit's --no-svg or --minimal flags:
        $perl WebKitTools\Scripts\build-webkit --qt --release --no-svg
        $perl WebKitTools\Scripts\build-webkit --qt --release --minimal
    
Note: See TracWiki for help on using the wiki.