Dav1dde / glad

Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.
https://glad.dav1d.de/
Other
3.79k stars 448 forks source link

Glad fails on Windows with Python 3.9 #401

Closed Janrupf closed 1 year ago

Janrupf commented 1 year ago

Running Glad via CMake (Generator Ninja) yields the following crash:

Generating with args --out-path C:/Projects/MathAnimation/cmake-build-debug/Animations/vendor/gladsources/glad --api gl:core=4.2 c 
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Projects\MathAnimation\Animations\vendor\glad\glad\__main__.py", line 194, in <module>
    main()
  File "C:\Projects\MathAnimation\Animations\vendor\glad\glad\__main__.py", line 128, in main
    generators = find_generators()
  File "C:\Projects\MathAnimation\Animations\vendor\glad\glad\plugin.py", line 42, in find_generators
    for entry_point in entry_points(group=entry_point):
  File "C:\Projects\MathAnimation\Animations\vendor\glad\glad\plugin.py", line 11, in entry_points
    return _entry_points()[group]
KeyError: 'glad.generator'

System: Windows 10 Build system: CMake Generator: Ninja

Glad is invoked via:

add_subdirectory(glad/cmake)
glad_add_library(glad STATIC API gl:core=4.2)

Used commit: f237a2bfcec0d9b82b90ec9af4af265c40de7183

Dav1dde commented 1 year ago

Thanks, this slipped through the cracks in testing.

Tremah commented 1 year ago

I can second this bug. I just tried to build glad2 into a static library. Here is my toolchain IDE: CLion Compiler: mingw64 9.0 Cmake: 3.24 OS: Windows 10, latest SR

The errors @Janrupf is getting are exactly the same as the ones I get.

Janrupf commented 1 year ago

Should be fixed by now, are you getting this with the latest glad2 commit? https://github.com/Dav1dde/glad/commit/e576e95d95ad407084f61ec02e1d3823d7b06c9f fixed it for me

Tremah commented 1 year ago

i updated the repository but i am getting another error now:

Traceback (most recent call last):
  File "C:\coding\python3_10\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\coding\python3_10\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "X:\workspace\LucyEngine\dependencies\glad\glad\__main__.py", line 17, in <module>
    from glad.generator import GenerationInfo
  File "X:\workspace\LucyEngine\dependencies\glad\glad\generator\__init__.py", line 7, in <module>
    from jinja2 import Environment, ChoiceLoader, PackageLoader
ModuleNotFoundError: No module named 'jinja2'

Seems to be, that my python installation is missing "jinja2"

Dav1dde commented 1 year ago

@Tremah yes, glad2 does require jinja2.

I usually recommend to not integrate glad into the build process of your binary but instead just include pre-generated headers and source files. Less dependencies and faster compilations.

Tremah commented 1 year ago

@Dav1dde The python installation was corrupt, for whatever reason. It has been working fine now. I made a small custom CmakeLists.txt and it works very smooth. Thanks for this library and all your effort!