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.
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. Make sure it’s version 2.x instead of 3.x. 64-bit is fine. http://www.activestate.com/activepython/downloads Make sure you don’t download it from python.org because we hardcode the executable name as “python2.7” and the python.org python doesn’t include an executable with that name.
- Ruby. 64-bit is fine. http://rubyinstaller.org/
- Bison. http://gnuwin32.sourceforge.net/packages/bison.htm Make sure that the installation path does not have spaces in it, because Bison does not correctly quote paths when passing them to m4.
- Gperf. http://gnuwin32.sourceforge.net/packages/gperf.htm
- Flex. http://gnuwin32.sourceforge.net/packages/flex.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: If you intend to interact with Subversion patches) Subversion. http://sourceforge.net/projects/win32svn/
- (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.
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
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).
You can build with either Visual Studio 2015 or Visual Studio 2015 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.
If you are behind a proxy you need to do the following to allow cygwin svn to get through the proxy (similar steps are available for your Windows svn):
- In bash (Cygwin) run:
svn help. This will create in your cygwin home directory the file
- Edit the file mentioned above and follow the instructions in the file to set up your proxy settings.
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.
- Open a Cygwin Shell Double-click the Cygwin icon on your Desktop to launch a new shell.
- You can download a snapshot of the WebKit source tree. It is updated daily.
Type these commands to check out the WebKit source tree:
tar jxvf WebKit-SVN-source.tar.bz2 cd webkit
Note the archived checkout uses an HTTP connection. We recommend running the following command to use HTTPS instead:
svn switch --relocate http://svn.webkit.org/repository/webkit/trunk https://svn.webkit.org/repository/webkit/trunk
Alternatively, type this command to check out the WebKit source tree:
svn checkout https://svn.webkit.org/repository/webkit/trunk 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.
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.