defineCMacro() changes?

Hello all. I was trying to mess around with clay using raylib as a backend (with a recent version of zig: zig-linux-x86_64-0.14.0-dev.3237+ddff1fa4c) and I’m running into a build error using the basic recommendations of clay-zig and raylib-zig: defineCMacro() (which is an integral part of the raylib-zig build process) seems to be missing! I’ve grepped for it in my local zig std library, and it only exists in Build.Step.TranslateC.

All the calls in the raylib-zig build.zig (e.g.
raylib.defineCMacro(options.opengl_version.toCMacroStr(), null);
etc…) just fail with an error that raylib has no such member function in Build.Step.Compile

Am I just doing something particularly stupid or is this a real change? If so, is this change going to break like every package on allyourcodebase?

Use c.root_module.addCMacro

2 Likes

Thanks for the pointer! I guess I should have been paying closer attention to the changes in the build system… Also, that’s a lot of recursive-dependency-breaking-changes coming soon! The perils of pre-1.0 software development I suppose…

1 Like

I have been encountering this issue aswell. What should i do to fix it? It seems like an issue with the raylib-zig library itself

I’m currently using raylib-zig as a local dependency so I updated its build.zig.zon for now:

zig fetch --save=raylib https://github.com/raysan5/raylib/archive/refs/heads/master.zip

Thank you!

However, when i executed this zig command, and attempt to build the project I still receive:

.cache/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);
        ~~~~~~^~~~~~~~~~~~~
/usr/local/bin/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");

I assume you are using the raylib-zig project, as @bunxen said, they are using a local copy of the project so they were able to update the dependencies of their copy of raylib-zig, until raylib-zig update it themselves you will either have to wait or use raylib directly

1 Like

I just found out, raylib-zig has a branch for raylib 5.6 and zig 0.14dev, you could try using that as a dependency : GitHub - Not-Nik/raylib-zig at 5.6-dev