Building WebKit on Windows

First, ensure that you have installed the necessary developer toolchain for Windows and have downloaded necessary support libraries and WebKit source code.

It is safest to build WebKit in your Cygwin home directory. At the moment, there seems to be an implicit assumption in the build scripts that paths will be relative to the home directory.

Building from within Visual Studio

WebKit can be built from within Visual Studio by setting two environment variables:

  • WEBKIT_OUTPUTDIR – An absolute Windows-style path pointing to the directory where you want the build products to go.
  • WEBKIT_LIBRARIES – An absolute Windows-style path pointing to the WebKitLibraries/win folder in your WebKit checkout.

These environment variables should be set for you the first time you run update-webkit.

Common Build Errors

Missing Autogenerated Files

If the WebKit solution is open in Visual Studio when you perform an update-webkit, you can sometimes run into a strange problem where Visual Studio is unable to locate the autogenerated files. These files are usually things like HTMLNames.cpp, which are generated by Perl as part of the WebCoreGenerated target.

The best way to resolve this is to exit from the IDE, then relaunch. This usually fixes the problem, though you may wish to clean and rebuild the JavaScriptCoreGenerated and WebCoreGenerated projects.

Bad line endings

When you see errors in WebCore/css/makeprops or WebCore/css/maketokenizer, open those files in a suitable editor (SciTE works) and convert the line endings to LF only (Unix-style). You can also use the dos2unix command from the Cygwin command line. Then restart the build.

Visual C++ Express Edition

Can't find various DLL's and EXE's.

This is likely due to an issue with your PATH variable. Make sure you have C:\Program Files (x86)\Common Files\Apple\Apple Application Support and C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin in your PATH.
If you’re missing C:\Program Files (x86)\Common Files\Apple\Apple Application Support, then you haven’t installed ”’Apple Application Support”’ which comes with installing either Quicktime or iTunes.

WebKit_Libraries

If you see errors opening the WebKit solution in Visual Studio/Visual C++ Express that say:

"$(WebKit_Libraries)/tools/vsprops/common.props could not be found or failed to load"

(or some other .props file), you must set the WebKit_Libraries environment variable. Make sure that WebKit_Libraries points to the WebKitLibraries/win directory, not the WebKitLibraries/ directory.

Missing packages in Cygwin

You may have had cygwin already installed before attempting to build WebKit. In this case, you should have checked your cygwin setup to make sure that you have at least the following packages installed: bison, gawk, flex, gperf, perl, zlib. The error reports you get when you miss one such package are particularly cryptic and may not lead you to those packages.

If you’d rather reconcile each package and version manually, rather than use the cygwin installer, you may find the list of packages included in the cygwin installer useful.

Running the Layout Tests on Windows

Running WebKit’s test suite without failures requires additional dependencies beyond those needed to compile and run a minimal configuration of WebKit.

Audio-related failures

Audio and video tests require QuickTime.

Font-metric-related failures

Running layout-test on Windows requires a set of fonts not normally bundled with Windows. The full list of
required fonts can be found here:

https://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp#L319

Most of these fonts come from OS X, so they can’t be freely redistributed as one font-package for testing-purposes.

They can however be copied from your Mac (if you have one), but they have to be converted into a TrueType format Windows understands.

Look in /System/Library/Fonts and /Library/Fonts on OS X for the source files.

The rest of the fonts can be found here:

https://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/fonts

The easiest approach is to convert all these fonts to Windows-style TrueType fonts and put them in a single folder. Then point the WEBKIT_TESTFONTS environment variable to that directory when running run-webkit-tests.

Problems with Python auto-update

You may encounter errors when the build environment attempts to install Python modules when running Cygwin in a Windows host OS inside a VMWare instance. The errors will look like the following:

webkitpy.common.system.autoinstall: INFO Auto-installing package: eliza.py
webkitpy.common.system.autoinstall: INFO From: "http://www.adambarth.com
/webkit/eliza"
webkitpy.common.system.autoinstall: INFO To: "/cygdrive/e/Projects/Web
Kit/Tools/Scripts/webkitpy/thirdparty/autoinstalled/eliza.py"
Traceback (most recent call last):
File "/cygdrive/e/Projects/WebKit/Tools/Scripts/test-webkitpy", line 266, in <
module>
Tester().run_tests(sys.argv, external_package_paths)
File "/cygdrive/e/Projects/WebKit/Tools/Scripts/webkitpy/test/main.py", line 1

This seems to happen when running VMWare in NAT networking mode. If you switch to Bridged networking, everything should work properly.

Running WebKit.dll-derived Apps on Windows

In order for your application to properly derive MIME types for local files (i.e. when you supply a “file:” URL), be sure that there is a \CFNetwork.resources directory in the same directory as CoreFoundation.dll. CFNetwork.resources must contain a file, types.plist, an XML parameter list that describes the mapping of file extensions to MIME types. You’ll also need Info.plist from this directory, but you won’t need the *.lproj subdirectories. You can find the aforementioned directory and files in the same place as you found CoreFoundation.dll in the first place. Typically, a Safari installation will install it at

C:\Program Files\Common Files\Apple\Apple Application Support\CFNetwork.resources