v8引擎:编译(一)

电脑配置:macos catalina i5 16g 1t
编译版本:v8-version,8.6.00.1
编译日期:2020.07.15

1.git安装配置

先安装homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

然后

brew install git

git的配置参考https://docs.github.com/en/gi... 操作即可

2.depot_tools下载安装

depot\_tools是个工具包,里面包含gclient、gcl、gn和ninja等工具。其中gclient是代码获取工具,它其实是利用了svn和git。gn和nijia是编译工具

在下载depot\_tools时需要科学上网这样才能打开https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up

同时还需要查看自己的科学上网软件的代理端口然后

git config --global http.proxy "127.0.0.1:1087”

这样才能下载回来

git clone https://chromium.googlesource.com/chromium/tools/depot\_tools.git

下回来之后需要设置全局变量https://blog.csdn.net/akaier/article/details/81296794

设置好了以后需要输入gclient更新depot\_tools但会报错

curl: (7) Failed to connect to chrome-infra-packages.appspot.com port 443: Operation timed out

又是代理的问题所以直接这样设置https://www.jianshu.com/p/db3964292b1c

然后再来

gclient

更新会出现

WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will be created.

这时候就ok了

3.编译源码

mkdir ~/v8

cd ~/v8

fetch v8

拉取对应的文件,持续等待

这个时候可以去下载xcode软件

等拉取完了可以在本地创建一个新分支

git new-branch 20200715gyk

git pull && gclient sync//确保所有依赖都是最新的

开始编译源码

tools/dev/gm.py x64.release.check

autoninja会自动编译记得开代理,漫长的等待

\# autoninja -C out/x64.release unittests cctest inspector-test d8 wasm\_api\_tests

ninja: Entering directory \`out/x64.release'

\[520/520\] LINK ./cctest

\# "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" tools/run-tests.py --outdir=out/x64.release debugger intl mjsunit cctest message unittests 

Build found: /Users/gyk/v8/v8/out/x64.release

\>>> Autodetected:

pointer\_compression

\>>> Running tests for x64.release

\>>> Running with test processors

\[02:24|% 97|+ 16494|- 0\]: Done 

\>>> 16972 base tests produced 16494 (97%) non-filtered tests

\>>> 16494 tests ran

Done! - V8 compilation finished successfully.

你可能感兴趣的:(javascript)