Skip to content

[build] Zig emscripten build broken? #4010

@fjebaker

Description

@fjebaker
  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

I think #3983 broke the Zig 0.12.0 build. If I pass --sysroot with an absolute path I now get

thread 637865 panic: sub_path is expected to be relative to the build root, but was this absolute path: '/home/lilith/Developer/emsdk/upstream/emscripten/cache/sysroot/include'. It is best avoid absolute paths, but if you must, it is supported by LazyPath.cwd_relative

If I pass --sysroot with relative paths

thread 637149 panic: reached unreachable code
/home/lilith/.zigup/cache/0.12.0/files/lib/std/debug.zig:403:14: 0x10b5bfd in assert (build)
    if (!ok) unreachable; // assertion failure
             ^
/home/lilith/.zigup/cache/0.12.0/files/lib/std/fs.zig:280:11: 0x10f0b3a in openDirAbsolute (build)
    assert(path.isAbsolute(absolute_path));
          ^

due to the std.fs.openAbsoluteDir verifying that a path is absolute or not. I think the changes in #3983 are well intended but are maybe too soon. Upgrading to Zig 0.13.0 when it is released will likely require more work than just changing one line...

I have a commit in a fork I am happy to PR that just reverts the change in #3983. I have tested it and it seems to work fine.

Edit: to suggest a compromise, one could also use something other than openAbsoluteDir to keep some version compat with newer 0.13.0-dev releases.

Environment

Cloned master branch and built with Zig version 0.12.0 with

zig build -Dtarget=wasm32-emscripten --sysroot "/home/lilith/Developer/emsdk/upstream/emscripten"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions