Linux chromium 源码下载及编译


1. Chromium Souce Code Download

    1.1  download source code

1> 方法一

# 获得所有发布tag的信息。
git fetch --tags
 
# 根据37.0.2062.103版本建立一个你自己的分支
git checkout -b your_release_branch 37.0.2062.103
 
// 同步所有相关工程代码
gclient sync --with_branch_heads --jobs 16

2>方法2

 .gclient

solutions = [
  {
    "managed": True,
    "name": "src",
    "url": "https://chromium.googlesource.com/chromium/src.git@41.0.2272.76",
    "custom_deps": {
    "src/content/test/data/layout_tests/LayoutTests": None,
    "src/chrome/tools/test/reference_build/chrome_win": None,
    "src/chrome_frame/tools/test/reference_build/chrome_win":None,
    "src/chrome/tools/test/reference_build/chrome_linux":None,
    "src/chrome/tools/test/reference_build/chrome_mac": None,
    "src/third_party/hunspell_dictionaries": None,
    },
    "deps_file": ".DEPS.git",
    "safesync_url": "",
  },
]
target_os = ['android']
    然后 gclient  sync --with_branch_heads --jobs 16

  1.2 配置gyp

~/chromium$ echo "{ 'GYP_DEFINES': 'OS=android', }"> chromium.gyp_env

~/chromium$ gclient runhooks

1.3 安装jdk

1.4 build

~/chormium$ . build/android/envsetup.sh // 配置环境

~/chromium$ android_gyp //在out目录下生成*.ninja文件,会读取环境变量GYP_DEFINES确定platform

// chromium39推荐使用./build/gyp_chromium来代替android_gyp

~/chromium$ ninja -C out/Release content_shell_apk

如果GYP_DEFINES设置不正确,会产生错误ninja: error: unknown target 'content_shell_apk', did you mean 'content_shell_pak'?



2. Build

   http://code.google.com/p/chromium/wiki/LinuxBuildInstructions

   ./build/gyp_chromium -Dflag1=value1 -Dflag2=value2 // create 'out' folder and makefiles
   ninja -C out/Release chrome

   // ninja -C out/Debug chrome // 4G内存 4Gswap 编译了大概有3个小时


   目前能成功编译,但是运行crash,sanbox问题。待解。。。


3. Debug Render进程

    3.1 调试browser进程

     gdb out/Debug/chrome // 只能调试browser进程代码,即只有browse代码的断点能停住

    3.2 调试render进程

    3.2.1  先运行chrome

       ./out/Debug/chrome

    3.2.2 查看render进程id

        pstree -ap | grep chrome

        返回结果如下

         |                      |-bash(6496)---chrome(7043)-+-chrome(7044)
          |                      |                                                |-chrome(7045)-+-chrome(7076)-+-{chrome}(7077)
          |                      |                                                |              |                                      |-{chrome}(7078)
          |                      |                                                |              |                                      `-{chrome}(7128)

             7076 就是render进程id

    3.3.3 运行gdb 并attach到render进程id (需要root 运行gdb,否则attach失败

        $su

         #gdb

         (gdb) attach 7076

          Attaching to process 7076
          Reading symbols from /home/xxx/work/chrome/google/src/out/Debug/chrome...done.

         (gdb) b WebCore::ResourceLoader::didReceiveResponse
         Breakpoint 1 at 0x7f67077c6ea6: file ../../third_party/WebKit/Source/core/loader/ResourceLoader.cpp, line 317.
         (gdb) c

         //刷新界面后,断点停住,可用bt来查看callstack

        (gdb) bt
#0  WebCore::ResourceLoader::didReceiveResponse (this=0x3518a8a35da0, response=...)
    at ../../third_party/WebKit/Source/core/loader/ResourceLoader.cpp:317
#1  0x00007f670815a35e in WebCore::ResourceHandleInternal::didReceiveResponse (this=0x3518a89138e0, response=...)
    at ../../third_party/WebKit/Source/core/platform/network/ResourceHandle.cpp:122
#2  0x00007f6707cc440f in webkit_glue::WebURLLoaderImpl::Context::OnReceivedResponse (this=0x3518a825fb60, info=...)
    at ../../webkit/glue/weburlloader_impl.cc:640

。。。。。


chromium58

If you're trying to build older releases using a current gclient, you'll most likely need to pass --disable-syntax-validation on the command line.

gclient sync --with_branch_heads --disable-syntax-validation


build release tag/branch

https://www.chromium.org/developers/how-tos/get-the-code/working-with-release-branches


gn gen out_arm64_58/Release --args='target_os="android" target_cpu="arm64" is_debug=true is_component_build=true is_clang=false 
                                    symbol_level=1 enable_incremental_javac=false enable_nacl=false proprietary_codecs=true
                                    ffmpeg_branding="Chrome"'

ninja -C out_arm64_58/Release chrome_public_apk





  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值