david-vanderson / dvui

Other
349 stars 26 forks source link

Cannot build SDL examples <- Cannot build SDL from Zig build source #131

Open iacore opened 1 day ago

iacore commented 1 day ago

When I try to run zig build sdl-ontop or zig build sdl-standalone, I see the following error:

❯ zig build sdl-standalone
sdl-standalone
└─ run sdl-standalone
   └─ compile-sdl-standalone
      └─ install sdl-standalone
         └─ zig build-exe sdl-standalone Debug native
            └─ zig build-lib SDL2 Debug native 1 errors
/home/user/.cache/zig/p/1220bdd8cfd7740aa9f8cce7679824a17b364ff5a34698aa2c1c75ea77e0df15a3b1/include/SDL_opengles.h:33:10: error: 'GLES/gl.h' file not found
#include <GLES/gl.h>
         ^~~~~~~~~~~~
/home/user/.cache/zig/p/1220bdd8cfd7740aa9f8cce7679824a17b364ff5a34698aa2c1c75ea77e0df15a3b1/src/render/opengles/SDL_render_gles.c:27:10: note: in file included from /home/user/.cache/zig/p/1220bdd8cfd7740aa9f8cce7679824a17b364ff5a34698aa2c1c75ea77e0df15a3b1/src/render/opengles/SDL_render_gles.c:27:
#include "SDL_opengles.h"

Here are my headers.

❯ ls /usr/include/G
…include/GL/        …include/GLES2/  …include/GLFW/          
…include/Glacier2/  …include/GLES3/  …include/GraphicsMagick/

I don't have GLES/gl.h.

iacore commented 1 day ago

This works: zig build sdl-standalone -fsys=sdl2.

VisenDev commented 1 day ago

This was discussed extensively here https://github.com/david-vanderson/dvui/issues/117

It seems to be an allyourcodebase/sdl issue building on linux

david-vanderson commented 1 day ago

Recently we started compiling SDL on linux by default. Before we always assumed SDL was already installed (same as passing -fsys=sdl2 now).

I haven't looked into this very much. I suspect one of 2 things is happening:

  1. Standard SDL wouldn't compile anyway due to the missing header, or
  2. Standard SDL configure would figure out which of the headers you do have it could use, and tweak some compilation options. If that is the case, then https://github.com/allyourcodebase/SDL needs those smarts added to its build.zig