Code Monkey home page Code Monkey logo

Comments (5)

CosmicBagel avatar CosmicBagel commented on September 27, 2024 3

My apologies for breaking this for you, I should have tested this code path properly with 0.12.0 before submitting the PR, that's on me.

Indeed, zig is making a push to eliminate all absolute paths in the build system it seems ziglang/zig#18450
Context: andrewrk is the BDFL for zig, so if he's pushing to have it happen, it will most likely happen.

I like the approach dylan proposed here, the only thing I would like to add is maybe a warning that gets printed when using zig 0.12.0 so that people will be aware of future breakage when upgrading to zig 0.13.0. I'm assuming people have little scripts and shell aliases, shell variables, ect, that point to this.

from raylib.

dylanlangston avatar dylanlangston commented on September 27, 2024 2

I'm also seeing this issue in my project and agree with @fjebaker assessment of what's happening. The problem arises due to changes in the Zig master branch where the path to the emsdk headers must be a relative path, as mentioned here. Previously, in versions >= 0.12, this path was absolute.

This code in the src/build.zig is checking that the path is absolute:

var dir = std.fs.openDirAbsolute(cache_include, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .no_follow = true }) catch @panic("No emscripten cache. Generate it!");
dir.close();

However, we need to pass a relative path to b.path(cache_include) to avoid the error sub_path is expected to be relative to the build root, but was this absolute path:

raylib.addIncludePath(b.path(cache_include));

Ideally, I'd like to be able to use raylib's master branch with Zig's master branch. To resolve this in a way that doesn't break existing code but enables new development also I propose something like this:

if (comptime builtin.zig_version.minor > 12) {
    var dir = std.fs.cwd().openDir(cache_include, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .no_follow = true }) catch @panic("No emscripten cache. Generate it!");
    dir.close();
    raylib.addIncludePath(b.path(cache_include));
} else {
    var dir = std.fs.openDirAbsolute(cache_include, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .no_follow = true }) catch @panic("No emscripten cache. Generate it!");
    dir.close();
    raylib.addIncludePath(.{ .path = cache_include });
}

I've made those changes in a fork here, happy to submit a pull request if others agree this change makes sense.

from raylib.

raysan5 avatar raysan5 commented on September 27, 2024

@fjebaker Thanks for reporting! Probably @CosmicBagel should comment on this issue.

from raylib.

CosmicBagel avatar CosmicBagel commented on September 27, 2024

Ah dang, I was too slow

from raylib.

fjebaker avatar fjebaker commented on September 27, 2024

Thanks @dylanlangston and @CosmicBagel, the changes merged work for me. Thanks for addressing this so quickly!

Context: andrewrk is the BDFL for zig, so if he's pushing to have it happen, it will most likely happen.

I absolutely love the direction Andrew is taking Zig in! Until the language has arrived at its stable API, these are just the little hacks we'll have to put up with (~;

from raylib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.