ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

在win10中编译chromium工程的稳定版本

2019-04-22 10:56:33  阅读:463  来源: 互联网

标签:src third 编译 2018 34328 win10 party chromium


前言

帮同事做实验,都是win10 + vs2017 + chromium工程,他那就能编译成功,我这就显示winsdk路径不对。
后来chromium工程编译过后,总结了一下失败的原因:win10和vs2017要配套.
chromium编译环境太娇气了, 不只是配置要求高,操作系统和vs环境也要最新的。
win10 v1803(OS内部版本 17134.191) // 用winver查看
vs2017 15.7.6 (win10sdk版本10.0.17134.0) // 用Visual Studio Installer查看

开始做编译环境,失败点如下:

  • 安装完win10的1803版后,没有及时将补丁打到最新。
  • 以前下载过一个vs2017的旧版,安装完后,又单独装的win10sdk17134
    这2点操作错误,使win10和vs2017不配套。导致后来编译chromium时,报奇怪的错(winsdk 路径不对)。

开始用旧的vs2017时,chromium的python脚本还报ucrtDLL找不到(当错误发生时,修改python脚本,将要拷贝的文件路径打出来,发现的)。
去看C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64,根本没这目录。
当安装新版vs2017时,特意注意了一下。就是vs2017安装的C:\Program Files (x86)\Windows Kits\10\中的库。旧版vs2017根本就不安装C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64中的ucrt的一堆DLL.

chromium官方文档中只说了win10 + vs2017 + win10sdk17134.估计人家都从干净的最新系统说的.
如果系统上装过旧版vs2017, 又单独装了一个win10sdk17134, 这就杯具了,报错很奇怪的,必须要重新装最新的win10和vs2017才能解决编译问题。

新版的vs2017安装程序很小,安装好后是Visual Studio Installer。用Visual Studio Installer继续在线装vs2107.

当win10和vs2017收拾妥当后,再按照chromium官网的文档,就可以编译成功了。再没特别的,编译步骤很简洁。

因为编译要长时间运行,将休眠禁了。

为了尝试编译和调试的更快:

  • 将单独的ssd作为工程所在的分区
  • 将虚拟内存禁了,只用64GB物理内存来干活。

chromium编译步骤

As of September, 2017 (R503915) Chromium requires Visual Studio 2017 (15.7.2) to build.
You must install the “Desktop development with C++” component and the “MFC and ATL support” sub-component
You must have the version 10.0.17134 Windows 10 SDK installed.

The SDK Debugging Tools must also be installed. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to: Control Panel → Programs → Programs and Features → Select the “Windows Software Development Kit” → Change → Change → Check “Debugging Tools For Windows” → Change. Or, you can download the standalone SDK installer and use it to install the Debugging Tools.

add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0.

下载depot_tools.zip并解压
Modify the PATH system variable and put C:\src\depot_tools at the front (or at least in front of any directory that might already have a copy of Python or Git).

实际释放到 Z:\depot_tools

用管理员运行cmd.exe
z:
mkdir chromium
cd chromium

From a cmd.exe shell, 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.

After running gclient open a command prompt and type where python and confirm that the depot_tools python.bat comes ahead of any copies of python.exe.

$ 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

fetch chromium

When fetch completes, it will have created a hidden .gclient file and a directory called src in the working directory. The remaining instructions assume you have switched to the src directory:

Z:\chromium>cd src

Z:\chromium\src>git status
HEAD detached at origin/master
nothing to commit, working tree clean

git tag
查看tag, 按住翻页键,直到看到自己想查看的tag名称

git tag -l “68."
git tag -l "68.0.3440.

查看指定范围的tag

Working with Release Branches

稳定版分支
Chromium for 64-bit Windows only
Reference: Current stable version (Google Chrome): 68.0.3440.84 (561733) • Tuesday, 31 Jul 2018

Chrome Release Channels
Chromium Development Calendar and Release Info
在Current Release Information下面的列表中,也可以看到稳定版分支为68.0.3440.84

Make sure you have all the release tag information in your checkout.
如果是第一次玩chromium, 开始用的是fetch chromium, 已经将标签都拉下来了.可以不用下列命令拉标签.
如果隔了一段时间, 可能有新标签了,才需要更新标签到本地。

git fetch --tags

切换到想调试的分支

Z:\chromium\src>git checkout -b my_branch_68_0_3440_84 68.0.3440.84
Checking out files: 100% (56155/56155), done.
Previous HEAD position was d35e08b77ab8 Use ClearAllFields() when we're disabling.
Switched to a new branch 'my_branch_68_0_3440_84'
Branch 'my_branch_68_0_3440_84' set up to track remote ref 'refs/tags/68.0.3440.84' by rebasing.

确认现在分支是哪个

Z:\chromium\src>git status
On branch my_branch_68_0_3440_84
Your branch is up to date with '68.0.3440.84'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        chrome/test/data/xr/
        third_party/quic_trace/
        tools/luci-go/.versions/
        tools/luci-go/isolate.exe

nothing added to commit but untracked files present (use "git add" to track)

同步当前分支的代码

gclient sync --with_branch_heads --with_tags
Running hooks: 100% (64/64), done.

WARNING: 'src\third_party\angle\third_party\vulkan-headers\src' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\third_party\spirv-headers\src' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\third_party\angle\third_party\deqp\src' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\chrome\test\data\xr\webxr_samples' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\third_party\angle\third_party\vulkan-loader\src' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\third_party\angle\third_party\vulkan-tools\src' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\third_party\libaom\source\libaom' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\chrome\test\data\xr\webvr_info' is no longer part of this client.  It is recommended that you manually remove it.


WARNING: 'src\third_party\quic_trace\src' is no longer part of this client.  It is recommended that you manually remove it.

Z:\chromium\src>

将提示要删除的文件夹,手工删除。

rmdir /S third_party\angle\third_party\vulkan-headers\src
rmdir /S /Q third_party\spirv-headers\src
rmdir /S /Q third_party\angle\third_party\deqp\src
rmdir /S /Q chrome\test\data\xr\webxr_samples
rmdir /S /Q third_party\angle\third_party\vulkan-loader\src
rmdir /S /Q third_party\angle\third_party\vulkan-tools\src
rmdir /S /Q third_party\libaom\source\libaom
rmdir /S /Q chrome\test\data\xr\webvr_info

重新再同步下代码确认下

gclient sync --with_branch_heads --with_tags

这回没有多余文件夹的提示了

Z:\chromium\src>gclient sync --with_branch_heads --with_tags
Syncing projects: 100% (83/83), done.
Running hooks: 100% (64/64), done.

再确认下是否在要调试的分支

Z:\chromium\src>git status
On branch my_branch_68_0_3440_84
Your branch is up to date with '68.0.3440.84'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        third_party/quic_trace/

nothing added to commit but untracked files present (use "git add" to track)

现在可以建立工程了

gn gen --ide=vs out\Default_68_0_3440_84

开始编译工程
编译之前,已经将页文件禁了. 看是否能编译快点.

autoninja -C out\Default_68_0_3440_84 chrome

begin 2018-08-04 12:53
8核的cpu占用率已经到达100%
内存使用占比 11.8/63.7 GB
说明编译过程, 对cpu要求还是挺高的。
同事听走在前面的同学说,要20核的cpu编译才比较舒服。用不起那样的计算机…, 那得啥价格才能采购的到,听听都觉得肉疼。

2018-08-04 13:03 => 8640/34328
2018-08-04 13:13 => 15230/34328 # 随着时间推移,编译的速度越来越慢.
2018-08-04 13:23 => 19110/34328
2018-08-04 13:33 => 21508/34328
2018-08-04 13:43 => 23630/34328
2018-08-04 13:53 => 24912/34328
2018-08-04 14:03 => 26507/34328
2018-08-04 14:13 => 27290/34328
2018-08-04 14:23 => 28093/34328
2018-08-04 14:33 => 28786/34328
2018-08-04 14:43 => 29336/34328
2018-08-04 14:53 => 29936/34328
2018-08-04 15:07 => 30957/34328
2018-08-04 15:17 => 32242/34328
2018-08-04 15:27 => 33993/34328
2018-08-04 15:32 => 34328/34328 编译完成,总编译时间2:29

不关闭虚拟内存时,编译时间为2:20分。
可以看出,如果关闭虚拟内存,对程序的运行是有负面效应的。
但是性能并没有下降多少,而且向硬盘写内容的字节数少了。如果让我选,我还是会选关闭虚拟内存。
编译过程中,内存和硬盘都不是瓶颈。瓶颈在CPU那,走在前面的同学说的真对。

标签:src,third,编译,2018,34328,win10,party,chromium
来源: https://blog.csdn.net/LostSpeed/article/details/81405462

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有