Skip to content

Support for zig 0.16.0-dev - #35

Merged
Srekel merged 5 commits into
zig-gamedev:mainfrom
soeren-spindler:main
May 13, 2026
Merged

Srekel merged 5 commits into
zig-gamedev:mainfrom
soeren-spindler:main

Conversation

@soeren-spindler

Copy link
Copy Markdown
Contributor

Hello guys,
I made some changes in order to support zig 0.16.0-dev in my demo project and wanted to contribute that back to you.

I guess most changes are straight forward. Replaced removed function calls with their newer alternative.

The point I'm not sure about is the flecs_abort function.

 if (builtin.zig_version.major == 0 and builtin.zig_version.minor <= 15) {
    std.debug.dumpCurrentStackTrace(@returnAddress());
} else {
    std.debug.dumpCurrentStackTrace(.{
        .first_address = @returnAddress(),
        // TODO: Not sure about that
        // .allow_unsafe_unwind = false,
        // .context = null,
    });
}

I assumed a version check is adequate because it's a callback, not in any hot path.
Regarding allow_unsafe_unwind and context:
I left them as default values since I couldn't find a reason not to do so.
But honestly, especially for allow_unsafe_unwind I don't know what implications true would exactly have.

/// If not `null`, we will unwind from this `cpu_context.Native` instead of the current top of
/// the stack. The main use case here is printing stack traces from signal handlers, where the
/// kernel provides a `*const cpu_context.Native` of the state before the signal.
context: ?CpuContextPtr = null,
/// If `true`, stack unwinding strategies which may cause crashes are used as a last resort.
/// If `false`, only known-safe mechanisms will be attempted.
allow_unsafe_unwind: bool = false,

In order to check backwards compatibility I added zig version 0.15.1 and master to matrix strategy in the github action.

I'm new to the zig community and this is my first PR in any open source project. Please forgive me in case I missed something.
Greetings ☕ Sören

@Srekel

Srekel commented Feb 26, 2026

Copy link
Copy Markdown
Member

Hi, thanks for the MR! I'm good with merging this in but could you explain why it needs to link in libc now? Is that something that changed with Zig 0.16?

I'm not keeping up to date with Zig updates so if someone else wants to have a look at the MR please do so :)

@soeren-spindler

Copy link
Copy Markdown
Contributor Author

Hi Srekel,

it did link libc before like this: lib.linkLibC();
https://ziglang.org/documentation/0.15.1/std/#std.Build.Step.Compile.linkLibC

So I changed it to the recommended alternative link_libc = true in the module.

@Srekel

Srekel commented Feb 26, 2026

Copy link
Copy Markdown
Member

Oh, now I see. Sounds good. Happy to merge but I am not able to test it, so will leave it open for a while and see if anyone has any comments.

@ezzieyguywuf

Copy link
Copy Markdown

@soeren-spindler I opened soeren-spindler#1 on your fork to add support for some recent changes.

also: maybe it makes sense to change this PR from Draft, maybe that's why it hasn't merged yet?

@Srekel

Srekel commented May 12, 2026

Copy link
Copy Markdown
Member

Oh sorry, yeah I think that's why I didn't merge it yet. I'm OK with merging it, but let me know if you want to get your changes in first @ezzieyguywuf .

@ezzieyguywuf

Copy link
Copy Markdown

@Srekel I'll submit a followup PR for my changes if you go ahead and merge this

@Srekel
Srekel marked this pull request as ready for review May 13, 2026 05:37
@Srekel
Srekel merged commit 75dfde7 into zig-gamedev:main May 13, 2026
6 checks passed
@PizzaLvr49

Copy link
Copy Markdown

will the minimum zig version be updated to 0.16?

@soeren-spindler

Copy link
Copy Markdown
Contributor Author

will the minimum zig version be updated to 0.16?

It's currently at 0.15.1 because it supports that version. That doesn't prevent you from using it with 0.16.

Why would you want that version to be increased?
The only reason I could see are breaking changes that prevent support for older versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants