Download the chrome code and compile

Source: Internet
Author: User
Tags pack svn svn client python script
Compile step

The first step to do the excavation is to get the code and successfully compile debugging, I only talk about the compilation in the Windows environment, my operating system is Windows Server 2008 Enterprise Edition, other Windows environment should not be a big difference. In fact, the purpose of my writing this article may be more to deepen the impression, make a memo, because the official description of the compilation process has been more clear, if you are more interested in the Official document description, please refer to here.

Note To download code and complete compilation please prepare at least 10G free hard disk space, the higher your machine configuration, the better. The quality of the machine configuration directly determines the length of time you wait for compilation.

I'm just simplifying the steps here: (Pay attention to at least 10G)

1. Install Visual Studio 2008, install VS2008 Service Pack 1, install patch KB967631 for SP1 patches; KB960075; KB958842; KB957912 and KB971092. Note that the KB971092 patch is larger, a total of more than 300 m.

2. Install the Windows 7 SDK, preferably download the ISO mirror version, much smaller. Note The Windows 6.1 SDK is no longer supported after a revision of 39982. The project version and day value can be viewed here. After the installation is complete, choose Windows SDK Configuration tool and VS2008 integration Integration from the Start menu.

3. Get the installation Depot_tools tool, which is Google's own SVN code to get the client tools, download and extract to the D:/depot_tools directory. Add the Depot_tools directory path to the PATH environment variable. Then the new environment variable gyp_msvs_version=2008, the purpose of the environment variable is to produce the VS2008 engineering type eventually.

4. Download the code, in the example D: Create a chromium directory, and then the command line CD to the directory, clear you need to download the version, for example, when I wrote this article, the official latest release of the stable version of 4.1 249.1059, I want to download this version of the source code, first in the d:/ Chromium Directory Execution

Gclient Config

The command doesn't really download code, it's just a client-side configuration, and note that due to the first run of gclient, the dependent Python and SVN tools may not have been installed, and gclient will automatically download and install it, so you don't have to install the SVN client and Python separately beforehand. You can see the progress tips for installing Python and svn on the window, you just have to wait and if there's a mistake halfway through, you just need to execute the above command again. Note that the gclient Config command only needs to be executed once, unless you need to synchronize other versions of the code and change the configuration path. Once the command is complete, then execute the

Gclient Sync--force

began to sync download code, now the task is to wait, according to your network situation, may need to download half-day to more than one day, if midway error, only need to gclient Sync–-force, will automatically follow the last download. Note must add--force parameter option, otherwise may download is not complete.

5. Compile the code, if all goes well, gclient sync–force execution, all the code completely successful download, and automatically generated the VS2008 solution engineering file, now directly open d:/chromium/src/chrome/ Chrome.sln solution file, set Chrome to Startup engineering, right-click on the Chrome project and select Build to start compiling. According to your machine configuration, you need to wait 20 minutes to 2 hours or more, I am in the new T410 (I7 CUP, 4G memory, 7200 500G hard disk) notebook, compiled 40 minutes.

6. Running Chrome, after compiling, there are nearly 200 dependencies in total, and eventually the Chrome.exe and related files will be generated in the Chrome/debug directory. Run directly F5 in vs2008, and then enter ' about: ' In the browser address bar to verify the version number. If the display:

Chromium (Developer Build 44723)



User Agent
mozilla/5.0 (Windows; U Windows NT 6.0; En-US) applewebkit/532.5 (khtml, like Gecko) chrome/ safari/532.5

Congratulations, the version is completely correct. Note that I am taking the latest version of this article as an example, and you just need to compare it to the latest release of the installation version of Chrome.

The whole process is going well, and Google has done a very good job of doing it without having to involve a lot of complicated configuration work. Chrome's Open source is a big part of Google's contribution to the open source world. Gclient is Google's own encapsulated tool, its essence is to call SVN, the extra work is mainly in Google code warehouse with deps files to describe the dependencies between the project version, Gclient will parse Deps file and download the corresponding version of the dependent library, this is a cyclic process. Interested can refer to the Depot_tools directory of related Python script implementation process. If you want to download the latest development version, be careful not to configure it directly as HTTP://SRC.CHROMIUM.ORG/SVN/TRUNK/SRC, this download is likely to not compile successfully, because the backbone of the code at any time to submit changes, no release, So be sure to download the release, such as 5.0.387.0. The whole project is so huge that you can see how hard it is to be a really good browser. The code includes WebKit HTML parsing, CSS parsing, V8 JS engine implementation, Skia graphics processing, security technology, Network, database, NPAPI plug-in framework, extended framework, multiple processes, multithreading, and so on technical topics, if you're interested in something, You may wish to study these artistic code. Of course, such a large open source project analysis and learning is to talk about methods and perseverance, I will also be related to this analysis and discussion.

Note: If gyp_msvs_version=2005 will generate a 2005 solution, using VS2005 to compile Chrome requires the following configuration:

1. Configure Microsoft Windows SDK7: Start menu à all Programs àmicrosoft Windows SDK v7àvisual Studio registrationàwindows SDK Configuratio n Tool, select "V7" in the Drop-down box on the right side of the Install Windows SDK versions, selected Microsoft Visual Studio 2005 in the Select Visual Studio versions, the most Then click "Make Current" (select Confirmation in the pop-up dialog box).

2. Install Visual Studio Service Pack 1 (Vista and Win7 will also install Visual Studio Service Pack 1 Update for Windows Vista)





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.