在windows上編譯chrome瀏覽器Building Chromium for Windows


 

 

 

 web端用webRTC實現的一對一視頻,互動直播和會議。https://github.com/starrtc/android-demo

 

 

Chromium requires Visual Studio 2017 (15.7.2) to build.
錯誤:Exception: Visual Studio Version 2017 (from GYP_MSVS_VERSION) not found.
安裝“使用C ++進行桌面開發”組件和“MFC和ATL支持”子組件。
您必須安裝版本10.0.17134 Windows 10 SDK。可以通過選中Visual Studio Installer中的相應框來安裝。
還必須安裝SDK調試工具(The SDK Debugging Tools)。如果通過Visual Studio安裝程序安裝了Windows 10 SDK,則可以通過以下方式安裝它們:控制面板→程序→程序和功能→選擇“Windows軟件開發工具包”→更改→更改→檢查“Windows調試工具(Debugging Tools For Windows)” “→改變。
安裝  depot_tools
添加PATH ,放在開頭
DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0.
這告訴depot_tools使用本地安裝的Visual Studio版本(默認情況下,depot_tools將嘗試使用google內部版本)
GYP_MSVS_VERSION = 2017
GYP_MSVS_OVERRIDE_PATH = D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
  • Click on “Indexing Options也可以在控制面板中打開索引選項” that should come up in the search
  • When the Indexing Options box comes up, Click on the Modify button. This will pop up an Indexed Locations dialog, where you should see a list of some “locations”, with your hard drive(s) being in the list.
  • Expand the desired hard drive, down to the root folder of the files you’re using SVN with, and make sure the box is unchecked. Also note that the hard drive will most likely be collapsed, and will have its box unchecked, even though once you expand it, you may find checked boxes.
如果有其它版本python,最好先卸載掉
From a cmd.exe,  run the command gclient (without arguments). On first run, gclient will install all the Windows-specific bits needed to work with the code, including msysgit and python.
where python
獲取代碼
首先,配置Git
$ git config -- global user . name "My Name" $ git config -- global user . email "my-name@chromium.org" $ git config -- global core . autocrlf false $ git config -- global core . filemode false $ git config -- global branch . autosetuprebase always
mkdir chromium && cd chromium
如果您不想要完整的倉庫歷史記錄,可以通過添加 --no-history 標記來節省大量時間
fetch --no-history chromium
webrtc  下載只需要把 chromium 改成 webrtc 即可, chromium 大概有10幾個G, webrtc 有6個G左右。
中間斷了的話,可以通過 gclient sync 來同步代碼
The remaining instructions assume you have switched to the  src  directory
cd src
use GN  to generate  .ninja  files.
gn gen out / Default
out目錄是可以刪除的,剛開始是空的
autoninja - C out \Default chrome
( 花了將近5個小時編譯出來了  chrome.exe  不過又多出來了50多個G的編譯臨時文件,在out目錄)
傳遞給Ninja,前面沒有“//”(因此 //chrome/test:unit_tests 使用ninja -C out / Default chrome / test:unit_tests`)。
run the browser:
$ out \Default\chrome . exe
update an existing checkout, you can run
在 src同級目錄
$ git rebase - update $ gclient sync
生成vs2017解決方案:
$ gn gen -- ide = vs out \vs $ devenv out \Default\all . sln
之前就有4701多 projects
will be very slow to load.
gn gen --ide=vs --filters=//chrome --no-deps out\Default
其它:--filters=//chrome;//third_party/WebKit/*;//gpu/*
錯誤:
Exception: Visual Studio Version 2017 (from GYP_MSVS_VERSION) not found.
please supply those settings in a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environment var.
這個一般是running hooks造成的
在src/ DEPS的hooks = [ 區域里面,這個主要下載一些文件
Run hooks to fetch everything needed for your build setup.
gclient runhooks
Failed to fetch file gs://chromium-gn/22d302b1658a293a4997205350751ff309b138c9 for src/buildtools/win/gn.exe,
gn.exe.sha1里面內容為
22d302b1658a293a4997205350751ff309b138c9
gs://  替換為  https://storage.googleapis.com/  就可以直接在瀏覽器下載了。前提當然是你還開着翻牆代理。所以任務就變成了下載下面這個地址的文件到剛剛那個目錄。
wget -- no -check-certificate https://storage.googleapis.com/chromium-gn/a68b194afb05d6a6357cf2e2464136ed7723c305 -O src/buildtools/mac/gn
放在src同級目錄下
chmod +x ./gs
./gs src/DEPS
windows下
node gs.js src/DEPS
gs.js
_downloader_worker_thread使用封裝類gsutil實現對google雲存儲的訪問。上述代碼中file_url代表下載的url,是gs://格式的。該方法首先采用gsutil.check_call('ls', file_url)檢查目標文件是否存在,之后采用gsutil.check_call('cp', file_url, output_filename)將file_url下載到目標文件output_filename。
上述的方法均要訪問gs://,我們的代理目前訪問不了這個地址,
You have unstaged changes.
Please commit, stash, or reset.
gclient sync -f
Failed to fetch file gs://chromium-clang-format/c8455d43d052eb79f65d046c6b02c169857b963b for src/buildtools/win/clang-format.exe
gs://chromium-browser-clang/rc/ba51d69039ffb88310b72b6568efa9f0de148f8f for src/build/toolchain/win/rc/win/rc.exe
gs://chromium-fonts/a22de844e32a3f720d219e3911c3da3478039f89 for src/third_party/test_fonts/test_fonts.tar.gz
並解壓
gs://chromium-browser-clang/orderfiles/f7e302e7d120961ef0cda7faeb1f53bcdad01a33 for src/chrome/build\chrome_child.x86.orderfile
gs://chromium-browser-clang/orderfiles/a0ff6a0859090f8a990b54acf18310a9bd8b2c85 for src/chrome/build\chrome_child.x64.orderfile
錯誤2
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position
mimetypes.py文件
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
chromium 的編譯和 webrtc 的編譯方式相同, webrtc 官網也是使用的 chromium 的編譯文檔


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM