LoginSignup
0
0

More than 1 year has passed since last update.

V8でHello Worldできないメモ

Last updated at Posted at 2021-10-28

これに沿ってHello Worldしたい。
環境はUbuntu20.04。

まずはdepot_toolsの設定。

~ desktop
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=/home/user/desktop/depot_tools:$PATH

これだと次のgclientCommand not foundになってしまった。
"$PATH"にすればうまくいった。
参考: https://qiita.com/pirosikick/items/d5a96f8875313907db35#depot_tools-%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB

$ export PATH=/home/user/desktop/depot_tools:"$PATH"

gclientができるか確かめる。

$ gclient

depot_toolsfetchを使ってV8を下ろしてくる。

$ mkdir ~/v8
$ cd ~/v8
$ fetch v8
$ cd v8

ちなみに$ git clone git@github.com:v8/v8.gitでやると次のcheckoutができなかった。
sample/hello-world.ccはあるのでHello Worldするだけなら問題ないかもしれないがWebAssembly moduleを生成するコードがある点がチェックアウト先と異なるのでどうなるかわからない。
https://github.com/v8/v8/blob/17a99fec258bcc07ea9fc5e4fabcce259751db03/samples/hello-world.cc#L59

checkoutする。

~ /v8/v8
$ git checkout refs/tags/7.1.11 -b sample -t

一応syncしておく。

$ gclient sync

ここからが問題。
$ tools/dev/v8gen.py x64.release.sampleするも以下のエラーが出る。

$ tools/dev/v8gen.py x64.release.sample
  File "tools/dev/v8gen.py", line 147
    print '%s does not exist in %s for %s' % (
          ^
SyntaxError: invalid syntax

SyntaxErrorなのでPythonのバージョンの違いと察してpython2を入れて実行してみる。

$ sudo apt install python2
$ python2 tools/dev/v8gen.py x64.debug
...
Hint: You can raise verbosity (-vv) to see the output of failed commands.

Traceback (most recent call last):
  File "tools/dev/v8gen.py", line 304, in <module>
    sys.exit(gen.main())
  File "tools/dev/v8gen.py", line 298, in main
    return self._options.func()
  File "tools/dev/v8gen.py", line 166, in cmd_gen
    gn_outdir,
  File "tools/dev/v8gen.py", line 208, in _call_cmd
    stderr=subprocess.STDOUT,
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/usr/bin/python2', '-u', 'tools/mb/mb.py', 'gen', '-f', 'infra/mb/mb_config.pyl', '-m', 'developer_default', '-b', 'x64.debug', 'out.gn/x64.debug']' returned non-zero exit status 1

CalledProcessErrorが発生してしまう。
V8のコードを以下の記事を参考にしつつPython3でも動くようにいじったがそれでも失敗。

$ tools/dev/v8gen.py x64.debug
Traceback (most recent call last):
  File "tools/dev/v8gen.py", line 304, in <module>
    sys.exit(gen.main())
  File "tools/dev/v8gen.py", line 298, in main
    return self._options.func()
  File "tools/dev/v8gen.py", line 159, in cmd_gen
    self._call_cmd([
  File "tools/dev/v8gen.py", line 206, in _call_cmd
    output = subprocess.check_output(
  File "/home/user/anaconda3/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/user/anaconda3/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/user/anaconda3/bin/python', '-u', 'tools/mb/mb.py', 'gen', '-f', 'infra/mb/mb_config.pyl', '-m', 'developer_default', '-b', 'x64.debug', 'out.gn/x64.debug']' returned non-zero exit status 1.

よくわからない。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0