Chromium mac编译文档

具体请参考官网文档:https://chromium.googlesource.com/chromium/src/+/main/docs/mac_build_instructions.md

下载Xcode

直接商店下载或者是去官网找...我是去官网找12.4的

下载编译工具链:deptool

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

假设您克隆depot_tools到/path/to/depot_tools(注意:您必须使用绝对路径,否则 Python 将无法找到基础设施工具)

添加depot_tools到 PATH 的末尾(您可能希望将其放在您的~/.bash_profileor中~/.zshrc)。:

vi ~/.zshrc
$ export PATH="$PATH:/path/to/depot_tools"

完成后看看是否成功

source ~/.zshrc
echo $PATH

安装指定版本的Xcode

然后

查看当前xcode的sdk版本

xcodebuild -showsdks

 

 错的话

设置下

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

再查看下自己Xcode是否正确

下载Chromium项目代码

据网上说 切换历史版本要全拉 所以

fetch chromium //下载代码

如果要编译指定版本的话

1)检查分支
 git fetch --tags   //一定要有...
(2)根据指定分支创建分支,并切换到该分支
 git checkout -b Browser_61.0.3163.100 tags/61.0.3163.100  //Browser_61.0.3163.100为分支名;61.0.3163.100为对应版本
(3)同步代码
 gclient sync

完成会出现

出现网络问题或者是啥的话 你就gclient sync

 gclient sync -D 是把多余的那些第三方库删除了

太棒啦代码拉取完成!

gn args out/Release

# 编译参数
is_debug = false
is_component_build = false
is_official_build = false
target_cpu = "x64"
symbol_level = 0
blink_symbol_level = 0
ffmpeg_branding = "Chrome"
enable_nacl = false
enable_iterator_debugging = false
proprietary_codecs = true

autoninja -C out/Release chrome

//这里出现一个出错就是

COPY_BUNDLE_DATA gen/compone...sources/org.chromium.Chromium.manifest
FAILED: org.chromium.Chromium.manifest/Contents/Resources/org.chromium.Chromium.manifest 
rm -rf org.chromium.Chromium.manifest/Contents/Resources/org.chromium.Chromium.manifest && cp -Rc gen/components/policy/org.chromium.Chromium.manifest org.chromium.Chromium.manifest/Contents/Resources/org.chromium.Chromium.manifest
cp: org.chromium.Chromium.manifest/Contents/Resources/org.chromium.Chromium.manifest: clonefile failed: Operation not supported

遇到的问题

1.

因为我是黑苹果,让运维装了一个磁盘 根据

https://groups.google.com/a/chromium.org/g/chromium-dev/c/kP0ajpT7wIE

把磁盘换成APFS  磁盘工具那边抹除下就完事了!

https://www.seagate.com/support/kb/how-to-format-your-drive-apfs-on-macos/

2.

1>WARNING: subprocess '"git" "-c" "core.deltaBaseCacheLimit=2g" "clone" "--no-checkout" "--progress" "https://chromium.googlesource.com/chromium/src.git" "--depth=1" "/home/zsm/vivaldi-source/_gclient_src_0boehkur"' in /home/zsm/vivaldi-source failed; will retry after a short nap...

参考博主:https://blog.csdn.net/hshski/article/details/108341137

export DEPOT_TOOLS_UPDATE=0

 那就先试试了这个 

完成后!打开浏览器(我还没完成 这是编译100的完成。。。编译自己版本完成了,但是明显有问题)

out/Release/Chromium.app/Contents/MacOS/Chromium

 

 大功告成

但是这里发生个事情....因为我先打开Chromium100的..... 所以userdata不太一样...出现了个人资料错误

这边记得先去删除userdata 否则会弹出个人资料错误的窗口.....纳闷  此外相当卡顿.... 目前还不知道是为什么....

 

 

重编出现问题1:

 

 Could not find Ninja in the third_party of current project, nor in your PATH 

好像是最近这个时间才出现的,应该是当前版本的depot_tools不包含ninja.exe,但是旧版本是有的

所以就是把编译工具切回到之前编译的版本   之前在windows 处理过 所以对应的是  切到这里去    77e64ae6 

xcode调试

https://chromium.googlesource.com/chromium/src/+/HEAD/docs/lldbinit.md

posted @ 2022-02-24 19:00  冰糖葫芦很乖  阅读(2056)  评论(11编辑  收藏  举报