提问人:unary 提问时间:12/2/2022 最后编辑:karelunary 更新时间:6/29/2023 访问量:832
如何摆脱构建 Chromium 时的 gn gen 错误?
How to get rid of gn gen error while building Chromium?
问:
我试图找到这个特定错误的原因,但我真的不明白如何摆脱它。
k@k-virtual-machine:~/Documents/code/chromium/src$ gn gen out/Default
ERROR at //chrome/version.gni:114:11: Script returned non-zero exit code.
_result = exec_script("//build/util/version.py",
^----------
Current dir: /home/k/Documents/code/chromium/src/out/Default/
Command:python3 /home/k/Documents/code/chromium/src/build/util/version.py -f ../../chrome/VERSION -t full = "@MAJOR@.@MINOR@.@BUILD@.@PATCH@" major = "@MAJOR@" minor = "@MINOR@" build = "@BUILD@" patch = "@PATCH@" --os linux
Returned 1.
stderr:
Traceback (most recent call last):
File "/home/k/Documents/code/chromium/src/build/util/version.py", line 267, in <module>
sys.exit(main())
File "/home/k/Documents/code/chromium/src/build/util/version.py", line 256, in main
output = BuildOutput(sys.argv[1:])
File "/home/k/Documents/code/chromium/src/build/util/version.py", line 248, in BuildOutput
values = GenerateValues(options, evals)
File "/home/k/Documents/code/chromium/src/build/util/version.py", line 198, in GenerateValues
values = FetchValues(options.file, options.official)
File "/home/k/Documents/code/chromium/src/build/util/version.py", line 62, in FetchValues
FetchValuesFromFile(lastchange_values, lastchange_filename)
File "/home/k/Documents/code/chromium/src/build/util/version.py", line 29, in FetchValuesFromFile
with open(file_name, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/k/Documents/code/chromium/src/build/util/LASTCHANGE'
See //ui/gl/features.gni:8:1: whence it was imported.
import("//chrome/version.gni")
^----------------------------
See //BUILD.gn:35:1: whence it was imported.
import("//ui/gl/features.gni")
^----------------------------**
答:
1赞
Haytham
4/9/2023
#1
我遇到了同样的问题,我通过以下步骤修复了它:
- 转到 /src/build/util
- 运行 lastchange.py 脚本(python3 lastchange.py LASTCHANGE.dummy)
- 此脚本将生成一个名为 LASTCHANGE.dummy.committime 的新文件
- 将其重命名为 LASTCHANGE.committime
- 如果仍然缺少 LASTCHANGE 文件,请创建 LASTCHANGE.committime 的副本并将其重命名为 LASTCHANGE
这应该可以修复错误
评论
0赞
Mikael
5/14/2023
这并不能解决我的错误。我得到这个(比上一个错误少了 2 行):看起来它需要一个键值对。File ".../chromium/src/build/util/version.py", line 30, in FetchValuesFromFile key, val = line.rstrip('\r\n').split('=', 1)
0赞
Volodymyr Shalashenko
6/29/2023
#2
您可以在 src/build/util 目录下手动创建两个文件:LASTCHANGE,包含以下代码
LASTCHANGE=0
LASTCHANGE_YEAR=1970
和 LASTCHANGE.committime 包含
0
那么它应该可以工作。
评论
gclient sync