编译chromium错误小记

环境 win11 vs2019
如果源码拉下来的话,那么错误也不算多。
多一些python2语法的脚本但是用的python3执行的。
简单的比如str和bytes的转换就不说了
看下面一个错误

Traceback (most recent call last):
  File "../../build/rust/run_build_script.py", line 182, in 
    sys.exit(main())
  File "../../build/rust/run_build_script.py", line 103, in main
    env["HOST"] = host_triple(rustc_path)
  File "../../build/rust/run_build_script.py", line 58, in host_triple
    for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"):
LookupError: unknown encoding: bytes

解决方法如下:

  args = [rustc_path, "-vV"]
  known_vars = dict()
  proc = subprocess.Popen(args, stdout=subprocess.PIPE)
  # for line in io.TextIOWrapper(proc.stdout, encoding="utf-8"):
  for line in proc.stdout:
    m = RUSTC_VERSION_LINE.match(line.rstrip())
    if m:
      known_vars[m.group(1)] = m.group(2)
  return known_vars["host"]

你可能感兴趣的:(笔记,python,chromium编译)