ryupold / examples-raylib.zig

Example usage of raylib.zig bindings
MIT License
43 stars 4 forks source link

can't build #9

Closed lhk closed 1 year ago

lhk commented 1 year ago

I have the impression that there is some incompatibility between the zig version used in the example code, and for build.zig.

If I try to build with zig 0.11.0 it complains about an invalid builtin function @abs in one of the examples. So I guess the examples use zig master (which is currently 0.12.0-dev) But if I build with zig master, then there's a problem in the submodule with your raylib bindings. I'm using MacOS 14.0 and running the following code with both zig versions:

git clone --recurse-submodules https://github.com/ryupold/examples-raylib.zig
zig build run
zig version #0.12.0-dev.926+3be8490d8
zig build run
/Users/lklein/Downloads/examples-raylib.zig/src/raylib/raylib/src/build.zig:23:11: error: member function expected 1 argument(s), found 2
    raylib.addCSourceFiles(&.{
    ~~~~~~^~~~~~~~~~~~~~~~
/Users/lklein/programs/zig-macos-aarch64-0.12.0-dev.926+3be8490d8/lib/std/Build/Step/Compile.zig:937:5: note: function declared here
pub fn addCSourceFiles(self: *Compile, options: AddCSourceFilesOptions) void {
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    addTo: /Users/lklein/Downloads/examples-raylib.zig/src/raylib/build.zig:104:36
    build: /Users/lklein/Downloads/examples-raylib.zig/build.zig:213:19
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
zig version # 0.11.0
zig build run
/Users/lklein/Downloads/examples-raylib.zig/src/examples/audio_stream/audio_stream.zig:102:17: error: invalid builtin function: '@abs'
                @abs(samples[i * music.stream.channels + channel]) * 5,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ryupold commented 1 year ago

Thanks for the issue :) I made a PR in the raylib repo and referenced it until it is merged. Should be buildable again for now.