Not-Nik / raylib-zig

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

Tips on using with zigmod? #55

Closed Nezteb closed 9 months ago

Nezteb commented 9 months ago

I'm trying to use raylib-zig managed via the zigmod package manager.

Here is my minimal reproduction repo.

Currently I'm getting the following errors:

❯ zigmod fetch && zig build
zig build-exe zig-raylib Debug native: error: error(link): undefined reference to symbol '_SetTargetFPS'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_ClearBackground'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_InitWindow'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_CloseWindow'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_WindowShouldClose'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_EndDrawing'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_DrawText'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error(link): undefined reference to symbol '_BeginDrawing'
error(link):   first referenced in '/Users/noah/Git/zig-raylib/zig-cache/o/33bce2cd32849d3e46c909076dc84aa1/zig-raylib.o'
error: UndefinedSymbolReference

zig build-exe zig-raylib Debug native: error: the following command exited with error code 1:
/Users/noah/.asdf/installs/zig/0.11.0/zig build-exe /Users/noah/Git/zig-raylib/src/main.zig --cache-dir /Users/noah/Git/zig-raylib/zig-cache --global-cache-dir /Users/noah/.cache/zig --name zig-raylib --mod raylib::/Users/noah/Git/zig-raylib/.zigmod/deps/git/github.com/Not-Nik/raylib-zig/lib/raylib-zig.zig --deps raylib --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
install transitive failure
└─ install zig-raylib transitive failure
   └─ zig build-exe zig-raylib Debug native failure
error: the following build command failed with exit code 1:
/Users/noah/Git/zig-raylib/zig-cache/o/ffdbe2a826d9cb195ad0cb1dca291adf/build /Users/noah/.asdf/installs/zig/0.11.0/zig /Users/noah/Git/zig-raylib /Users/noah/Git/zig-raylib/zig-cache /Users/noah/.cache/zig
error: Recipe `default` failed on line 6 with exit code 1

I've also tried including raylib-zig as a zigmod build-time depedency to no avail.

I know this isn't strictly related to raylib-zig, but I figured if I can get this working I can contribute back documentation to both zigmod and raylib-zig that others might benefit from. 😄

Not-Nik commented 9 months ago

I don't have plans to support specific community package managers, but you do need to at least use the link function from raylib-zig's build.zig on your target.