Bug 104551 - Check if Mako templates for Python are installed
Summary: Check if Mako templates for Python are installed
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: 17.3
Hardware: Other All
: medium normal
Assignee: Emil Velikov
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-09 10:58 UTC by Paul Menzel
Modified: 2018-01-17 22:59 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Paul Menzel 2018-01-09 10:58:44 UTC
It looks like with Mesa 17.3 Make templates for Python [1] are required. Currently, that dependency is not checked.

```
[…]
  CC       vulkan/vulkan_libanv_gen8_la-gen8_cmd_buffer.lo
  CC       vulkan/vulkan_libanv_gen8_la-genX_blorp_exec.lo
Traceback (most recent call last):
  File "/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/intel/vulkan/anv_icd.py", line 26, in <module>
    from anv_extensions import *
  File "/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/intel/vulkan/anv_extensions.py", line 32, in <mo
dule>
    from mako.template import Template
ImportError: No module named mako.template
  CC       vulkan/vulkan_libanv_gen8_la-genX_cmd_buffer.lo
  CC       vulkan/vulkan_libanv_gen8_la-genX_gpu_memcpy.lo
  CC       vulkan/vulkan_libanv_gen8_la-genX_pipeline.lo
  CC       vulkan/vulkan_libanv_gen8_la-genX_query.lo
  CC       vulkan/vulkan_libanv_gen8_la-genX_state.lo
  CC       vulkan/vulkan_libanv_gen9_la-gen8_cmd_buffer.lo
  CC       vulkan/vulkan_libanv_gen9_la-genX_blorp_exec.lo
  CC       vulkan/vulkan_libanv_gen9_la-genX_cmd_buffer.lo
Makefile:4833: recipe for target 'vulkan/dev_icd.json' failed
make[4]: *** [vulkan/dev_icd.json] Error 1
make[4]: *** Waiting for unfinished jobs....
[…]
```

[1] http://www.makotemplates.org/
Comment 1 Paul Menzel 2018-01-09 11:01:16 UTC
It looks like, the configure script actually checks for this.

```
checking if module mako in python is installed... No module named mako
no
```

But, it’s not aborting or reporting that it is actually needed.
Comment 2 Andrés Gómez García 2018-01-09 22:23:32 UTC
This is legit.

The problem is that

src/intel/vulkan/anv_icd.py

imports

src/intel/vulkan/anv_extensions.py

to get the MAX_API_VERSION symbol.

Since anv_extensions.py imports from mako, it fails in the release tarball.

I think we don't want to force having mako when compiling from the release tarball and it is not really needed.

I think we could just split MAX_API_VERSION and related to another Python file and import it from both, anv_extensions and anv_icd.

I'll look into this solution if nobody beats me to it...
Comment 3 Jason Ekstrand 2018-01-10 01:09:00 UTC
I'd rather not split things out into another file if we can help it.  Instead, we can just move the mako import to the "if __name__ == '__main__'" block and it won't get executed unless it's called directly to generate the C file.
Comment 4 Andrés Gómez García 2018-01-11 12:48:34 UTC
Fixed in master with:

commit a1901d092c053485cdfff0a65a83f9f0987ffc62
Author: Andres Gomez <agomez@igalia.com>
Date:   Wed Jan 10 23:11:51 2018 +0200

    anv: Import mako templates only during execution of anv_extensions
    
    anv_extensions usage from anv_icd was bringing the unwanted dependency
    of mako templates for the latter. We don't want that since it will
    force the dependency even for distributable tarballs which was not
    needed until now.
    
    Jason suggested this approach.
    
    v2: Patch simplification (Jason).
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104551
    Fixes: 0ab04ba979b ("anv: Use python to generate ICD json files")
    Cc: Jason Ekstrand <jason.ekstrand@intel.com>
    Cc: Emil Velikov <emil.velikov@collabora.com>
    Signed-off-by: Andres Gomez <agomez@igalia.com>
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Comment 5 Paul Menzel 2018-01-11 14:06:40 UTC
Thank you. I applied that commit to the 17.3.1 source, but I am still getting the same error. Supposedly, it’s only effecting how the next tarball will be created?
Comment 6 Paul Menzel 2018-01-11 14:47:56 UTC
Sorry, that was my bad. It’s now in a different file.

```
make[3]: Entering directory '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src/intel'
  GEN      vulkan/anv_entrypoints.c
  GEN      vulkan/anv_extensions.c
Traceback (most recent call last):
  File "/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/intel/vulkan/anv_entrypoints_gen.py", line 30, in <module>
    from mako.template import Template
ImportError: No module named mako.template
Makefile:4816: recipe for target 'vulkan/anv_entrypoints.c' failed
make[3]: *** [vulkan/anv_entrypoints.c] Error 1
make[3]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/intel/vulkan/anv_extensions.py", line 281, in <module>
    from mako.template import Template
ImportError: No module named mako.template
Makefile:4826: recipe for target 'vulkan/anv_extensions.c' failed
make[3]: *** [vulkan/anv_extensions.c] Error 1
make[3]: Leaving directory '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src/intel'
Makefile:860: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src'
Makefile:651: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src'
Makefile:658: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
```

Do you want me to create a separate issue for that?
Comment 7 Paul Menzel 2018-01-12 12:26:04 UTC
(In reply to Paul Menzel from comment #6)
> Sorry, that was my bad. It’s now in a different file.
> 
> ```
> make[3]: Entering directory
> '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src/intel'
>   GEN      vulkan/anv_entrypoints.c
>   GEN      vulkan/anv_extensions.c
> Traceback (most recent call last):
>   File
> "/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/intel/vulkan/
> anv_entrypoints_gen.py", line 30, in <module>
>     from mako.template import Template
> ImportError: No module named mako.template
> Makefile:4816: recipe for target 'vulkan/anv_entrypoints.c' failed
> make[3]: *** [vulkan/anv_entrypoints.c] Error 1
> make[3]: *** Waiting for unfinished jobs....
> Traceback (most recent call last):
>   File
> "/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/intel/vulkan/
> anv_extensions.py", line 281, in <module>
>     from mako.template import Template
> ImportError: No module named mako.template
> Makefile:4826: recipe for target 'vulkan/anv_extensions.c' failed
> make[3]: *** [vulkan/anv_extensions.c] Error 1
> make[3]: Leaving directory
> '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src/intel'
> Makefile:860: recipe for target 'all-recursive' failed
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory
> '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src'
> Makefile:651: recipe for target 'all' failed
> make[1]: *** [all] Error 2
> make[1]: Leaving directory
> '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src'
> Makefile:658: recipe for target 'all-recursive' failed
> make: *** [all-recursive] Error 1
> ```
> 
> Do you want me to create a separate issue for that?

I created bug #104601 [1] for that.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=104601
Comment 8 Andrés Gómez García 2018-01-17 22:50:06 UTC
(In reply to Paul Menzel from comment #7)
> > Do you want me to create a separate issue for that?
> 
> I created bug #104601 [1] for that.
> 
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=104601

Sorry for the delayed answer!

Thanks for that. I will take a look if anybody beats me to it.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.