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

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

编译 chromium 时,出现以下错误信息:

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.

不知道是不是和jinja2的版本有关。 我的肯定是 v2.8。

autoninja -C out/Default 我觉得没问题。 当我尝试在 Ubuntu 16.04.

上编译 CrOS 时出现此问题

autoninja -C out/Cros chrome也可以。 @_@

找原因! 是因为ninja在系统中使用的是jinja2,而不是src/third_party dir.

下的版本

我通过卸载系统jinja2解决了这个问题。

感谢tikuta@chromium.org的指导。 \o/