Not-Nik / raylib-zig

Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib
MIT License
619 stars 115 forks source link

Paths in the build.zig.zon may need updating? #82

Closed daogilvie closed 5 months ago

daogilvie commented 5 months ago

Hi @Not-Nik, thank you for maintaining this library! I'm really looking forward to trying it out.

I've just managed to get the README.md example working using a build.zig.zon dependency (also as per the README) to import raylib zig. This works with both zig 0.13.0-dev.46+3648d7df1 and 0.12, based on your 0.12 branch, but I found that I needed to tweak your build.zig.zon to get builds to work. I chose to do this entirely based off of a hunch from searching for the precise error message I got. My error looked like this:

❯ zig build run
thread 948616 panic: unable to find module 'raylib'
/[...]/installs/zig/master/lib/std/Build.zig:1820:18: 0x10c0b44d0 in module (build)
            panic("unable to find module '{s}'", .{name});
                 ^
/[...]/build.zig:26:37: 0x10c0758bc in build (build)
    const raylib = raylib_dep.module("raylib"); // main raylib module

Searching for that error led me to ziglang/zig#18282, which points to a similar downstream issue fixed here sam701/zig-cli#29. I tried the same thing, and found I needed to add build.zig, build.zig.zon and emcc.zig (as it is used in build.zig) in order to get it to work. Is this something you would want to do? I'm completely new to the Zig package management ecosystem, and have barely used zig itself beyond some toy code for AoC 2 years ago, so my apologies if I've missed something totally obvious.

Not-Nik commented 5 months ago

Yes, perfect! I was having this exact issue while working on #81. Thank you so much for this fix!