Linux chromiumソースのダウンロードとコンパイル
4758 ワード
1. Chromium Souce Code Download
1.1 download source code
1>メソッド1
#すべてのパブリケーションtagの情報を取得します.
git fetch --tags
#37.2062.103バージョンに基づいて独自のブランチを作成
git checkout -b your_release_branch 37.0.2062.103
//すべての関連工事コードを同期する
gclient sync --with_branch_heads --jobs 16
2>メソッド2
.gclient
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を決定する
//chromium 39おすすめ./build/gyp_androidの代わりにchromiumが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//4 Gメモリ4 Gswapコンパイル約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を実行し、renderプロセスidにattachを実行する(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
1.1 download source code
1>メソッド1
#すべてのパブリケーションtagの情報を取得します.
git fetch --tags
#37.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/[email protected]",
"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を決定する
//chromium 39おすすめ./build/gyp_androidの代わりにchromiumが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//4 Gメモリ4 Gswapコンパイル約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を実行し、renderプロセスidにattachを実行する(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