Help needed with local path dependency in build.zig.zon

Hello,

I’ve started tinkering from this example project: clay-zig-bindings/examples/raylib-sidebar-container at main · johan0A/clay-zig-bindings · GitHub

it builds, I can modify it but zls (with vscode on Windows) has been pretty unreliable on my side for autocompletes about the dependencies, sometimes it manages to pull the definitions sometimes not

then I found someone mentioning it could be better to just get the dependencies as git submodules

so I copy that example folder, create a deps folder with the submodules
then I modify build.zig and .zon (see below)

but when I try to build I get these errors… : (
is it using the previously fetched/cached raylib-zig ?

I feel like I’m missing a step but I can’t find any documentation…

PS C:\Users\AAAAA\Documents\0zigprojs\test-rayclay> zig build
C:\Users\AAAAA\AppData\Local\zig\p\1220d93782859726c2c46a05450615b7edfc82b7319daac50cbc7c3345d660b022d7\build.zig:170:15: error: no field or member function named 'defineCMacro' in 'Build.Step.Compile'
        raylib.defineCMacro(options.opengl_version.toCMacroStr(), null);
        ~~~~~~^~~~~~~~~~~~~
C:\Users\AAAAA\zig-dev-windows\lib\std\Build\Step\Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
C:\Users\AAAAA\AppData\Local\zig\p\1220d93782859726c2c46a05450615b7edfc82b7319daac50cbc7c3345d660b022d7\build.zig:170:15: note: method invocation only supports up to one level of implicit pointer dereferencing
C:\Users\AAAAA\AppData\Local\zig\p\1220d93782859726c2c46a05450615b7edfc82b7319daac50cbc7c3345d660b022d7\build.zig:170:15: note: use '.*' to dereference pointer
referenced by:
    build: C:\Users\AAAAA\AppData\Local\zig\p\1220d93782859726c2c46a05450615b7edfc82b7319daac50cbc7c3345d660b022d7\build.zig:392:34
    runBuild__anon_78866: C:\Users\AAAAA\zig-dev-windows\lib\std\Build.zig:2428:44
    19 reference(s) hidden; use '-freference-trace=21' to see all references

relevant part in build.zig:

//....
fn addDependencies(
    compile_step: *B.Step.Compile,
    b: *B,
    target: B.ResolvedTarget,
    optimize: std.builtin.OptimizeMode,
) void {
    const zclay_dep = b.dependency("zclay", .{
        .target = target,
        .optimize = optimize,
    });
    const zclay = zclay_dep.module("zclay");
    compile_step.root_module.addImport("zclay", zclay);

    const raylib_dep = b.dependency("raylib_zig", .{
        .target = target,
        .optimize = optimize,
    });
    const raylib = raylib_dep.module("raylib");
    compile_step.root_module.addImport("raylib", raylib);
    const raylib_artifact = raylib_dep.artifact("raylib");
    compile_step.linkLibrary(raylib_artifact);
}

build.zig.zon:

.{
    .name = "test-rayclay",
    .version = "0.0.0",

    .dependencies = .{
        .zclay = .{
            .path = "./deps/clay-zig-bindings",
        },
        .raylib_zig = .{
            .path = "./deps/raylib-zig",
        },
    },

    .paths = .{
        "build.zig",
        "build.zig.zon",
        "src",
        "",
        // For example...
        //"LICENSE",
        //"README.md",
    },
}

Hello @bunxen
Welcome to ziggit :slight_smile:

The API changed, see:

huh I see thank you!
Looks like the raylib repo is up to date so the raylib zig bindings repo must have an outdated dependency

And now I wonder why I can compile the example I linked fine (which uses url and hash) but not when I try local path by myself…

Maybe you have locally checked out a newer version than is referenced by the url via the build.zig.zon?

hm that makes sense, well now that I fixed the raylib dependency manually, I just had to fix a couple errors and it works again! ^^