KhronosGroup / OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
https://khronos.org/openxr
Apache License 2.0
679 stars 249 forks source link

Linux build error if python-markupsafe but not python-jinja installed #416

Open ChristophHaag opened 1 year ago

ChristophHaag commented 1 year ago

The SDK contains both external/python/jinja2 and external/python/markupsafe, which is used when both python-markupsafe and python-jinja are not installed.

If for example on archlinux python-markupsafe 2.1.3 is installed, but not python-jinja. Then the vendored jinja2 is taken, but apparently it is incompatible with the system's markupsafe:

Traceback (most recent call last):
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/include/openxr/../../specification/scripts/genxr.py", line 560, in <module>
Traceback (most recent call last):
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/include/openxr/../../specification/scripts/genxr.py", line 560, in <module>
    (gen, options) = genTarget(args)
                     ^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/include/openxr/../../specification/scripts/genxr.py", line 468, in genTarget
    (gen, options) = genTarget(args)
                     ^^^^^^^^^^^^^^^
    gen = createGenerator(errFile=errWarn,
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/include/openxr/../../specification/scripts/genxr.py", line 468, in genTarget
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/specification/scripts/creflectiongenerator.py", line 72, in __init__
    self.env = make_jinja_environment(file_with_templates_as_sibs=__file__)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/specification/scripts/jinja_helpers.py", line 99, in make_jinja_environment
    gen = createGenerator(errFile=errWarn,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/specification/scripts/creflectiongenerator.py", line 72, in __init__
    from jinja2 import Environment, FileSystemLoader
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/__init__.py", line 33, in <module>
    self.env = make_jinja_environment(file_with_templates_as_sibs=__file__)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    from jinja2.environment import Environment, Template
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/specification/scripts/jinja_helpers.py", line 99, in make_jinja_environment
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/environment.py", line 15, in <module>
    from jinja2 import Environment, FileSystemLoader
    from jinja2 import nodes
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/__init__.py", line 33, in <module>
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
    from jinja2.environment import Environment, Template
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/utils.py", line 642, in <module>
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/utils.py", line 642, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/lib/python3.11/site-packages/markupsafe/__init__.py)
    from markupsafe import Markup, escape, soft_unicode
Traceback (most recent call last):
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/lib/python3.11/site-packages/markupsafe/__init__.py)
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/include/openxr/../../specification/scripts/genxr.py", line 560, in <module>
    (gen, options) = genTarget(args)
                     ^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/include/openxr/../../specification/scripts/genxr.py", line 468, in genTarget
    gen = createGenerator(errFile=errWarn,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/specification/scripts/creflectiongenerator.py", line 72, in __init__
    self.env = make_jinja_environment(file_with_templates_as_sibs=__file__)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/specification/scripts/jinja_helpers.py", line 99, in make_jinja_environment
    from jinja2 import Environment, FileSystemLoader
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/home/haagch-collabora/openxr-loader-git/src/openxr-loader/external/python/jinja2/utils.py", line 642, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/lib/python3.11/site-packages/markupsafe/__init__.py)
make[2]: *** [include/openxr/CMakeFiles/generate_openxr_header.dir/build.make:130: include/openxr/openxr_reflection_structs.h] Fehler 1

full build output

rpavlik commented 1 year ago

ugh, yeah, thanks for the ping on this. I think if I update the vendored versions it should fix this? Really hate that the Jinja folks broke compatibility in a minor version, which is the underlying problem here.

rpavlik-bot commented 1 year ago

An issue (number 2070) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#2070 ), to facilitate working group processes.

This GitHub issue will continue to be the main site of discussion.