Closed Fyrstikkeske closed 2 months ago
note: the hash it asks for is random every time i run the command
ok, managed to change the hash and got this error now
/home/fyrstikk/Documents/GitHub/zigraylibwtftest/build.zig:18:29: error: root struct of file 'build' has no member named 'emcc' const exe_lib = rlz.emcc.compileForEmscripten(b, "zigraylibwtftest", "src/main.zig", target, optimize); ^~~~ /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/build.zig:1:1: note: struct declared here const std = @import("std"); ^~~~~ referenced by: runBuild__anon_8819: /usr/lib/zig/std/Build.zig:2117:37 main: /usr/lib/zig/compiler/build_runner.zig:301:29 remaining reference traces hidden; use '-freference-trace' to see all reference traces
can this have something with wayland to do?
Could you share your build.zig
file? It looks like you're importing std.build
as rlz
instead of raylib-zig.
I'm having the same issue. I'm using windows and a fresly created project.
C:\Users\javlu\AppData\Local\zig\p\12209ba41100c91e36311568875d56f90f73fea84521ec15fc83963078bbc8f0def1\build.zig.zon:7:21: error: hash mismatch: manifest declares 1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26 but the fetched package has 1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058
.hash = "1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26",
If a manually change the hash I get this.
D:\git\zig\raylib-zig\test\build.zig:18:29: error: root struct of file 'build' has no member named 'emcc'
const exe_lib = rlz.emcc.compileForEmscripten(b, "test", "src/main.zig", target, optimize);
^~~~
C:\Users\javlu\AppData\Local\zig\p\1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058\build.zig:1:1: note: struct declared here
const std = @import("std");
^~~~~
referenced by:
runBuild__anon_8953: C:\zig\lib\std\Build.zig:2117:37
main: C:\zig\lib\compiler\build_runner.zig:301:29
remaining reference traces hidden; use '-freference-trace' to see all reference traces
This is my build.zig.
const std = @import("std");
const rlz = @import("raylib-zig");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const raylib_dep = b.dependency("raylib-zig", .{
.target = target,
.optimize = optimize,
});
const raylib = raylib_dep.module("raylib");
const raylib_artifact = raylib_dep.artifact("raylib");
//web exports are completely separate
if (target.query.os_tag == .emscripten) {
const exe_lib = rlz.emcc.compileForEmscripten(b, "test", "src/main.zig", target, optimize);
exe_lib.linkLibrary(raylib_artifact);
exe_lib.root_module.addImport("raylib", raylib);
// Note that raylib itself is not actually added to the exe_lib output file, so it also needs to be linked with emscripten.
const link_step = try rlz.emcc.linkWithEmscripten(b, &[_]*std.Build.Step.Compile{ exe_lib, raylib_artifact });
b.getInstallStep().dependOn(&link_step.step);
const run_step = try rlz.emcc.emscriptenRunStep(b);
run_step.step.dependOn(&link_step.step);
const run_option = b.step("run", "Run test");
run_option.dependOn(&run_step.step);
return;
}
const exe = b.addExecutable(.{ .name = "test", .root_source_file = b.path("src/main.zig"), .optimize = optimize, .target = target });
exe.linkLibrary(raylib_artifact);
exe.root_module.addImport("raylib", raylib);
const run_cmd = b.addRunArtifact(exe);
const run_step = b.step("run", "Run test");
run_step.dependOn(&run_cmd.step);
b.installArtifact(exe);
}
its the default build.zig from the generated template folder(aka the one jawerman sent)
zigyeaiknowthenameisstupid.zip
here is full folder if you want it
btw, is it needed to download raylib from other places, or should the template generator + zig be enough?
What Zig version are you using?
zig version gives 0.13.0
Looks like the raylib hash in the zon file needs to be changed to 1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058
.
I was able to get the example generated from project_setup.sh
to run by:
1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058
.dependencies = .{
.@"raylib-zig" = .{
.path="../raylib-zig"
},
},
@Not-Nik, I opened PR 145
Thanks, somehow Zig didn't complain about the mismatch on my machine. I think there already is an open issue about it, but for now we'll just have to live with the fact that the package manager is plain bad :(
i tries your fix rrossminer, didnt work. btw what does step 3 do?
The PR got merged. Try following the steps in the readme again. Your issue should be solved.
i tries your fix rrossminer, didnt work. btw what does step 3 do?
The build step can either download libraries from a URL (which must have a hash), or from a path relative to the build file. Step 3, swaps downloading the dependency with using a local version. So, it's assuming you cloned the repo next to your code, and went into its zon file to change the hash.
Make a new temp zig project and check out the comments in the build.zig.zon file. The section just above .dependencies
says
// Each dependency must either provide a `url` and `hash`, or a `path`.
// Each dependency must either provide a
url
andhash
, or apath
.
cant find that comment, anyways. the update might have fixed the issue, but i seem to be getting xorg errors now. would it be best to make a new issue out of that?
[fyrstikk@fedora plswerk]$ zig build run
run
└─ run plswerk
└─ zig build-exe plswerk Debug native
└─ zig build-lib raylib Debug native 1 errors
/home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/x11_platform.h:36:10: error: 'X11/Xcursor/Xcursor.h' file not found
#include <X11/Xcursor/Xcursor.h>
^~~~~~~~~~~~~~~~~~~~~~~~
/home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rglfw.c:73:10: note: in file included from /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rglfw.c:73:
#include "external/glfw/src/init.c"
^
/home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/init.c:28:10: note: in file included from /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/init.c:28:
#include "internal.h"
^
/home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/internal.h:325:10: note: in file included from /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/internal.h:325:
#include "platform.h"
^
/home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/platform.h:81:11: note: in file included from /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/src/platform.h:81:
#include "x11_platform.h"
^
error: warning(compilation): failed to delete '/home/fyrstikk/Documents/GitHub/raylib-zig-devel/plswerk/.zig-cache/tmp/9ca6688f85e24fd7-rglfw.o.d': FileNotFound
error: the following command failed with 1 compilation errors:
/usr/bin/zig build-lib -lGL -lX11 -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rcore.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/utils.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/raudio.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rmodels.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rshapes.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rtext.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rtextures.c /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/rglfw.c -cflags -std=gnu99 -D_GNU_SOURCE -DGL_SILENCE_DEPRECATION=199309L -fno-sanitize=undefined -- /home/fyrstikk/Documents/GitHub/raylib-zig-devel/plswerk/.zig-cache/o/ec6be00b9a4f00e4bc20631af1f78af7/raygui.c -ODebug -I /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src/external/glfw/include -I /usr/include -I /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src -I /home/fyrstikk/.cache/zig/p/1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058/src -I /home/fyrstikk/.cache/zig/p/122002d98ca255ec706ef8e5497b3723d6c6e163511761d116dac3aee87747d46cf1/src -D_GLFW_X11=1 -DPLATFORM_DESKTOP=1 -L /usr/lib -Mroot -lc --cache-dir /home/fyrstikk/Documents/GitHub/raylib-zig-devel/plswerk/.zig-cache --global-cache-dir /home/fyrstikk/.cache/zig --name raylib -static --listen=-
Build Summary: 2/6 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run plswerk transitive failure
└─ zig build-exe plswerk Debug native transitive failure
└─ zig build-lib raylib Debug native 1 errors
error: the following build command failed with exit code 1:
/home/fyrstikk/Documents/GitHub/raylib-zig-devel/plswerk/.zig-cache/o/697ecf8ca9aa7f78f02023b4de4cdb23/build /usr/bin/zig /home/fyrstikk/Documents/GitHub/raylib-zig-devel/plswerk /home/fyrstikk/Documents/GitHub/raylib-zig-devel/plswerk/.zig-cache /home/fyrstikk/.cache/zig --seed 0x86892e78 -Zbabc75dd8d404ec7 run
*I use wayland
ok so that was caused by me missing some files these ones -> (libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel) nothing a quick dnf install wont fix
anyways, it is working now, so ill close this
and not to forget, thanks for the massive help
[fyrstikk@fedora zigraylibwtftest]$ zig build run /home/fyrstikk/.cache/zig/p/12209ba41100c91e36311568875d56f90f73fea84521ec15fc83963078bbc8f0def1/build.zig.zon:7:21: error: hash mismatch: manifest declares 1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26 but the fetched package has 1220f655fd57d8e10b5dbe7d99c45a0b9836a13cea085d75cd4c15f6e603a1fcb058 .hash = "1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26", ^
~~~~~~~~~~~~~~~~~