配置v8

配置小飞机,下载传送门 

  安装

dpkg -i xxx
apt-get -f install

  设置成全局代理

设置终端代理,推荐使用polipo(使用别的全局代理方式可能导致拉取旧的代码的时候代理出问题,喜欢探索的同学可以试下别的方式,信奉人生苦短少瞎折腾的同学跟着这个步骤一步一步来就行;这样配置成功之后终端走的是ssr的全局代理,如果浏览器如chrome想走代理使用终端起chrome进程即可)

安装

sudo apt-get install polipo

修改配置文件

sudo gedit /etc/polipo/config

改为

# This file only needs to list configuration variables that deviate
# from the default values.  See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.

logSyslog = false
logFile = "/var/log/polipo/polipo.log"

socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5

chunkHighMark = 50331648
objectHighMark = 16384

serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32

proxyAddress = "0.0.0.0"
proxyPort = 8123

重启polipo生效

/etc/init.d/polipo restart

修改~/.bashrc添加

export http_proxy="localhost:8123"
export https_proxy="localhost:8123"
export ftp_proxy="localhost:8123"

创建~/.boto文件

[Boto]
proxy=127.0.0.1
proxy_port=8123

导出环境变量

set NO_AUTH_BOTO_CONFIG=path_to_.boto/.boto

重启bash即可(重启bash后可以用curl google.com检查下是否成功)

 

配置V8

  安装ninja并写入bashrc

git clone https://github.com/ninja-build/ninja.git
cd ninja && ./configure.py --bootstrap && cd ..
echo 'export PATH=$PATH:"/path/to/ninja"' >> ~/.bashrc
bash

  安装depot_tools

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

写入.bashrc

echo 'export PATH=$PATH:"/path/to/depot_tools"' >> ~/.bashrc
bash

完成后执行

mkdir v8
cd v8
fetch v8

 下载完成后执行

gclient sync

编译(release版)

tools/dev/v8gen.py x64.debug
ninja -C out.gn/x64.debug

 编译(debug版)

tools/dev/v8gen.py x64.release
ninja -C out.gn/x64.release

 

安装turbolizer

  turbolizer安装时需要配置npm的代理,一个简单易行的方法是修改添加~/.npmrc文件,并写入以下内容

proxy=http://127.0.0.1:8123/
https-proxy=http://127.0.0.1:8123
registry=http://registry.npmjs.org/

 配置好npm代理后切换到/v8/tools/turbolizer目录下安装

npm i
npm run-script build

使用,在turbolizer目录下开启本地端口

python -m SimpleHTTPServer 8000

打开google-chrome浏览器访问本地8000端口即可

 

可能的问题:

0.如果在拉取旧的commit(git reset --hard xxx)的时候使用gclient sync报错

Error: 4> 
4> ____ v8/buildtools at xxx
4>     You have unstaged changes.
4>     Please commit, stash, or reset.

解决方法,使用

gclient sync -f

1.如果碰到编译时tools/dev/v8gen.py x64.debug报错

################################################################################
/usr/bin/python -u tools/mb/mb.py gen -f infra/mb/mb_config.pyl -m developer_default -b x64.debug out.gn/x64.debug
  
  Writing """\
  is_debug = true
  target_cpu = "x64"
  v8_enable_backtrace = true
  v8_enable_slow_dchecks = true
  v8_optimized_debug = false
  """ to /home/r00t/v8/out.gn/x64.debug/args.gn.
  
  /home/r00t/v8/buildtools/linux64/gn gen out.gn/x64.debug --check
    -> returned 1
  ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned non-zero exit code.
      pkgresult = exec_script(pkg_config_script, args, "value")
                  ^----------
  Current dir: /home/r00t/v8/out.gn/x64.debug/
  Command: python /home/r00t/v8/build/config/linux/pkg-config.py -s /home/r00t/v8/build/linux/debian_sid_amd64-sysroot -a x64 glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0
  Returned 1.

执行如下命令

sudo apt-get update && sudo apt-get install pkg-config

如果编译时出现权限问题chmod 777即可

cd ..
sudo chmod 777 -R v8

 

编译的时候我的i7-9750,16G内存,1660ti的电脑风扇疯狂地转;b

 

posted @ 2020-02-10 14:44  5n1p3r0010  阅读(321)  评论(8编辑  收藏