ungoogled-software / ungoogled-chromium-portablelinux

Portable Linux packaging for ungoogled-chromium
97 stars 30 forks source link

Build fails under archlinux #87

Closed jstkdng closed 3 years ago

jstkdng commented 3 years ago

Could be a problem since arch has python 3.9 and not 3.5

Done. Made 13997 targets from 2412 files in 3911ms
+ ninja -C out/Default chrome chrome_sandbox chromedriver
ninja: Entering directory `out/Default'
[224/43824] ACTION //chrome/common/apps/platform_apps/api...chema_generator(//build/toolchain/linux/unbundle:default)
/tmp/build/ungoogled-chromium-portablelinux/build/src/tools/json_schema_compiler/model.py:211: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if name is 'ManifestKeys':
[365/43824] ACTION //chrome/browser/resources/print_preview:preprocess(//build/toolchain/linux/unbundle:default)
FAILED: gen/chrome/browser/resources/print_preview/preprocessed/print_preview.html gen/chrome/browser/resources/print_preview/preprocessed/cloud_print_interface.js gen/chrome/browser/resources/print_preview/preprocessed/cloud_print_interface_impl.js gen/chrome/browser/resources/print_preview/preprocessed/dark_mode_behavior.js gen/chrome/browser/resources/print_preview/preprocessed/metrics.js gen/chrome/browser/resources/print_preview/preprocessed/native_layer.js gen/chrome/browser/resources/print_preview/preprocessed/print_preview.js gen/chrome/browser/resources/print_preview/preprocessed/print_preview_utils.js gen/chrome/browser/resources/print_preview/preprocessed/data/cloud_parsers.js gen/chrome/browser/resources/print_preview/preprocessed/data/coordinate2d.js gen/chrome/browser/resources/print_preview/preprocessed/data/destination.js gen/chrome/browser/resources/print_preview/preprocessed/data/destination_match.js gen/chrome/browser/resources/print_preview/preprocessed/data/destination_policies.js gen/chrome/browser/resources/print_preview/preprocessed/data/destination_store.js gen/chrome/browser/resources/print_preview/preprocessed/data/document_info.js gen/chrome/browser/resources/print_preview/preprocessed/data/invitation.js gen/chrome/browser/resources/print_preview/preprocessed/data/invitation_store.js gen/chrome/browser/resources/print_preview/preprocessed/data/local_parsers.js gen/chrome/browser/resources/print_preview/preprocessed/data/margins.js gen/chrome/browser/resources/print_preview/preprocessed/data/measurement_system.js gen/chrome/browser/resources/print_preview/preprocessed/data/model.js gen/chrome/browser/resources/print_preview/preprocessed/data/printable_area.js gen/chrome/browser/resources/print_preview/preprocessed/data/scaling.js gen/chrome/browser/resources/print_preview/preprocessed/data/size.js gen/chrome/browser/resources/print_preview/preprocessed/data/state.js gen/chrome/browser/resources/print_preview/preprocessed/data/user_manager.js gen/chrome/browser/resources/print_preview/preprocessed/ui/highlight_utils.js gen/chrome/browser/resources/print_preview/preprocessed/ui/input_behavior.js gen/chrome/browser/resources/print_preview/preprocessed/ui/plugin_proxy.js gen/chrome/browser/resources/print_preview/preprocessed/ui/select_behavior.js gen/chrome/browser/resources/print_preview/preprocessed/ui/settings_behavior.js gen/chrome/browser/resources/print_preview/preprocessed_manifest.json
python ../../tools/grit/preprocess_grit.py --in-folder ../../chrome/browser/resources/print_preview/ --out-folder gen/chrome/browser/resources/print_preview/preprocessed --in-files print_preview.html cloud_print_interface.js cloud_print_interface_impl.js dark_mode_behavior.js metrics.js native_layer.js print_preview.js print_preview_utils.js data/cloud_parsers.js data/coordinate2d.js data/destination.js data/destination_match.js data/destination_policies.js data/destination_store.js data/document_info.js data/invitation.js data/invitation_store.js data/local_parsers.js data/margins.js data/measurement_system.js data/model.js data/printable_area.js data/scaling.js data/size.js data/state.js data/user_manager.js ui/highlight_utils.js ui/input_behavior.js ui/plugin_proxy.js ui/select_behavior.js ui/settings_behavior.js -D scale_factors=2x -D _chromium -E CHROMIUM_BUILD=chromium -D desktop_linux -D toolkit_views -D use_aura -D use_nss_certs -D use_ozone --out-manifest gen/chrome/browser/resources/print_preview/preprocessed_manifest.json
Traceback (most recent call last):
  File "/tmp/build/ungoogled-chromium-portablelinux/build/src/out/Default/../../tools/grit/preprocess_grit.py", line 101, in <module>
    main(sys.argv[1:])
  File "/tmp/build/ungoogled-chromium-portablelinux/build/src/out/Default/../../tools/grit/preprocess_grit.py", line 96, in main
    json.dump(manifest_data, manifest_file)
  File "/usr/lib/python3.9/json/__init__.py", line 180, in dump
    fp.write(chunk)
TypeError: a bytes-like object is required, not 'str'
[382/43824] ACTION //chrome/browser/metrics:expired_histograms_array(//build/toolchain/linux/unbundle:default)
ninja: build stopped: subcommand failed.
./build.sh  432.05s user 23.02s system 226% cpu 3:20.49 total
wchen342 commented 3 years ago

Maybe it's not python version? Fedora 33 has python 3.9 and rpm builds fine. I didn't find any patch modifing preprocess_grit.py too.

jstkdng commented 3 years ago

I think those scripts were meant to run in python2 instead of just python. In arch the python binary defaults to 3.9 so it is failing. Might need a patch for that or a sed oneliner, like on arch's PKGBUILD.

  # Force script incompatible with Python 3 to use /usr/bin/python2
  sed -i '1s|python$|&2|' third_party/dom_distiller_js/protoc_plugins/*.py
wchen342 commented 3 years ago

Yeah you are right. In the fedora build file there is this line

find -type f -exec sed -iE '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!%{__python2}=' {} +

so it basically forces every script to use python2.

jstkdng commented 3 years ago

that works for standalone scripts that have a shebang, but most stuff is run by ninja and ninja is using python and not python2

wchen342 commented 3 years ago

If it's getting complicated with python versions and I do not want to deal with it I usually just create a virtualenv/conda environment. It almost always works.

jstkdng commented 3 years ago

How funny, I was just testing that, great minds think alike it seems. It's much easier to create a virtualenv than to use a ubuntu container. If that works I'll close this issue. Using a venv for distros that have python pointing to python3 should be on the docs tbh.

jstkdng commented 3 years ago

alright, build finished without a problem.