简体   繁体   中英

I collect chromium for VM, TypeError: the JSON object must be str, not 'bytes'

after this command: $ autoninja -C out/Default chrome deduces this error, how to fix? Help me please

[2549/55054] ACTION //gpu/config:process_json(//build/toolchain/linux:clang_x64)
FAILED: gen/gpu/config/gpu_driver_bug_list_arrays_and_structs_autogen.h gen/gpu/config/gpu_driver_bug_list_autogen.cc gen/gpu/config/gpu_driver_bug_list_autogen.h gen/gpu/config/gpu_driver_bug_list_exceptions_autogen.h gen/gpu/config/software_rendering_list_arrays_and_structs_autogen.h gen/gpu/config/software_rendering_list_autogen.cc gen/gpu/config/software_rendering_list_autogen.h gen/gpu/config/software_rendering_list_exceptions_autogen.h 
python3 ../../gpu/config/process_json.py --output-dir gen/gpu/config --skip-testing-data --os-filter linux
Traceback (most recent call last):
  File "../../gpu/config/process_json.py", line 1061, in <module>
    sys.exit(main(sys.argv[1:]))
  File "../../gpu/config/process_json.py", line 1036, in main
    script_dir, options.output_dir, options.os_filter)
  File "../../gpu/config/process_json.py", line 925, in process_software_rendering_list
    'Software')
  File "../../gpu/config/process_json.py", line 832, in process_json_file
    json_data = json.load(json_file)
  File "/usr/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
[2552/55054] CXX obj/skia/skia_core_and_effects/SkReadBuffer.o
ninja: build stopped: subcommand failed.

Help me

After digging into the problem, I found that the problem is in the Python version. I was using 3.5.2, which is the latest version for Ubuntu 16.04 LTS. But it is not sufficient for building recent versions of Chromium as it seems to require at least 3.7 or above (this comment is not based on any official docs, it is just my guess.)

First check your python3 version with python3 --version . If it is the case, upgrade your Linux distro and run build/install-build-deps.sh .

Alternatively, update python3 only with the following commands:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.9
sudo ln -sf /usr/bin/python3.9 /usr/bin/python3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM