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.

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).

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.

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.