.
Getting the code
Check out the source code using either the bootstrap tarball or a direct svn checkout, then
update it to the latest version.
Building Chromium
Open the
chrome/chrome.sln solution file in Visual Studio and build the solution. This can take from 25 minutes to 1 hour.
If you just want the Chromium browser, and none of the tests, you can speed up your build by right-clicking
chrome_exe 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:
- For Visual Studio 2005, install hotfix 935225 and hotfix 947315.
- Use a true multicore processor (ie. an Intel Core Duo 2; not a Pentium 4 HT).
- 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. Don't do anything stupid.
- 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
Our default solution file is chrome.sln
which includes the V8 JavaScript engine. If you need to make a
reference build of Chromium using JavaScriptCore, you should use the chrome_kjs.sln solution file. You will also need to set JS_ENGINE_TYPE=_kjs in your environment, then run Visual Studio (devenv) from that same command line. From the command line, type:
C:\trunk\src\chrome> set JS_ENGINE_TYPE=_kjs
C:\trunk\src\chrome> devenv chrome_kjs.sln
If the devenv command isn't found, run the Visual Studio 2005 Command Prompt in your Start menu (by default, under Microsoft Visual Studio 2005 > Tools). This will set up the correct environment to run Visual Studio from the command line.
In Cygwin, use the following command:
$ JS_ENGINE_TYPE=_kjs devenv chrome_kjs.sln
Build Chromium using scons / Hammer
If you want to get work done, build with Visual Studio. But if you want to use the same build system that Linux uses, you can do that, too. Here's how:
Copy the Windows SDK to third_party/platformsdk_vista_6_0/files, e.g.
C:\trunk\src\third_party> mkdir platformsdk_vista_6_0
C:\trunk\src\third_party> xcopy /s "C:\Program Files\Microsoft SDKs\Windows\v6.0" platformsdk_vista_6_0\files
Then build using a cmd session:
C:\trunk\src\chrome> hammer base
Or cygwin:
$ cd //cygdrive/c/trunk/src/chrome
$ hammer base
The results live in the chrome/Hammer directory, e.g. to run base's unit tests, do
$ Hammer/base_unittests.exe
This is handy when testing a patch that changes the scons build files (e.g. base/base_lib.scons).
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.
Debugging
Because of Chromium's unique architecture, there are a number of special challenges associated with development. See Debugging Chromium for more information.
Contributing
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 st" 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.
chrome_kjs.sln tempfile problems
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.
Error message: This application has failed to start because the application configuration is incorrect or The system cannot execute the specified program
Install Microsoft Visual Studio 2005 Service Pack 1 (download).
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\v6.1)