在windows上编译chrome浏览器Building Chromium for Windows

im, 无色
im, 无色
im, 无色
884
文章
0
评论
2019年7月4日14:30:38 评论 852

web端用webRTC实现的一对一视频,互动直播和会议。https://github.com/starrtc/an...

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
https://storage.googleapis.co...
添加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 Studio2017Enterprise

disable Windows Indexing.
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 outDefault chrome
(花了将近5个小时编译出来了 chrome.exe 不过又多出来了50多个G的编译临时文件,在out目录)
传递给Ninja,前面没有“//”(因此//chrome/test:unit_tests使用ninja -C out / Default chrome / test:unit_tests`)。

run the browser:
$ outDefaultchrome.exe

update an existing checkout, you can run
在 src同级目录
$ git rebase-update
$ gclient sync

生成vs2017解决方案:
$ gn gen --ide=vs outvs
$ devenv outDefaultall.sln

之前就有4701多个projects
will be very slow to load.
gn gen --ide=vs --filters=//chrome --no-deps outDefault
其它:--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 = [ 区域里面,这个主要下载一些文件
因为在老版的指南https://www.chromium.org/deve...
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/ 就可以直接在浏览器下载了。前提当然是你还开着翻墙代理。所以任务就变成了下载下面这个地址的文件到刚刚那个目录。
https://storage.googleapis.co...

wget --no-check-certificate https://storage.googleapis.co... -O src/buildtools/mac/gn

http://www.debugrun.com/a/86K...
https://idom.me/articles/843....
放在src同级目录下
chmod +x ./gs
./gs src/DEPS
windows下
node gs.js src/DEPS

_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/buildchrome_child.x86.orderfile

gs://chromium-browser-clang/orderfiles/a0ff6a0859090f8a990b54acf18310a9bd8b2c85 for src/chrome/buildchrome_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的编译文档

https://www.cnblogs.com/Forev...
https://chromium.googlesource...

im, 无色
  • 本文由 发表于 2019年7月4日14:30:38
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: