下载Chromium源码方法及问题记录

下载Chromium源码方法及问题记录 系统:win7 64bit or ubuntu 官方网址: 1、下载depot_tools:

  a) windows   地址:

  b) ubuntu

    首先安装git-core:sudo apt-get install git-core

    执行命令:git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

2、更新depot_tools环境变量

  a) windows

    解压depot_tools.zip, 将depot_tools的路径(如d:depot_tools)加入PATH环境变量。

  b) ubuntu

    vim ~/.bashrc文件,在最后一行加入:export PATH="$PATH:your_depot_tools_dir/depot_tools",

    然后保存并运行命令:source ~/.bashrc

3、配置源码分支版本

  cd进入自定义的源码目录,执行gclient config http://src.chromium.org/svn/releases/31.0.1620.2   31.0.1620.2 为版本号,可根据需要下载相应版本,chromium各版本:   如果不需要check out LayoutTest测试文件,可以打开以版本名称命名(如31.0.1620.2)的目录下的DEPS文件,找到下面这行并修改为:   "src/third_party/WebKit/LayoutTests": None, 4、 第一次执行gclient时会自动安装git、python等,等待其安装完毕。   中间可能会出现连接错误,如:Failed connect to chromium.googlesource.com:443   可考虑如下做法:   a)将以下内容复制到C:WindowsSystem32driversetchosts文件中

    74.125.31.82  www.googlesource.com     74.125.31.82  android.googlesource.com     203.208.46.172  cache.pack.google.com     59.24.3.173  cache.pack.google.com

  b)在.gclient文件中的"custom_deps" 节点下加入:

    "custom_deps" : { "":None},

5、执行gclient sync --force,则开始同步代码。   如若下载过程中出现问题,重新执行此命令。   若在下载源码过程中出现下载toolchain_win_x86.tar.bz2等文件失败时,可以考虑如下做法:

  a) 用浏览器将这些文件下载到本地(可能url会被墙,需要结合goagent与chrome,具体配置goagent的方法见《》)

  b) 在本地搭建tomcat服务器,搭建一个可供本地连接并下载的web服务器。

  c) 分别为每个文件配置目录,最终url的形式如:http://127.0.0.1/x86_toolchain/r12034/toolchain_win_x86.tar.bz2

  d) 修改D:chromium-srcsrc ative_clientuild oolchainbinaries.py文件:BASE_DOWNLOAD_URL = ()

  然后重新执行gclient sync --force即可。

问题记录:

1.  如果在下载源码过程中,遇到jsoncpp相关的错误,如:Error: Command svn update /home/nightelf/chromium/chromium_28/src/third_party/jsoncpp/source/include。

   是由于jsoncpp更改了它的 soure location,所以你需要修改以版本为名称(如31.0.1620.2)的目录下的 DEPS 文件,更新jsoncpp的地址。

   修改DESP文件中的jsoncpp:

   http://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp,

   将其修改为:https://svn.code.sf.net/p/jsoncpp/code,再重新gclient sync --force即可。

经验分享 程序员 微信小程序 职场和发展