错误如下:
autoninja -C out/Release chrome
"D:\dev\depot_tools\ninja.exe" -C out/Release chrome -j 10
ninja: Entering directory `out/Release'
[5/25580] ACTION //chrome/browser/resources/tab_search:build(//build/toolchain/win:win_clang_x64)
FAILED: gen/chrome/browser/resources/tab_search/tab_search.rollup.js gen/chrome/browser/resources/tab_search/build_manifest.json
D:/dev/depot_tools/bootstrap-2@3_8_10_chromium_17_bin/python3/bin/python3.exe ../../chrome/browser/resources/tools/optimize_webui.py --host tab-search.top-chrome --input gen/chrome/browser/resources/tab_search/preprocessed --out_folder gen/chrome/browser/resources/tab_search --depfile gen/chrome/browser/resources/tab_search/build.d --js_out_files tab_search.rollup.js --exclude chrome://resources/js/cr.m.js chrome://resources/mojo/mojo/public/js/bindings.js chrome://resources/mojo/mojo/public/mojom/base/time.mojom-webui.js fuse.js --external_paths chrome://resources/polymer/v3_0/|../../third_party/polymer/v3_0/components-chromium/ chrome://resources/|gen/ui/webui/resources/preprocessed/ --js_module_in_files tab_search.js --out-manifest gen/chrome/browser/resources/tab_search/build_manifest.json
Traceback (most recent call last):
File "../../chrome/browser/resources/tools/optimize_webui.py", line 273, in <module>
main(sys.argv[1:])
File "../../chrome/browser/resources/tools/optimize_webui.py", line 253, in main
manifest_out_path = _optimize(args.input, args)
File "../../chrome/browser/resources/tools/optimize_webui.py", line 207, in _optimize
bundled_paths = _bundle_v3(tmp_out_dir, in_path, out_path,
File "../../chrome/browser/resources/tools/optimize_webui.py", line 183, in _bundle_v3
output = f.read()
UnicodeDecodeError: 'gb18030' codec can't decode byte 0xa2 in position 133561: illegal multibyte sequence
[7/25580] ACTION //chrome/browser/resources/new_tab_page:optimized_js(//build/toolchain/win:win_clang_x64)
FAILED: gen/chrome/browser/resources/new_tab_page/new_tab_page.rollup.js gen/chrome/browser/resources/new_tab_page/lazy_load.rollup.js gen/chrome/browser/resources/new_tab_page/shared.rollup.js gen/chrome/browser/resources/new_tab_page/build_manifest.json
D:/dev/depot_tools/bootstrap-2@3_8_10_chromium_17_bin/python3/bin/python3.exe ../../chrome/browser/resources/tools/optimize_webui.py --host new-tab-page --input gen/chrome/browser/resources/new_tab_page/preprocessed --out_folder gen/chrome/browser/resources/new_tab_page --depfile gen/chrome/browser/resources/new_tab_page/optimized_js.d --js_out_files new_tab_page.rollup.js lazy_load.rollup.js shared.rollup.js --exclude chrome://resources/js/cr.m.js chrome://resources/mojo/mojo/public/js/bindings.js chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js chrome://resources/mojo/mojo/public/mojom/base/big_buffer.mojom-lite.js chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-lite.js chrome://resources/mojo/mojo/public/mojom/base/text_direction.mojom-lite.js chrome://resources/mojo/mojo/public/mojom/base/time.mojom-lite.js chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js chrome://resources/mojo/skia/public/mojom/skcolor.mojom-lite.js chrome://resources/mojo/skia/public/mojom/skcolor.mojom-webui.js chrome://resources/mojo/url/mojom/origin.mojom-lite.js chrome://resources/mojo/url/mojom/url.mojom-lite.js new_tab_page.mojom-lite.js realbox/realbox.mojom-lite.js promo_browser_command.mojom-lite.js modules/drive/drive.mojom-lite.js modules/task_module/task_module.mojom-lite.js foo.mojom-lite.js modules/cart/chrome_cart.mojom-lite.js --external_paths chrome://resources/polymer/v3_0/|../../third_party/polymer/v3_0/components-chromium/ chrome://resources/|gen/ui/webui/resources/preprocessed/ --js_module_in_files new_tab_page.js lazy_load.js --out-manifest gen/chrome/browser/resources/new_tab_page/build_manifest.json
Traceback (most recent call last):
File "../../chrome/browser/resources/tools/optimize_webui.py", line 273, in <module>
main(sys.argv[1:])
File "../../chrome/browser/resources/tools/optimize_webui.py", line 253, in main
manifest_out_path = _optimize(args.input, args)
File "../../chrome/browser/resources/tools/optimize_webui.py", line 207, in _optimize
bundled_paths = _bundle_v3(tmp_out_dir, in_path, out_path,
File "../../chrome/browser/resources/tools/optimize_webui.py", line 183, in _bundle_v3
output = f.read()
UnicodeDecodeError: 'gb18030' codec can't decode byte 0xa2 in position 220443: illegal multibyte sequence
[14/25580] ACTION //chrome/browser/resources/settings:build(//build/toolchain/win:win_clang_x64)
ninja: build stopped: subcommand failed.
参考的网址
https://w-run.com/other/Chromium1/
https://www.huaweicloud.com/articles/f3dc1b1666cf4c11c0c7e5824317f1c0.html
解决方法:
修改src/chrome/browser/resources/tools/optimize_webui.py下,
for bundled_file in bundled_paths:
with open(bundled_file, 'r') as f:
output = f.read()
assert "<if expr" not in output, \
'Unexpected <if expr> found in bundled output. Check that all ' + \
'input files using such expressions are preprocessed.'
改为
for bundled_file in bundled_paths:
with open(bundled_file, 'r', encoding='gb18030', errors='ignore') as f:
output = f.read()
assert "<if expr" not in output, \
'Unexpected <if expr> found in bundled output. Check that all ' + \
'input files using such expressions are preprocessed.'