This page has detailed information on building
Chromium on Windows, including tips for troubleshooting and for
speeding up the build.
Build environment
Prerequisite software
Additional (free) downloads
- If you use Microsoft Visual Studio 2005, install Microsoft Visual Studio 2005 Team Suite Service Pack 1.
- Install KB935225, KB947315, KB949009, KB946310, and KB971090.
- If you're running Vista, you need to install Service Pack 1 Update for Windows Vista.
- If you use Microsoft Visual Studio 2008
- Install VS2008 Service Pack 1.
- Have fun installing KB967631; KB960075; KB958842; KB957912 and KB971092. Yes, that's 400 megs of updates.
- Not necessary yet: KB956420 and KB958357. Only if you enjoy downloading another 750 megs of data and wasting a few hours.
- Install the Windows 7 SDK. (v6.1 will do too)
- Read the instructions on the SDK download page! Read it Again!
- If you use VS2005, you need to read point 5.1.5 in the release notes!
- You might need to reboot. You can save space by not installing the documentation and code samples.
- If you have previously installed Windows SDK 6.0 and built Chromium, you need to follow the procedure in idanan's posting to chromium-dev.
- Integrate the SDK with Visual Studio:
- Start > All Programs > Microsoft Windows SDK > Visual Studio Registration > Windows SDK Configuration Tool.
If this program crashes, try running it from the command line with: windowssdkver -version:v7 -legacy
If build still fails, try registering the SDK manually.
- Get the Chromium depot_tools.
Chromium code
- Check out the source code using either the bootstrap tarball or a direct svn checkout.
Building Chromium
- If you are using VS2008;
- set GYP_MSVS_VERSION=2008 in your environment before generating the project files. You will have to gclient runhooks --force after this change to regenerate your sln file.
- Open the chrome/chrome.sln solution file in Visual Studio and build the solution. This can take from 10 minutes to 2 hours. More likely 1 hour.
- If you just want the Chromium browser, and none of the tests, you can speed up your build by right-clicking the chrome project in the solution explorer and selecting Build. You may want to make sure this project is the Startup project (which will display as bold) by right-clicking it and selecting Set as Startup Project. This will make Chromium (as opposed to some random test) build and run when you press F5.
Accelerating the build
In decreasing order of speedup:
- Use a true multicore processor; ie. an Intel Core Duo or later; not a Pentium 4 HT.
- Use a x64 OS otherwise incremental linking is disabled.
- Have 8 gigs of RAM.
- Use VS2008 or do this manual fix for VS2005:
- Ensure that /MP is enabled. You can do this by creating a file called include.gypi which contains the following lines:
{
'variables': {
'msvs_multi_core_compile': 1
}
}
Put this file in a folder called .gyp under your home directory. On Windows, this will be something like: C:\Documents and Settings\<username>\.gyp\include.gypi, or if you are on Vista: C:\Users\<username>\.gyp\include.gypi. Make sure you run "gclient runhooks --force" after creating this file to rebuild the project files, forcing GYP to output /MP.
- Disable your anti-virus software for .ilk, .pdb, .cc, .h files and only check for viruses on modify. Disable scanning the directory where your sources reside.
- Store and build the Chromium code on a second hard drive. It won't
really speed up the build but at least your computer will stay
responsive when you do gclient sync or a build.
- Defragment your hard drive regularly.
Optional
Rebuild / Clean
You can use Rebuild and Clean
on individual projects to rebuild them. However, because of the large
number of files generated by the build system, avoid using Rebuild All or Clean All - these do not erase everything! Instead delete the entire output directory (chrome\Debug or chrome\Release).
Build Chromium with JavaScriptCore
Build with javascriptcore (JSC/KJS) is not maintained and not supported anymore.
Build Chromium with Command Line
You would need to have Visual Studio installed, but not running. Navigate to source directory (src/chrome) and type the following command:
C:\trunk\src\chrome> devenv /build Debug chrome.sln /project chrome.vcproj
Note
for Windows Vista: the devenv command may silently fail if Visual
Studio has been configured to always run as Administrator. You can
check or disable this by right clicking the Visual Studio application
icon, then select Properties -> Compatibility -> Run this program
as administrator.
Official/WPO/LTCG build
To enable whole program optimization / link-time code generation, make sure to set the environment variable:
- set CHROME_BUILD_TYPE=_official
- cd src\chrome
- chrome.sln
The dirty trick is defined in release.vsprops.
Other tricks
Running Chromium
The chrome.exe executable can be found at chrome/Debug/chrome.exe or chrome/Release/chrome.exe, depending on the selected build configuration.
Because of Chromium's unique architecture, there are a number of special challenges associated with development. See Debugging Chromium for more information.
Once you're comfortable with building Chromium, read the Contributing Code page for information about writing code for Chromium and contributing it.
Packaging
If you want to package your build into a zip file, do the following:
cd /path/to/chrome
./tools/build/win/make_zip.sh Release my-chromium
This will create my-chromium.zip. You can change Release to Debug if you want to zip up the debug build instead.
Troubleshooting
Build failures on Vista
If you build on Vista, watch out for security issues. Make sure that the folder where you checked out your files is writable for users and not only for admins.
Compilation failures
Some common things to think about when you have weird compilation failures:
- Make sure you have SP1 for Visual Studio 2005. It's required. Really.
- Sometimes
Visual Studio does the wrong thing when building Chromium and gets
stuck on a bogus error. A good indication of this is if it is only
failing for one person but others (including the Buildbots) are not
complaining. To resolve this, try the following steps:
- Close Visual Studio.
- Sync to the tip of tree and ensure there are no conflicts ("svn status" should not show any "C"s in front of files that you've changed).
- If there were conflicts, sync again after resolving them.
- Manually erase the output directory (chrome\Debug and chrome\Release. Using the command line, you can use "erase /S /Q Debug Release" from the chrome directory to do this, or "rm -rf Debug Release" if you have Unix-like tools installed.
- Restart Visual Studio and open the Chromium solution.
- Rebuild the solution.
If it still doesn't work, repeating this process probably won't help.
Cygwin access control issues
If, while building JavaScriptCore, you see errors like:
3>Error in tempfile() using /tmp/dftables-XXXXXXXX.in: Parent directory (/tmp/) is not writable
3> at /cygdrive/c/b/slave/WEBKIT~1/build/webkit/third_party/JavaScriptCore/pcre/dftables line 236
3>make: *** [chartables.c] Error 255
...it's because the Cygwin installation included in the Chromium
source is having trouble mapping the NT ACL to POSIX permissions. This
seems to happen when Chromium is checked out into a directory for which
Cygwin can't figure out the permissions in the first place, possibly
when the directory is created from within a Cygwin environment before
running mkpasswd. Cygwin then imposes its own access control, which is incorrectly restrictive. As a workaround, do one of the following:
- Edit the NT permissions on third_party\cygwin\tmp to allow Modify and Write actions for Everyone and machine\Users. Cygwin is able to figure this out. Or,
- Figure out what went wrong with your checkout and try again - try doing the checkout from cmd instead of from a Cygwin shell, then verify that the permissions aren't completely blank in your Cygwin installation. Or,
- Bypass Cygwin's access control (NT's will still be in effect) by editing webkit\build\JavaScriptCore\prebuild.bat and webkit\build\WebCore\prebuild.bat to include the following line before invoking anything that uses Cygwin:
set CYGWIN=nontsec
Only one of these solutions should be needed.
Execution error messages
" This application has failed to start because the application configuration is incorrect "
or
" The system cannot execute the specified program "
Read the manual! Install Microsoft Visual Studio 2005 Service Pack 1 (download).
Manually registering the Platform SDK
If
you get errors like this: " C:\Program Files\Microsoft
SDKs\Windows\v6.1\Include\unknwn.idl(108) : error MIDL2025 : syntax
error : expecting ] or , near "annotation" "
Read the manual! The Platform SDK is incorrectly registered. You
probably had installed the SDK prior to VS2005. Open Visual Studio
2005, Tools > Options... > Projects and Solutions > VC++ Directories (Assuming your base SDK directory is C:\Program Files\Microsoft SDKs\Windows\v7.0)
- In Executable Files, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\bin
- In Include Files, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\Include and C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl
- In Library Files, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\lib
- In Exclude directories, insert on top C:\Program Files\Microsoft SDKs\Windows\v7.0\Include and C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl
|