wxyz2010's blog

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  7 Posts :: 3 Stories :: 0 Comments :: 0 Trackbacks

常用链接

留言簿

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

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

  1. If you use Microsoft Visual Studio 2005, install Microsoft Visual Studio 2005 Team Suite Service Pack 1.
    1. Install KB935225KB947315KB949009KB946310, and KB971090.
    2. If you're running Vista, you need to install Service Pack 1 Update for Windows Vista.
  2. If you use Microsoft Visual Studio 2008
    1. Install VS2008 Service Pack 1.
    2. Have fun installing KB967631KB960075; KB958842KB957912 and KB971092. Yes, that's 400 megs of updates.
      1. Not necessary yet: KB956420 and KB958357. Only if you enjoy downloading another 750 megs of data and wasting a few hours.
  3. Install the Windows 7 SDK. (v6.1 will do too)
    1. Read the instructions on the SDK download page! Read it Again!
      1. If you use VS2005, you need to read point 5.1.5 in the release notes!
    2. You might need to reboot. You can save space by not installing the documentation and code samples.
    3. 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.
  4. Integrate the SDK with Visual Studio: 
    1. Start > All Programs > Microsoft Windows SDK > Visual Studio Registration > Windows SDK Configuration Tool.
      1. 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.
  5. Get the Chromium depot_tools.

Chromium code

  1. Check out the source code using either the bootstrap tarball or a direct svn checkout.

Building Chromium

  1. If you are using VS2008;
    1. 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.
  2. 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.
  3. 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:
  1. set CHROME_BUILD_TYPE=_official
  2. cd src\chrome
  3. chrome.sln
The dirty trick is defined in release.vsprops.

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.

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:

  1. Make sure you have SP1 for Visual Studio 2005. It's required. Really.
  2. 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:
    1. Close Visual Studio.
    2. 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). 
    3. If there were conflicts, sync again after resolving them. 
    4. 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. 
    5. Restart Visual Studio and open the Chromium solution. 
    6. 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
posted on 2010-01-15 21:36 wxyz2010 阅读(811) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理