简体   繁体   English

如何解决TemplateRuntimeError:编译铬时没有名为'>'的测试?

[英]How to solve TemplateRuntimeError: no test named '>' when compile chromium?

When compile chromium, I get the following error messages:编译铬时,我收到以下错误消息:

ninja: Entering directory `out/Cros'
[44/32769] ACTION //components/exo/wayland/compatibility_test:generated_client_event_receiver_version_tests(//build/toolchain/linux:clang_x64)
FAILED: gen/components/exo/wayland/compatibility_test/all_generated_client_event_receiver_version_tests.cc 
python3 ../../components/exo/wayland/compatibility_test/wayland_protocol_codegen.py ../../third_party ../../buildtools/linux64/clang-format ../../components/exo/wayland/compatibility_test/template_client_event_receiver_version_tests.cc.tmpl gen/components/exo/wayland/compatibility_test/all_generated_client_event_receiver_version_tests.cc ../../components/exo/wayland/protocol/aura-shell.xml ../../third_party/wayland/src/protocol/wayland.xml ../../third_party/wayland-protocols/src/stable/presentation-time/presentation-time.xml ../../third_party/wayland-protocols/src/stable/viewporter/viewporter.xml ../../third_party/wayland-protocols/src/stable/xdg-shell/xdg-shell.xml ../../third_party/wayland-protocols/src/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/input-timestamps/input-timestamps-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/relative-pointer/relative-pointer-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/text-input/text-input-unstable-v1.xml ../../third_party/wayland-protocols/src/unstable/xdg-shell/xdg-shell-unstable-v6.xml ../../third_party/wayland-protocols/unstable/alpha-compositing/alpha-compositing-unstable-v1.xml ../../third_party/wayland-protocols/unstable/color-space/color-space-unstable-v1.xml ../../third_party/wayland-protocols/unstable/cursor-shapes/cursor-shapes-unstable-v1.xml ../../third_party/wayland-protocols/unstable/gaming-input/gaming-input-unstable-v2.xml ../../third_party/wayland-protocols/unstable/keyboard/keyboard-configuration-unstable-v1.xml ../../third_party/wayland-protocols/unstable/keyboard/keyboard-extension-unstable-v1.xml ../../third_party/wayland-protocols/unstable/notification-shell/notification-shell-unstable-v1.xml ../../third_party/wayland-protocols/unstable/remote-shell/remote-shell-unstable-v1.xml ../../third_party/wayland-protocols/unstable/secure-output/secure-output-unstable-v1.xml ../../third_party/wayland-protocols/unstable/stylus/stylus-unstable-v2.xml ../../third_party/wayland-protocols/unstable/stylus-tools/stylus-tools-unstable-v1.xml ../../third_party/wayland-protocols/unstable/vsync-feedback/vsync-feedback-unstable-v1.xml
Traceback (most recent call last):
  File "../../components/exo/wayland/compatibility_test/wayland_protocol_codegen.py", line 120, in <module>
    main()
  File "../../components/exo/wayland/compatibility_test/wayland_protocol_codegen.py", line 111, in main
    expanded = expand_template(args.template,
  File "../../components/exo/wayland/compatibility_test/wayland_protocol_codegen.py", line 58, in expand_template
    return env.get_template(os.path.basename(template)).render(context)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "../../components/exo/wayland/compatibility_test/template_client_event_receiver_version_tests.cc.tmpl", line 32, in <module>
    {% if interface.events|selectattr("since")|selectattr("since", ">", min_version)|list|length %}
  File "/usr/lib/python3/dist-packages/jinja2/filters.py", line 750, in do_list
    return list(value)
  File "/usr/lib/python3/dist-packages/jinja2/filters.py", line 942, in _select_or_reject
    if modfunc(func(transfunc(item))):
  File "/usr/lib/python3/dist-packages/jinja2/filters.py", line 935, in <lambda>
    func = lambda item: context.environment.call_test(
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 449, in call_test
    raise TemplateRuntimeError('no test named %r' % name)
jinja2.exceptions.TemplateRuntimeError: no test named '>'
[61/32769] CXX obj/mojo/public/tools/fuzzers/fuzz_mojom_blink/fuzz.mojom-blink.o
ninja: build stopped: subcommand failed.

I was not sure if it's related to the version of jinja2.我不确定它是否与 jinja2 的版本有关。 And mine is v2.8 for sure.我的肯定是v2.8。

autoninja -C out/Default is OK with me. autoninja -C out/Default对我来说没问题。 This question appears when I try to compile CrOS on my Ubuntu 16.04.当我尝试在 Ubuntu 16.04 上编译 CrOS 时,会出现此问题。

And autoninja -C out/Cros chrome is also fine. autoninja -C out/Cros chrome也很好。 @_@ @_@

Find the reason.找出原因。 It was because that ninja used jinja2 in the system instead of the version under src/third_party dir.因为那个忍者在系统中使用的是jinja2,而不是src/third_party目录下的版本。

I solved this problem by uninstalling system jinja2.我通过卸载系统 jinja2 解决了这个问题。

Thanks for the guidance of tikuta@chromium.org.感谢 tikuta@chromium.org 的指导。 \o/ \o/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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