It is using skia for the graphics backend, libcurl for the network backend. It supports only 64 bit Windows.
Ensure that you are NOT cloning under an ancestor directory that is a git repository. This may confuse the build-webkit script and result in failure.
A shallow clone of the WebKit repository at a detached hash may work if you are just building and not intending to develop WebKit. Official Apple release tags are unlikely to work.
You may need to enable Windows long paths to fully clone the repo sucessfully.
Windows Git enables autocrlf by default, but some layout tests files have to be checked out as LF line end style. See Bug 240158.
git config --global core.autocrlf input
Install VS 2022 and it's "Desktop development with C++" workload. Ensure that "VCPKG" has been enabled for the workload.
If you have enabled "C++ Clang Tools for Windows" for the workload, it's LLVM will take precedence and the build may fail.
For this scenario, explicitilty provide the full path to an alternative Windows native LLVM's clang-cl.exe in the "Webkit command prompt" script described below.
The build-webkit script creates a symlink to a generated compile_commands.json,
so activate Windows developer mode to allow for scripted symlinks.
Install Windows native Perl, Python, Ruby, gperf (GnuWin32 Gperf), LLVM, and Ninja.
Notes:
- Python 3.12+ potentially has a problem for WebKit in some contexts. Use Python 3.11.x if you experience issues.
- Downstream
vcpkgWoff2 has problems compiling with CMake 4+. We thus use CMake 3.x that is bundled in the VS 2022 "Desktop development with C++" workload.
Notes:
- ActivePerl chocolatey package has a problem and no package maintainer at the time of writing.
- XAMPP includes Perl, and running layout tests needs XAMPP. Install XAMPP instead.
You can use Chocolatey from an elevated prompt to install the tools.
choco install -y xampp-81 python ruby git gperf llvm ninja
From an elevated prompt, install the pywin32 Python module if you intend to use the run-webkit-tests and git-webkit scripts.
python -m pip install pywin32
If you prefer WinGet to Chocolatey, invoke the following command in an elevated PowerShell or cmd prompt:
winget install --scope=machine --id Git.Git Ninja-build.Ninja Python.Python.3.11 RubyInstallerTeam.Ruby.3.2 ApacheFriends.Xampp.8.2 LLVM.LLVM
winget install --id GnuWin32.Gperf
If --scope=machine isn't specified, Python is installed under your user profile directory.
WinGet may not append the path into your PC. If some errors occered, please check your path settings, including LLVM and GnuWin32(Gperf).
To compile, run programs and run tests, you need to set some environment variables. For ease of development, it's recommended to create a batch file to set environment variables and open PowerShell:
- Create a
.batfile with the following content while adjusting it for your PC, - put it in the top WebKit source directory,
- double-click it to open PowerShell.
We call this opened shell "WebKit command prompt" hereafter.
@echo off
cd %~dp0
path C:\xampp\apache\bin;%path%
path C:\xampp\perl\bin;%path%
path %ProgramFiles(x86)%\Microsoft Visual Studio\Installer;%path%
for /F "usebackq delims=" %%I in (`vswhere.exe -latest -property installationPath`) do set VSPATH=%%I
rem Set these for older versions that do not use VCPKG for library building
rem set WEBKIT_LIBRARIES=%~dp0WebKitLibraries\win
rem path %~dp0WebKitLibraries\win\bin;%path%
set WEBKIT_TESTFONTS=%~dp0Tools\WebKitTestRunner\fonts
set DUMPRENDERTREE_TEMP=%TEMP%
set CC=clang-cl
set CXX=clang-cl
rem Set full paths if you have "C++ Clang Tools for Windows" enabled in workload.
rem set CC=path-to-native-LLVM\clang-cl.exe
rem set CXX=path-to-native-LLVM\clang-cl.exe
rem set http_proxy=http://your-proxy:8080
rem set https_proxy=%http_proxy%
rem You can pass necessary JSC options;
rem https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/runtime/OptionsList.h#L83-L607
rem set JSC_dumpOptions=1
rem set JSC_useJIT=0
rem set JSC_useDFGJIT=0
rem set JSC_useRegExpJIT=0
rem set JSC_useDOMJIT=0
rem You can show check TextureMapper FPS via WEBKIT_SHOW_FPS.
rem set WEBKIT_SHOW_FPS=1
rem You can use ccache with pre-compiled headers @see https://ccache.dev/manual/latest.html#_precompiled_headers
rem set CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime,include_file_ctime
rem Set the VC environment variables
call "%VSPATH%\VC\Auxiliary\Build\vcvars64.bat"
rem Set PATH to use the VS toolchain bundled CMake 3.x. This ensures that downstream vcpkg builds will succeed.
path %DevEnvDir%CommonExtensions\\Microsoft\\CMake\\CMake\\bin;%path%
cd %~dp0
start powershellYou can replace powershell with cmd or wt (Windows Terminal) if you like.
In the WebKit command prompt, invoke build-webkit to start building:
perl Tools/Scripts/build-webkit --release
Recent WebKit versions will use VCPKG to build the required libraries.
Older versions will automatically download required libraries from WebKitRequirements when you perform a build-webkit.
It checks the latest WebKitRequirements every time, so it is recommended to use --skip-library-update for incremental builds to speed up the next time.
python Tools\Scripts\update-webkit-win-libs.py
perl Tools\Scripts\build-webkit --release --skip-library-update
The build succeeded if you got WebKit is now built message. Run your MiniBrowser.
WebKitBuild/Release/bin64/MiniBrowser.exe
You can run programs under a debugger with [this instruction](../Build & Debug/DebuggingWithVS.md).
You can use CMake Visual Studio generator instead of Ninja generator. Install the LLVM extension of MSBuild. It bundles a Clang compiler. But, if the bundled compiler is too old, you might need to set a custom LLVM location and toolset. Instead of creating a Directory.build.props file, you can set LLVMInstallDir and LLVMToolsVersion environment variables.
In the WebKit command prompt,
perl Tools/Scripts/build-webkit --release --no-ninja --generate-project-only
Open the generated solution file by invoking devenv command from a WebKit command prompt.
devenv WebKitBuild\Release\WebKit.sln
Build "MiniBrowser" project.
WebKit test runner run-webkit-tests is using a command line debugger NTSD to get crash logs. However, Windows SDK installer doesn't install it by default.
- Right-click the Windows start menu
- Select "Apps and Features" menu item
- Click "Windows Software Development Kit" from the apps list
- Click "Modify" button
- Select "Change" and push "Next" button
- Select "Debugging Tools for Windows" and proceed the installation
Install XAMPP as described above.
Install required Python and Ruby modules.
python -m pip install pywin32
gem install webrick
If Apache service is running, stop it.
net stop apache2.4
Some extensions need to be registered as CGI. Modify the following commands for your Perl and Python paths, and run them as administrator.
An example using Chocolatey
reg add HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command /ve /d "c:\xampp\perl\bin\perl.exe -T"
reg add HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command /ve /d "c:\xampp\perl\bin\perl.exe -T"
reg add HKEY_CLASSES_ROOT\.py\Shell\ExecCGI\Command /ve /d "c:\Python311\python.exe -X utf8"
An example using WinGet
reg add HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command /ve /d "c:\xampp\perl\bin\perl.exe -T"
reg add HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command /ve /d "c:\xampp\perl\bin\perl.exe -T"
reg add HKEY_CLASSES_ROOT\.py\Shell\ExecCGI\Command /ve /d "\`"C:\Program Files\Python311\python.exe\`" -X utf8"
You need openssl.exe in your PATH to run wpt server. XAMPP contains openssl.exe in C:\xampp\apache\bin directory. Append the directory to your PATH.
Open the WebKit command prompt as administrator because http tests need to run Apache service.
Invoke run-webkit-tests.
python Tools/Scripts/run-webkit-tests --release
If you are using Japanese Windows, some layout tests fail due to form control size differences.
GetStockObject(DEFAULT_GUI_FONT) returns MS UI Gothic on it.
Remove GUIFont.Facename of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize.
And, replace MS UI Gothic with Microsoft Sans Serif in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes\MS Shell Dlg.
Also, change system locale to English, because Python script crashes non-English system locale. See Bug 273060.
If http tests fail as flaky failures due to the socket count limit, increase the user port range. See Bug 224523
netsh int ipv4 set dynamicport tcp start=1025 num=64511
You can use Docker to run LayoutTests by mounting the host directory.
docker run -it --rm --cpu-count=8 --memory=16g -v %cd%:c:\repo -w c:\repo webkitdev/msbuild
- Go to Windows-64-bit-Release-Build Buildbot builder page.
- Click any "Build #" which is green.
- Click the "Archive" link under "compile-webkit" to download the zip
- Download the corresponding release of WebKitRequirements.
- Unpack them, copy all DLL of WebKitRequirements to the directory of MiniBrowser.exe
- Install the latest vc_redist.x64.exe of Microsoft Visual C++ Redistributable for Visual Studio