ryupold/examples-raylib.zig

Does not build with Zig 0.12

Opened this issue · 0 comments

The build process initially fails on:

$ zig build run
info: building for desktop

warning: deprecated. call std.Build.path instead
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src' to raylib-zig-examples
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib' to raylib-zig-examples
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src' to raylib.zig
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib' to raylib.zig
thread 9732 panic: file paths added with 'addCSourceFiles' must be relative, found absolute path '/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src/rcore.c'
/usr/lib/zig/std/Build/Module.zig:466:28: 0x11e3e99 in addCSourceFiles (build)
            std.debug.panic(
                           ^
/usr/lib/zig/std/Build/Step/Compile.zig:785:37: 0x118137f in addCSourceFiles (build)
    self.root_module.addCSourceFiles(options);
                                    ^
/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src/build.zig:253:28: 0x1141ea3 in addCSourceFilesVersioned (build)
        exe.addCSourceFiles(.{
                           ^
/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src/build.zig:51:29: 0x1140d04 in addRaylib__anon_13667 (build)
    addCSourceFilesVersioned(raylib, &.{
                            ^
/home/gree/workspace/examples-raylib.zig/src/raylib/build.zig:108:46: 0x10f3d3c in addTo (build)
    const lib_raylib = raylib_build.addRaylib(b, b.resolveTargetQuery(target), optimize, raylibOptions) catch |err| std.debug.panic("addRaylib: {any}", .{err});
                                             ^
/home/gree/workspace/examples-raylib.zig/build.zig:214:25: 0x10f2428 in build (build)
            raylib.addTo(b, exe, target.query, mode, .{});
                        ^
/usr/lib/zig/std/Build.zig:2080:43: 0x10d3734 in runBuild__anon_9000 (build)
        .ErrorUnion => try build_zig.build(b),
                                          ^
/usr/lib/zig/compiler/build_runner.zig:300:29: 0x10ceea3 in main (build)
        try builder.runBuild(root);
                            ^
/usr/lib/zig/std/start.zig:511:37: 0x10b5185 in posixCallMainAndExit (build)
            const result = root.main() catch |err| {
                                    ^
/usr/lib/zig/std/start.zig:253:5: 0x10b4ca1 in _start (build)
    asm volatile (switch (native_arch) {
    ^
???:?:?: 0x8 in ??? (???)
Unwind information for `???:0x8` was not available, trace may be incomplete

error: the following build command crashed:
/home/gree/workspace/examples-raylib.zig/zig-cache/o/e5e0cf81a747ed86addf73d3bc8e8020/build /usr/bin/zig /home/gree/workspace/examples-raylib.zig /home/gree/workspace/examples-raylib.zig/zig-cache /home/gree/.cache/zig --seed 0x100fd1f7 -Z996771af16a3a75f run

If I do this:

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

It gets a little further, but then it fails with:

info: building for desktop

warning: deprecated. call std.Build.path instead
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src' to raylib-zig-examples
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib' to raylib-zig-examples
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src' to raylib.zig
info: include '/home/gree/workspace/examples-raylib.zig/src/raylib' to raylib.zig
info: linked raylib.zig
run
└─ run raylib-zig-examples
   └─ install
      └─ install raylib-zig-examples
         └─ zig build-exe raylib-zig-examples Debug native 4 errors
src/raylib/raylib.zig:2:16: error: C import failed
const raylib = @cImport({
               ^~~~~~~~
referenced by:
    mGenImageFontAtlas: src/raylib/raylib.zig:760:14
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
/home/gree/workspace/examples-raylib.zig/zig-cache/o/66d49f3a8e4d49d1534fc730849f8de3/cimport.h:1:10: error: 'raylib.h' file not found
#include <raylib.h>
         ^
src/raygui/raygui.zig:2:16: error: C import failed
const raygui = @cImport({
               ^~~~~~~~
/home/gree/workspace/examples-raylib.zig/zig-cache/o/13636cbda2e438bdeab2c9a1f773be97/cimport.h:1:10: error: 'raygui.h' file not found
#include <raygui.h>
         ^
error: the following command failed with 4 compilation errors:
/usr/bin/zig build-exe /home/gree/workspace/examples-raylib.zig/zig-cache/o/daf369ed471c16a0cd3df77eea65c111/libraylib.a /home/gree/workspace/examples-raylib.zig/zig-cache/o/018b97342e23af5f90f302aa2674484f/libraylib.zig.a -cflags -DRAYGUI_IMPLEMENTATION -- /home/gree/workspace/examples-raylib.zig/src/raygui/raygui_marshal.c -lGL -lX11 -ODebug -I /home/gree/workspace/examples-raylib.zig/src/raylib/raylib/src -I /home/gree/workspace/examples-raylib.zig/src/raylib -I /home/gree/workspace/examples-raylib.zig/zig-cache/o/bab42bbbea71a70c78c338ea9331fb6e -I /home/gree/workspace/examples-raylib.zig/zig-cache/o/bab42bbbea71a70c78c338ea9331fb6e -I /home/gree/workspace/examples-raylib.zig/src/raygui/raygui/src -I /home/gree/workspace/examples-raylib.zig/src/raygui -L /usr/lib64 --dep raylib --dep raygui -Mroot=/home/gree/workspace/examples-raylib.zig/src/desktop.zig -Mraylib=/home/gree/workspace/examples-raylib.zig/src/raylib/raylib.zig --dep raylib -Mraygui=/home/gree/workspace/examples-raylib.zig/src/raygui/raygui.zig -lc --cache-dir /home/gree/workspace/examples-raylib.zig/zig-cache --global-cache-dir /home/gree/.cache/zig --name raylib-zig-examples --listen=- 
Build Summary: 5/10 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run raylib-zig-examples transitive failure
   ├─ zig build-exe raylib-zig-examples Debug native 4 errors
   └─ install transitive failure
      └─ install raylib-zig-examples transitive failure
         └─ zig build-exe raylib-zig-examples Debug native (+4 more reused dependencies)
error: the following build command failed with exit code 1:
/home/gree/workspace/examples-raylib.zig/zig-cache/o/93d67188e6362cd76b868d98e6abec0a/build /usr/bin/zig /home/gree/workspace/examples-raylib.zig /home/gree/workspace/examples-raylib.zig/zig-cache /home/gree/.cache/zig --seed 0x30de35be -Z3c29ed5d0e647f4d run