WebKit on Windows
This guide provides instructions for building WebKit on Windows 8.1 without Cygwin (the AppleWin port of WebKit). You can optionally install Cygwin in order to run tests.
Installing Development Tools
Begin by installing the following programs and setting up your environment:
- Visual Studio. (Make sure you include C++ support.) https://www.visualstudio.com/en-us/products/visual-studio-community-vs
- ActiveState Perl. 64-bit is fine. http://www.activestate.com/activeperl/downloads
- ActiveState Python 3.x. 64-bit is fine. http://www.activestate.com/activepython/downloads. Some have suggested better success downloading Python 3.x from https://www.python.org/downloads/windows/
- Ruby. 64-bit is fine. http://rubyinstaller.org/
- Gperf. http://gnuwin32.sourceforge.net/packages/gperf.htm
- CMake. https://cmake.org/download/
- Git. http://www.git-scm.com/download/win Note: Make sure you select the option “Use Git from the Windows Command Prompt.” This is because it installs a sh.exe in your path, and if the location of that sh.exe has spaces in it, Make gets confused. When I installed this, I unchecked all the options.
- iTunes. This is only needed for the AppleWin port, not for the WinCairo port. http://www.apple.com/itunes/download/ This is needed because it includes the .dlls which implement Apple frameworks like CoreGraphics, CoreAnimation, etc.
- The “Ahem” font, used for testing. http://www.w3.org/Style/CSS/Test/Fonts/Ahem/
- (Optional: To speed up the build process) Ninja Build. https://github.com/ninja-build/ninja/releases
Make sure all the programs you just installed (except Visual Studio and iTunes) are accessible through your
$PATH http://www.itechtics.com/customize-windows-environment-variables/ You may be required to reboot after modifying
$PATH before new shells will see the updated variable.
If you are behind a proxy, be sure to set the
HTTPS_PROXY environment variables.
Setup the Git Repository
Tell git your name.
> git config --global user.name "John Smith"
Tell git your email address.
> git config --global user.email "firstname.lastname@example.org"
Download a clone of the repository.
> git clone <git://git.webkit.org/WebKit.git> > cd WebKit
(Optional: If you intend to interact with Subversion patches)
Automatically configure the local clone to follow Subversion:
> python Tools\Scripts\webkit-patch setup-git-clone
Setup Support Tools
Download the WebKit Support Libraries to the root of your source tree https://developer.apple.com/opensource/internet/webkit_sptlib_agree.html If the file is incorrectly named, rename it to WebKitSupportLibrary.zip. Do not extract its contents. This archive includes an SDK (headers only) for the Windows builds of the Apple stack of software (like CoreGraphics, for example).
In addition, you will need to download https://developer.apple.com/opensource/internet/WebKitAuxiliaryLibrary.zip
> cd Tools\Scripts > perl update-webkit
If the above command asks you to reboot your machine, do so.
Note that this command will automatically download WebKitAuxiliaryLibrary.zip from Apple and extract it into your tree (inside the WebKitLibraries folder). This archive includes Windows builds of all the public libraries that WebKit depends on (like libxml2). Note also that this command might set environment variables.
> perl build-webkit
Note that this command will automatically extract WebKitSupportLibrary.zip (which you downloaded in step 6) into your tree (inside the WebKitLibraries folder).
Install Cygwin (optional)
You can build with either Visual Studio 2019 or Visual Studio 2019 Community Edition.
Use the default options for the installation.
Cygwin is a collection of utilities for Windows that includes not only a Subversion client, but also additional tools that are required to build the
WebKit source. We have made a downloader available that automatically collects all of the required packages.
Download cygwin-downloader.zip. Extract the content of the archive to some folder and start
cygwin-downloader.exe from that folder. This will download all the Cygwin packages you need. When all the packages have finished downloading, the Cygwin installer will launch. Choose Install from Local Directory, then click Next until the install is complete. If you are running Vista, the installer won’t be able to launch automatically, so you will have to manually launch Cygwin’s
HTTP_PROXYenvironment variable to the URL of the proxy. This would likely match this pattern:
http[s]://[username[:password]@]somehost.com[:port]. The square brackets (
[…]) are not part of the URL, but are used to indicate optional elements of the URL.
fork(the POSIX function frequently used to start child processes, needed by many of the WebKit build tools). In order to enable
cygwin1.dllto implement fork successfully it is better if no DLL loaded in the parent process is relocated at runtime. One way to achive this is to rebase all cygwin dlls except
cygwin1.dllto base addresses that cause them to not overlap in memory.
In order to rebase all cygwin dlls a
rebaseall script is provided in the cygwin installation’s
bin directory (usually
C:\cygwin\bin). This script must be run from
ash.exe (found in the same directory) while no other cygwin application is running.
ash.exe has very limited command line editing features so cutting and pasting to the commandline is recommended.
PATH environment variable may not contain the
/bin directory by default thus the script should be launched as
rebaseall is complaining about failure to write to a Windows Temp directory (i.e.
/cygdrive/c/Users/you/AppData/Local/Temp), fix the permissions on that folder (i.e.
/bin/chown you /cygdrive/c/Users/you/AppData/Local/Temp) or change the TMP environment variable to point to a directory with the appropriate permission flags
export TMP=/tmp). Note: The rebase process may need to be repeated to include any new libraries added later to cygwin by listing these libraries by full cygwin path in a file and passing the file to
rebaseall via the
-T fileName commandline argument. The dlls under
LayoutTests/http/conf are a relevant use case.
Remove the following lines from
/home/[username]/.bashrc (if present):
unset TMP unset TEMP
Those lines would prevent picking up the Windows TMP and TEMP environment variables.
Download Perl 5.18 (or newer) from activestate.com and install it.
Download Python 2.7.8 from activestate.com and install it.
Download Ruby 2.0.0 from rubyinstaller.org and install it.
Install php, we use the following steps (you need this to run http layout tests):
chmod a+x apt-cya
4. Change line 341 of the
apt-cya script to
wget -nc $mirror/../$install
apt-cyg -m ftp://sourceware.org/pub/cygwinports/x86 install php
Optional: Hotfix for 64-bit Windows (Windows 7 or earlier) to disable the user-mode callback filter for exceptions
Without the 976038 hotfix, exceptions may be thrown in callback routines that do not cause a crash but leave the application in an inconsistent state that might cause a crash later. You will need to click on “View and request hotfix downloads” and fill out the form. A link to download the hotfix and a password will be emailed to you.
Getting the Code for Cygwin
Run this command:
git clone https://github.com/WebKit/WebKit.git WebKit
- Install the WebKit Support Libraries
Download the WebKit Support Libraries to the root of your source tree (
If the file is incorrectly named, rename it to
WebKitSupportLibrary.zip. Do not extract its contents.
./Tools/Scripts/update-webkitscript to update your source tree.
If you downloaded the tarball, this will bring it up to date. Windows users must always execute this command after first obtaining the code, since it will download additional libraries that are needed to build.
Once you have a current tree, the next step is building WebKit.
Getting a Crash Log
Windows Error Reporting (WER) has been integrated into the operating system. By default, Windows uploads the crash logs to Microsoft, but does not save a local copy. This is configurable via the registry.
- Save the following text to a file named
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting] "ForceQueue"=dword:00000001
- Double-click the file from Windows Explorer and respond affirmatively to any prompts.
The next time Safari (or any other application) crashes, the crash information will be written into a folder located inside
%LOCALAPPDATA%\Microsoft\Windows\WER\ReportQueue. Check the modification date to make sure you are using the correct file. Be sure to include the following files in your bug report:
- This is the most important file. It contains the crash dump that can be opened inside Visual Studio or other Windows debuggers.
- Contains the operating system version and other hardware information.
- Lists all of the DLLs loaded at the time of the crash with their version information.