ipinzi / RayZig

RayZig is a Zig template repo with Raylib, a simple and easy-to-use library to learn videogames programming
5 stars 0 forks source link

Install issues encountered #1

Open JosephSBoyle opened 1 month ago

JosephSBoyle commented 1 month ago

Thanks for the repo.

Issue 1

the raylib dependency should be pinned because it specifies a hash and that hash has changed. i.e. I needed to change the line of build.zig.zon to: .raylib = .{ .url = "https://github.com/raysan5/raylib/archive/refs/heads/master.tar.gz", .hash = "122028357fb37466a5c87f0b83f3a9ab8b9a762ffa91ca93caee324bad15033ab4f2" }, // <- hash is different than in the repo

Issue 2

I get this error when I try the zig build run step of the instructions:

src/main.zig:2:11: error: C import failed
const r = @cImport({
          ^~~~~~~~
src/main.zig:2:11: note: libc headers not available; compilation does not link against libc
referenced by:
    main: src/main.zig:7:5
    callMain: /snap/zig/11625/lib/std/start.zig:524:32
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
/home/extasia/.cache/zig/o/1081bdf0a8777e735014394697e1d4ec/cimport.h:1:10: error: 'raylib.h' file not found
#include <raylib.h>

This is fixed by adding the following line to build.zig

    const lib = b.addStaticLibrary(.{
        .name = "RayZig",
        // In this case the main source file is merely a path, however, in more
        // complicated build scripts, this could be a generated file.
        .root_source_file = b.path("src/root.zig"),
        .target = target,
        .optimize = optimize,
        .link_libc = true, // <- this line!
    });

Cheers, Joe

X-Ninja-dev commented 2 weeks ago

Thank you, this helped me.

I only had to change the hash though, and that hash was given to me when the first >>>zig build run failed

Zig: 0.14.0-dev.1632+d83a3f174