Build Instructions (Windows)
Translations of this material:
- into Russian: Инструкция по сборке браузера Google Chrome на платформе Windows . 98% translated in draft. Almost done, let's finish it!
-
Submitted for translation by guranvir 18.06.2010
Text
Contents
1 Build environment
1.1 Prerequisite software
1.1.1 Additional (free) downloads
1.1.2 Chromium code
2 Building Chromium
2.1 Accelerating the build
2.2 Optional
2.2.1 Rebuild / Clean
2.2.2 Build Chromium with JavaScriptCore
2.2.3 Build Chromium with Command Line
2.2.4 Build Chromium with Command Line
2.2.5 Official/WPO/LTCG build
2.2.6 Other tricks
3 Running Chromium
3.1 Packaging
4 Troubleshooting
4.1 Build failures on Vista
4.2 Compilation failures
4.3 Cygwin access control issues
4.4 Execution error messages
4.5 Manually registering the Platform SDK
4.6 Reinstalling Visual Studio SP1
4.7 Special Service Pack Preparation Tool for Visual Studio 2008
Build environment
Prerequisite software
Windows XP SP2 or later.
Microsoft Visual Studio 2005 Standard/Pro (8.0) or later. This post explains how Visual Studio Express may work if you have enough free time. Visual Studio 2005 Team trial seems to work. Please tell us if Visual Studio 2008 Pro Trial works. Visual Studio 2010 Beta 2 won't work.
Make sure that "X64 Compilers and Tools" are installed as part of Visual Studio.
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.
Install KB967631; KB960075; KB957912 and KB971092. Yes, that's 400 megs of updates. :/
Install KB958842 (unless you use Visual Studio 2008 Pro).
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 no longer works as of revision ~39982)
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 an earlier version of the Windows SDK 6.0 and built Chromium, you need to do the following:
Clobber your build (recursively delete (rd /s /q) the src\chrome\Debug and src\chrome\Release directories).
Do a gclient sync --force
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.
If you had a previous version of the SDK installed before installing v7.0, verify that your VC++ directories are set to use v7.0 and not an earlier SDK. Look in Tools / Options / Projects and Solutions / VC++ Directories and check the following directories:
Include directories
Library files
Exclude directories
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
set GYP_DEFINES=buildtype=Official
gclient runhooks --force
cd src\chrome
chrome.sln
The dirty trick is defined in release_impl_official.gypi.
Other tricks
See Visual Studio Macros page and debugging pages.
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.
