chromium 构建步骤

因为伟大的墙,我没法轻松访问chromium开发的文档, 现在找了个代理,就先都保存下来,以后好看.

Except as otherwise noted , the content of this page is licensed under a Creative Commons Attribution 2.5 license , and examples are licensed under the BSD License .

The Chromium OS designs and code are preliminary. Expect them to evolve.
For Developers‎ > ‎ How-Tos‎ > ‎

Build Instructions (Windows)

This page has detailed information on building Chromium on Windows, including tips for troubleshooting and for speeding up the build.


Build environment

Prerequisitesoftware
Additional (free) downloads
  1. If you use Microsoft Visual Studio 2005, install Microsoft Visual Studio 2005 Team Suite Service Pack 1.
    1. InstallKB935225,KB947315,KB949009,KB946310,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. InstallKB967631;KB960075; KB957912and KB971092. Yes, that's 400 megs of updates. :/
    3. InstallKB958842(unless you use Visual Studio 2008 Pro).
      1. Not necessary yet:KB956420andKB958357. Only if you enjoy downloading another 750 megs of data and wasting a few hours.
  3. Install theWindows 7 SDK. (v6.1 no longer works as of revision ~39982)
    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 an earlier version of the Windows SDK 6.0 and built Chromium, you need to do the following:
      1. Clobber your build (recursively delete (rd /s /q) the src/chrome/Debug andsrc/chrome/Release directories).
      2. Do a gclient sync --force
  4. Integrate the SDK with Visual Studio:
    1. 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
    2. If build still fails, try registering the SDK manually.
    3. 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. Seeregistering the SDK manuallyfor details.
  5. Install the DirectX SDK.
    1. Verify MSVC|Tools|Options|Projects and Solutions|VC++ Directories has Include: $(DXSDK_DIR)include and Lib:$(DXSDK_DIR)lib
  6. 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. 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.
  2. 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
      .Use " mkdir %userprofile%/.gyp" in a command promptto create the folderbecause explorer may complain that you need to provide a file name. 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,.hfiles and only check for viruses onmodify. Disable scanning the directory where your sources reside.
  • Store and build the Chromium code ona second hard drive. It won't really speed up the build but at least your computer will stay responsive when you dogclient syncor 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.exe /build Debug chrome.sln /project chrome.vcproj

You can also use devenv.com with the same command-line. This will show the output of the various build commands, which can be useful when trying to track down errors during building.

Note for Windows Vista: the devenv command may silently fail if Visual Studio has been configured to always run asAdministrator. 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 GYP_DEFINES=branding=Chrome buildtype=Official
  2. gclient runhooks --force
  3. cd src/chrome
  4. chrome.sln
The dirty trick is defined in release_impl_official.gypi.
Unit tests
Some unit tests (such as gfx_unittests) require at least Vista/2008 with Platform Updateinstalled or Windows 7 to execute all of the tests completely.
Other tricks
See Visual Studio Macros page and debugging pages.
Blog post on setting a right-hand print margin

Running Chromium

Thechrome.exe executable can be found atchrome/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 Chromiumfor more information.

Once you're comfortable with building Chromium, read the Contributing Code pagefor 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

IfyoubuildonVista,watchoutforsecurityissues.Makesurethatthefolderwhereyoucheckedoutyourfilesiswritableforusersandnotonlyforadmins.

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. If you happen to have checked out the source code before installing the build prerequisites (Visual Studio, the SDK, and all the patches), you'll need to re-generate the VS solution files by quitting Visual Studio and then running "gclient runhooks".
  3. 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.
  4. If you get errors like these:
    * C:/Program Files/Microsoft SDKs/Windows/v6.1/Include/unknwn.idl(108) : error MIDL2025 : syntax error : expecting ] or , near "annotation"
    * browser/download/download_util.cc(469) : error C2065:'ITaskbarList3' : undeclared identifier
    You either have the wrong Platform SDK or it is incorrectly registered. Try installing theWindows 7 SDKor, if already installed, tryregistering the SDK manually.
  5. If you get errors like this:
    * error C2039: '_Swap_adl' : is not a member of 'std'
    Then you've likely run into a conflict between the Windows SDK and a security patch. See thisMSDN blog postfor more detailstryreinstalling Visual Studio SP1.

If it still doesn't work, repeating this process probably won't help.

Cygwin access control issues

If, while buildingJavaScriptCore, 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 runningmkpasswd. Cygwin then imposes its own access control, which is incorrectly restrictive. As a workaround, do one of the following:

  • Edit the NT permissions onthird_party/cygwin/tmpto allowModifyandWriteactions forEveryoneandmachine/Users. Cygwin is able to figure this out. Or,
  • Figure out what went wrong with your checkout and try again - try doing the checkout fromcmdinstead 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

  1. Open Visual Studio, Tools > Options... > Projects and Solutions > VC++ Directories
  2. Assuming your base SDK directory isC:/Program Files/Microsoft SDKs/Windows/v7.0, remove any existing entries v6.0 and v6.1 and add the following:
  • In Executable Files, insert on topC:/Program Files/Microsoft SDKs/Windows/v7.0/bin
  • In Include Files, insert on topC:/Program Files/Microsoft SDKs/Windows/v7.0/Include andC:/Program Files/Microsoft SDKs/Windows/v7.0/Include/gl
  • In Library Files, insert on topC:/Program Files/Microsoft SDKs/Windows/v7.0/lib
  • In Exclude directories, insert on topC:/Program Files/Microsoft SDKs/Windows/v7.0/Include andC:/Program Files/Microsoft SDKs/Windows/v7.0/Include/gl

Reinstalling Visual Studio SP1

If you get errors like this:
error C2039: '_Swap_adl' : is not a member of 'std'
then you've likely run into a conflict between the Windows SDK and a security patch. See this MSDN blog post for more details. The workaround is to re-download and over-install SP1 for Visual Studio 2008. Note that at this point you're going to need to re-install all of the hotfixes from above and you should verify that the SDK directories are correct and fix them if not (see "Manually registering the Platform SDK" above).

Special Service Pack Preparation Tool for Visual Studio 2008

If you are having weird compilation problems on Visual Studio 2008, you may have missed some small prints when downloading the Service Pack 1. Here's an excerpt for you:
  • If you previously installed a Visual Studio 2008 Hotfix or Visual Studio 2008 SP1 pre-release, you must run theService Pack Preparation toolbefore installing Visual Studio 2008 SP1.
_displayNameOrEmail_ - _time_ - Remove

_text_

### 回答1: Chromium 109在Windows系统上的构建非常简单,你可以通过以下步骤完成:1. 下载Chromium源代码;2. 从Chromium源代码中构建Windows系统版本;3. 使用Visual Studio编译Chromium;4. 在Windows系统上运行Chromium。 ### 回答2: Chromium是一款开源的网络浏览器项目,它的源代码可以通过开源社区获取并进行构建。下面是Chromium 109在Windows系统上的构建步骤: 1. 准备开发环境:首先,需要安装Windows操作系统,并确保系统中已经安装了Git以及Python等必要的开发工具。 2. 下载源代码:进入Chromium的官方源代码仓库(https://chromium.googlesource.com/chromium/src),通过Git将源代码下载到本地计算机。 3. 安装依赖项:在源代码的根目录下运行一些脚本文件,脚本文件会检测环境并安装必要的依赖项,如编译器、库文件等。 4. 配置构建Chromium有许多构建选项,可以通过在源代码根目录下运行GN命令配置构建。GN文件是一个用于配置构建的文本文件,可以在其中指定编译器、构建类型、构建目标等选项。 5. 开始构建:运行Ninja命令开始构建Chromium。Ninja是一个构建系统,它会根据GN配置文件生成一系列的构建指令,并进行编译链接。 6. 等待构建完成:构建过程可能需要一些时间,取决于计算机性能以及网络速度。 7. 完成构建构建成功后,在构建目录中就能找到生成的Chromium可执行文件。 以上是Chromium 109在Windows系统上的简要构建步骤,具体的步骤可能会因为开发环境和个人需求的不同而有所变化,但总体上是类似的。 ### 回答3: Chromium 109是指在Windows操作系统上构建Chromium(Google Chrome的开源版本)的步骤构建Chromium的第一步是设置开发环境。首先,您需要下载并安装Visual Studio,这是Windows系统上的主要开发工具。然后,您需要安装depot_tools,这是Chromium开发所需的一组工具。您还需要安装Python,并将其添加到系统的环境变量中。 接下来的步骤是获取Chromium的源代码。您可以使用depot_tools中的命令行工具"fetch"来执行此操作。执行"fetch chromium"命令将下载最新的Chromium源代码。 下载完成后,您需要为构建过程选择适当的构建配置。Chromium支持多个配置选项,如Debug、Release、ThinLTO等。您可以使用gclient命令将配置设置为您希望构建的配置。 在选择了构建配置后,您可以使用gn工具生成构建脚本。gn生成的构建脚本将包含构建Chromium所需的所有编译选项和依赖库。 接下来,您需要运行ninja命令来执行实际的构建。ninja命令将按照gn生成的构建脚本所定义的规则进行构建。这个过程可能需要一些时间,具体取决于您的计算机的性能和网络速度。 构建完成后,您可以在构建输出文件夹中找到生成的可执行文件和其他相关文件。您可以运行生成的可执行文件来启动Chromium浏览器。 总的来说,构建Chromium 109在Windows系统上需要准备开发环境、获取源代码、选择构建配置、生成构建脚本和执行构建步骤。这些步骤需要一些开发工具和命令行操作,并可能需要一些时间和计算资源。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值