Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It doesn't build on latest zig #39

Open
AntonC9018 opened this issue Mar 11, 2024 · 2 comments
Open

It doesn't build on latest zig #39

AntonC9018 opened this issue Mar 11, 2024 · 2 comments

Comments

@AntonC9018
Copy link

AntonC9018 commented Mar 11, 2024

Trying to build a project using raylib with zig version

0.12.0-dev.3193+4ba4f94c9

Getting the following error.

As you can see the problem is that zig build now expects relative paths to c source files from the root build folder. So I've fixed that by changing the paths to be relative in build.zig of the raylib submodule.
Now I get a different error, about marshal.h not being found.

Then I realized the raylib submodule is just raylib, so I switched that to master. Now this is the error: https://pastebin.com/YZe4grhz
Which pushed me to try and regenerate the bindings. A file didn't compile because of FileSource missing.
I've fixed that too by writing a custom relative path function, just like in the other file:

const srcdir = struct {
    fn f() []const u8 {
        return std.fs.path.dirname(@src().file).?;
    }
}.f();

fn srcRelative(comptime path: []const u8) std.Build.LazyPath {
    return .{ .path = srcdir ++ path };
}

(but later found out it's been renamed to LazyPath).

Now I've tried to regenerate the bindings. zig build parse worked, zig build intermediate failed with UnexpectedToken.

At this point I think I'm getting way too deep. Maintainer, please fix.

@AntonC9018
Copy link
Author

Ah didn't see this #37

@AntonC9018
Copy link
Author

I have found why the json conversion fails. The type of the field RaylibDefine.value is a string, but the json contains numbers instead, sometimes. std.json fails to convert from numbers to strings. Must be a recent change as well.
The fix would be to either modify the raylib_parser.c to always output strings where strings are expected, or modify the parser in the zig standard library to accept numbers as strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant