Judsen  
                
                  
                    March 18, 2024,  4:05am
                   
                  1 
               
             
            
              Hey need some help getting raylib to work.GitHub - JudsenHembree/raylib-zig 
I am running wayland and am getting these macro errors with raylib. I’m operating under the assumption that I need to define these macros when building? How would I do that with zig build?
Or perhaps it’s something different.
Thanks for the help.
[jud@archlinux zigraylib]$ zig build
install
└─ install zigraylib
   └─ zig build-exe zigraylib Debug native
      └─ zig build-lib raylib Debug native 2 errors
/home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rglfw.c:57:10: error: "Cannot disable Wayland and X11 at the same time"
        #error "Cannot disable Wayland and X11 at the same time"
         ^
/home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/external/glfw/src/posix_poll.c:27:9: error: '_GNU_SOURCE' macro redefined
#define _GNU_SOURCE
        ^
/home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rglfw.c:99:14: note: in file included from /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rglfw.c:99:
    #include "external/glfw/src/posix_poll.c"
             ^
<command line>:4:9: note: previous definition is here
error: the following command failed with 2 compilation errors:
/home/jud/zig/zig build-lib -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rcore.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/utils.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/raudio.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rmodels.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rshapes.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rtext.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rtextures.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/rglfw.c -lGL -lX11 -ODebug -I /home/jud/.cache/zig/p/12206c51cec939451960806b303a22d3b978a698e9c68111a0faf02e646a523ae27c/src/external/glfw/include -I /usr/include -DPLATFORM_DESKTOP=1 -L /usr/lib -Mroot -lc --cache-dir /home/jud/code/zig/zigraylib/zig-cache --global-cache-dir /home/jud/.cache/zig --name raylib -static --listen=-
Build Summary: 4/8 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install zigraylib transitive failure
   └─ zig build-exe zigraylib Debug native transitive failure
      └─ zig build-lib raylib Debug native 2 errors
error: the following build command failed with exit code 1:
/home/jud/code/zig/zigraylib/zig-cache/o/c2a91b01b19ef56b2b79f1c9415cac5d/build /home/jud/zig/zig /home/jud/code/zig/zigraylib /home/jud/code/zig/zigraylib/zig-cache /home/jud/.cache/zig --seed 0x86722d6e -Z5187234154dd23f5
 
            
              
           
          
            
              
                Judsen  
              
                  
                    March 18, 2024,  4:07am
                   
                  2 
               
             
            
            
              
           
          
            
              
                Judsen  
              
                  
                    March 18, 2024,  4:12am
                   
                  3 
               
             
            
              and env
[jud@archlinux zigraylib]$ zig env
{
 "zig_exe": "/home/jud/zig/zig",
 "lib_dir": "/home/jud/zig/lib",
 "std_dir": "/home/jud/zig/lib/std",
 "global_cache_dir": "/home/jud/.cache/zig",
 "version": "0.12.0-dev.3191+9cf28d1e9",
 "target": "x86_64-linux.6.7.4...6.7.4-gnu.2.39",
 "env": {
  "ZIG_GLOBAL_CACHE_DIR": null,
  "ZIG_LOCAL_CACHE_DIR": null,
  "ZIG_LIB_DIR": null,
  "ZIG_LIBC": null,
  "ZIG_BUILD_RUNNER": null,
  "ZIG_VERBOSE_LINK": null,
  "ZIG_VERBOSE_CC": null,
  "ZIG_BTRFS_WORKAROUND": null,
  "ZIG_DEBUG_CMD": null,
  "CC": null,
  "NO_COLOR": null,
  "XDG_CACHE_HOME": null,
  "HOME": "/home/jud"
 }
}
 
            
              
           
          
            
              
                dimdin  
              
                  
                    March 18, 2024,  7:20am
                   
                  4 
               
             
            
              Hi @Judsen , welcome to ziggit 
Perhaps the posts in this thread, about versions and recent changes, can help:
  
  
    Here is a fairly minimal example that uses raylib with the zig package manager. 
I might add some more links/resources or maybe other examples as branches some other time. 
https://github.com/SimonLSchlee/zigraylib  
Currently it is created with only a few modifications from the default zig init-exe project, 
to make it easier to see what steps were required.
   
 
             
            
              2 Likes 
            
           
          
            
              
                Sze  
              
                  
                    March 18, 2024,  2:22pm
                   
                  5 
               
             
            
              So far I haven’t used wayland.
I think that should work, can you try if this works for you?
Searching for Code search results · GitHub 
if (options.use_wayland) {
    raylib.linkSystemLibrary("wayland-client");
    raylib.linkSystemLibrary("wayland-cursor");
    raylib.linkSystemLibrary("wayland-egl");
    raylib.linkSystemLibrary("xkbcommon");
    raylib.defineCMacro("USE_WAYLAND", null);
}
 
            
              2 Likes 
            
           
          
            
              
                Judsen  
              
                  
                    March 18, 2024,  5:04pm
                   
                  6 
               
             
            
              Good the author has replied lol. This was as close I could get to a dm lol.
I will try your debugging tonight. Thanks a bunch.
What you’ve shown seems plausible though.
             
            
              
           
          
            
              
                Judsen  
              
                  
                    March 18, 2024,  9:48pm
                   
                  7 
               
             
            
              tldr; No dice. Added these macros -DCUSTOMIZE_BUILD=1 -DUSE_WAYLAND=1 -DGLFW_BUILD_WAYLAND=1 -D_GLFW_WAYLAND=1 and tried to link wayland-client lib, but I’m just guessing at how to fix this. I did some research into the source code and haven’t been able to get it working yet.
Here is the build.zig for raylib where I add said macros.
                if (options.use_wayland) {
                    raylib.linkSystemLibrary("wayland-client");
                    raylib.defineCMacro("CUSTOMIZE_BUILD", null);
                    raylib.defineCMacro("USE_WAYLAND", null);
                    raylib.defineCMacro("GLFW_BUILD_WAYLAND", null);
                    raylib.defineCMacro("_GLFW_WAYLAND", null);
                } else {
                    raylib.linkSystemLibrary("X11");
                    raylib.defineCMacro("PLATFORM_DESKTOP", null);
                }
Here is my progress.
So I researched this macro you mentioned. USE_WAYLAND as far as I can tell from trying to grep it from the repo that documentation is defunct. It is not in the CMakeOptions.txt file mentioned.
So I looked for some alternatives and found some other wayland based flags. I tried to turn those on and got some different output.
[jud@archlinux zigraylib]$ zig build
install
└─ install zigraylib
   └─ zig build-exe zigraylib Debug native
      └─ zig build-lib raylib Debug native 1 errors
/home/jud/code/zig/zigraylib/raylib/src/external/glfw/src/wl_init.c:45:10: error: 'xdg-shell-client-protocol.h' file not found
#include "xdg-shell-client-protocol.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jud/code/zig/zigraylib/raylib/src/rglfw.c:107:18: note: in file included from /home/jud/code/zig/zigraylib/raylib/src/rglfw.c:107:
        #include "external/glfw/src/wl_init.c"
                 ^
error: the following command failed with 1 compilation errors:
/home/jud/zig/zig build-lib -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/rcore.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/utils.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/raudio.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/rmodels.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/rshapes.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/rtext.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/rtextures.c -cflags -std=gnu99 -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/jud/code/zig/zigraylib/raylib/src/rglfw.c -lGL -lwayland-client -ODebug -I /home/jud/code/zig/zigraylib/raylib/src/external/glfw/include -I /usr/include -DCUSTOMIZE_BUILD=1 -DUSE_WAYLAND=1 -DGLFW_BUILD_WAYLAND=1 -D_GLFW_WAYLAND=1 -L /usr/lib -Mroot -lc --cache-dir /home/jud/code/zig/zigraylib/zig-cache --global-cache-dir /home/jud/.cache/zig --name raylib -static --listen=-
Build Summary: 4/8 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install zigraylib transitive failure
   └─ zig build-exe zigraylib Debug native transitive failure
      └─ zig build-lib raylib Debug native 1 errors
error: the following build command failed with exit code 1:
/home/jud/code/zig/zigraylib/zig-cache/o/caa7e97dd1ba4dcd2acb0cdab67b8b1c/build /home/jud/zig/zig /home/jud/code/zig/zigraylib /home/jud/code/zig/zigraylib/zig-cache /home/jud/.cache/zig --seed 0x71fc7f90 -Z791432b6fe21b37a
So sure enough I don’t have that header file in /usr/include, however I’m having trouble finding it online.
It may be the case that I’m ahead of wayland development for raylib. If you are aware of how to get this header file do let me know. I will update this thread if I can get it working.
Thanks again,
github link again GitHub - JudsenHembree/raylib-zig 
             
            
              2 Likes 
            
           
          
            
              
                Judsen  
              
                  
                    March 18, 2024, 10:46pm
                   
                  8 
               
             
            
            
              
           
          
            
              
                Sze  
              
                  
                    March 19, 2024, 12:09am
                   
                  9 
               
             
            
              Hmm it seems the wiki is old, apparently USE_WAYLAND has been removed and now there is the GLFW_BUILD_WAYLAND option in the glfw cmake file CMake: Remove USE_WAYLAND option by M374LX · Pull Request #3851 · raysan5/raylib · GitHub 
I kind of wish raylib was bold enough to ditch cmake entirely and do everything with zig only, that way nobody would have to deal with cmake, but I guess a lot of c users are still used to it and using it, so sadly it is kind of unlikely.
Maybe it would make sense to try to build the library with cmake and then maybe use some verbose logging option to see what it ends up doing and then copy that with Zig?
Alternatively you could just build (possibly via cmake) a wayland raylib shared library and link to raylib dynamically. That is what I did before I used raylib as a zig dependency (minus the wayland part).
             
            
              
           
          
            
              
                Sze  
              
                  
                    March 19, 2024, 12:43am
                   
                  10 
               
             
            
              Have you tried simply updating the url+hash to the latest raylib commit?Fix GLFW runtime platform detection by M374LX · Pull Request #3863 · raysan5/raylib · GitHub  combined with this: raylib/src/build.zig at 9cf408f77c58828fd1019d5cd35c6b8c5139c8dc · raysan5/raylib · GitHub 
This here raylib/src/rglfw.c at master · raysan5/raylib · GitHub 
rglfw - raylib GLFW single file compilation
This file includes latest GLFW sources (GitHub - glfw/glfw: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input ) to be compiled together
 
Makes me think that updating to the newest version, should automatically get you a build that contains the different possible platforms and that automatically selects between x11 and wayland at runtime, but it also seems that this has been added relatively recently so it still might not be in my last version bump.
             
            
              
           
          
            
              
                Judsen  
              
                  
                    March 19, 2024,  2:01am
                   
                  11 
               
             
            
              I cloned master today, So I don’t believe that getting the most recent url/hash will perform any different.
Update: I can build with cmake
             
            
              
           
          
            
              
                Judsen  
              
                  
                    March 19, 2024,  2:25am
                   
                  12 
               
             
            
              
I think I need to do this in zig for it to work. I’ll look into zig subprocess calls.
Something like Zig Build System ⚡ Zig Programming Language 
             
            
              
           
          
            
              
                Judsen  
              
                  
                    March 21, 2024,  5:38am
                   
                  13 
               
             
            
              More progress but still not quite there.
I can now generate those files, but I’m getting undefined references still. I’m failing to link the libraries correctly somehow.
[jud@archlinux zigraylib]$ zig build
Adding GLFW include path
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/wayland-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/wayland-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/viewporter-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/viewporter-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/xdg-shell-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/xdg-shell-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/idle-inhibit-unstable-v1-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/idle-inhibit-unstable-v1-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/pointer-constraints-unstable-v1-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/pointer-constraints-unstable-v1-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/relative-pointer-unstable-v1-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/relative-pointer-unstable-v1-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/fractional-scale-v1-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/fractional-scale-v1-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/xdg-activation-v1-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/xdg-activation-v1-client-protocol-code.h
generating header_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/xdg-decoration-unstable-v1-client-protocol.h
generating code_file: /home/jud/code/zig/zigraylib/raylib/src/external/glfw/deps/wayland/xdg-decoration-unstable-v1-client-protocol-code.h
install
└─ install zigraylib
   └─ zig build-exe zigraylib Debug native 10 errors
error: ld.lld: undefined symbol: WindowShouldClose
    note: referenced by main.zig:35
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/90cfd8f984fe886cddf343b27d18fa59/zigraylib.o:(main.ray_main)
error: ld.lld: undefined symbol: GetTime
    note: referenced by main.zig:57
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/90cfd8f984fe886cddf343b27d18fa59/zigraylib.o:(main.ray_main)
    note: referenced by rgestures.h:515 (raylib/src/rgestures.h:515)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(rgGetCurrentTime) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
    note: referenced by rcore.c:832 (raylib/src/rcore.c:832)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(BeginDrawing) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
    note: referenced 6 more times
error: ld.lld: undefined symbol: InitPlatform
    note: referenced by rcore.c:624 (raylib/src/rcore.c:624)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(InitWindow) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: ld.lld: undefined symbol: ClosePlatform
    note: referenced by rcore.c:698 (raylib/src/rcore.c:698)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(CloseWindow) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: ld.lld: undefined symbol: GetWindowScaleDPI
    note: referenced by rcore.c:860 (raylib/src/rcore.c:860)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(EndDrawing) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
    note: referenced by rcore.c:930 (raylib/src/rcore.c:930)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(EndDrawing) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
    note: referenced by rcore.c:1796 (raylib/src/rcore.c:1796)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(TakeScreenshot) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
    note: referenced 1 more times
error: ld.lld: undefined symbol: SwapScreenBuffer
    note: referenced by rcore.c:884 (raylib/src/rcore.c:884)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(EndDrawing) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: ld.lld: undefined symbol: PollInputEvents
    note: referenced by rcore.c:905 (raylib/src/rcore.c:905)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(EndDrawing) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: ld.lld: undefined symbol: MaximizeWindow
    note: referenced by rcore.c:2649 (raylib/src/rcore.c:2649)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(PlayAutomationEvent) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: ld.lld: undefined symbol: MinimizeWindow
    note: referenced by rcore.c:2650 (raylib/src/rcore.c:2650)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(PlayAutomationEvent) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: ld.lld: undefined symbol: SetWindowSize
    note: referenced by rcore.c:2651 (raylib/src/rcore.c:2651)
    note:               /home/jud/code/zig/zigraylib/zig-cache/o/2764ec42a62ef6e8948f30abab0dd01b/rcore.o:(PlayAutomationEvent) in archive /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a
error: the following command failed with 10 compilation errors:
/home/jud/zig/zig build-exe /home/jud/code/zig/zigraylib/zig-cache/o/b35be95f6154e11a8ee7d6d581af13e5/libraylib.a -lwayland-client -fno-strip -ODebug -I /home/jud/code/zig/zigraylib/zig-cache/i/d6a4890bb3b5c5a8519255cc0736bf8a/include -Mroot=/home/jud/code/zig/zigraylib/src/main.zig -lGL -lc --cache-dir /home/jud/code/zig/zigraylib/zig-cache --global-cache-dir /home/jud/.cache/zig --name zigraylib --listen=-
Build Summary: 5/8 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install zigraylib transitive failure
   └─ zig build-exe zigraylib Debug native 10 errors
error: the following build command failed with exit code 1:
/home/jud/code/zig/zigraylib/zig-cache/o/6573ebc4219aa8ece5a29bd340f748f4/build /home/jud/zig/zig /home/jud/code/zig/zigraylib /home/jud/code/zig/zigraylib/zig-cache /home/jud/.cache/zig --seed 0xa8fe550b -Zd60982befe993609
will poke at it more later.
Github updated if anyone is following along.
             
            
              
           
          
            
              
                Sze  
              
                  
                    March 21, 2024,  5:39pm
                   
                  14 
               
             
            
              If you look at this it says Wayland API (experimental and incomplete):
  
  
    
    
      
          *     3. This notice may not be removed or altered from any source distribution. 
          * 
          **********************************************************************************************/ 
          //#define _GLFW_BUILD_DLL           // To build shared version 
          // Ref: http://www.glfw.org/docs/latest/compile.html#compile_manual 
          // Platform options: 
          // _GLFW_WIN32      to use the Win32 API 
          // _GLFW_X11        to use the X Window System 
          // _GLFW_WAYLAND    to use the Wayland API (experimental and incomplete) 
          // _GLFW_COCOA      to use the Cocoa frameworks 
          // 
          // On Linux, _GLFW_X11 and _GLFW_WAYLAND can be combined 
          //---------------------------------------------------------------------------------- 
          // Feature Test Macros required for this module 
          //---------------------------------------------------------------------------------- 
          #if (defined(__linux__) || defined(PLATFORM_WEB)) && (_POSIX_C_SOURCE < 199309L) 
              #undef _POSIX_C_SOURCE 
              #define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext. 
       
     
  
    
    
  
  
 
I think it would make most sense to get in contact with the people working on that wayland support and see if you can help them, if you want to do that, I think that would be more productive than trying to brute force your way there on your own.
So my suggestion would be to go on the raylib discord and ask there who works on wayland support and if you can join them / whether they have tricks or tips for you.
Another option would be to use something like Xwayland  to run an x11 application on wayland. (Until the wayland support is stable)
             
            
              
           
          
            
              
                Judsen  
              
                  
                    March 21, 2024,  6:57pm
                   
                  15 
               
             
            
              Fair enough.
I can do that. Thanks for the help.
             
            
              1 Like 
            
           
          
            
              
                Sze  
              
                  
                    March 23, 2024,  8:42pm
                   
                  17 
               
             
            
              Nice work.
             
            
              
           
          
            
              
                Judsen  
              
                  
                    April 12, 2024,  4:15am
                   
                  18 
               
             
            
              Apologies for leaving you hanging. Haven’t browsed the site recently.
I was a single macro off of compiling successfully. Once I swapped that in I was good to go. I believe it was the PLATFORM_DESKTOP one.
Do let me know if you ever want to review/merge my changes into your build.zig. I’ll go clean them up.
But I imagine wayland users are few and far between.
             
            
              
           
          
            
              
                Sze  
              
                  
                    April 12, 2024,  6:31am
                   
                  19 
               
             
            
              Upstream raylib had a few changes, its build.zig now has options for x11 and wayland, I haven’t updated yet but will soon, maybe with that it will just work.
But one thing that I think is still missing (last time I checked) from raylib’s build.zig is to be able to pick both x11 and wayland (so the executable can pick at run time, raylib has some kind of platform detection).