# Troubleshooting incremental compilation (0.17.0-dev.657+2faf8debf)

**URL:** <https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035>\
**Category:** Help\
**Tags:** build-system\
**Created:** [August 1, 2026, 9:46pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035 "2026-08-01T21:46:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Plebosaur](https://ziggit.dev/user_avatar/ziggit.dev/plebosaur/32/6857_2.png) [@Plebosaur](https://ziggit.dev/u/Plebosaur)\
**Post date:** [August 1, 2026, 9:46pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/1 "2026-08-01T21:46:52Z")

</div>

I had 2 problems, I wanted to make the post about the first problem but ended up also encountering a bug, so I will mention both. I don’t exactly understand the error in problem 2 so I couldn’t make a bug report.

# Problem 1

When I am in watch mode, and I make a change, when the compiler shows me the new error message, it doesn’t clear the previous error messages. The Result is if I try to use it for extended periods of time, the terminal gets filled with error messages from previous failed compilations and I completely lose track.  
for example, in the image below, I fix bug1 and save, then it shows bug2, but ideally I would like it if bug1 disappeared from the screen, since it’s now fixed.  
Is there a flag I can give to tell it to clear them?

 ![image](https://ziggit.dev/uploads/default/original/2X/3/3c5b2681114795fd589dd04957402c3c2f155ba9.jpeg)

# Problem 2 (Bug?)

The project can compile in normal mode, but fails to compile in incremental, I don’t understand the error message.

 ![image](https://ziggit.dev/uploads/default/original/2X/8/8b54757e9c212d415360f7100ce46a61389f7597.jpeg)

BTW LLVM backend still works, which is what I used in the first image.

---

<div class="post-metadata">

**Author:** ![andrewrk](https://ziggit.dev/user_avatar/ziggit.dev/andrewrk/32/7011_2.png) [@andrewrk](https://ziggit.dev/u/andrewrk)\
**Post date:** [August 1, 2026, 9:58pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/2 "2026-08-01T21:58:03Z")

</div>

I’m pretty sure a bunch of incremental bugs were fixed after that commit.

---

<div class="post-metadata">

**Author:** ![Plebosaur](https://ziggit.dev/user_avatar/ziggit.dev/plebosaur/32/6857_2.png) [@Plebosaur](https://ziggit.dev/u/Plebosaur)\
**Post date:** [August 1, 2026, 10:16pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/3 "2026-08-01T22:16:27Z")

</div>

I assumed “mise use zig@master” was enough to use the latest version.  
I updated to 0.17.0-dev.1516+8a4b5424d (AFAIK it’s the latest version right)

I hope I am staying in topic here - because I noticed what I think is a different bug, the code below used to work:

```zig
const std = @import("std");

const RandomStruct = extern struct {
    field: f32 = 0,
};

pub fn main() !void {
    const p: RandomStruct = .{};
    const arr: [@sizeOf(@TypeOf(p))]u8 = @bitCast(p);
    std.debug.print("{any}", .{arr});
}

```

however now I get the error:

```zig
…/zig/test ❯ zig run tmp.zig
tmp.zig:9:51: error: cannot @bitCast from 'tmp.RandomStruct'
    const arr: [@sizeOf(@TypeOf(p))]u8 = @bitCast(p);
                                                  ^
tmp.zig:3:29: note: struct declared here
const RandomStruct = extern struct {
                     ~~~~~~~^~~~~~
referenced by:
    callMain [inlined]: /home/plebosaur/.local/share/mise/installs/zig/master/lib/std/start.zig:752:64
    callMainWithArgs [inlined]: /home/plebosaur/.local/share/mise/installs/zig/master/lib/std/start.zig:693:20
    posixCallMainAndExit: /home/plebosaur/.local/share/mise/installs/zig/master/lib/std/start.zig:645:38
    2 reference(s) hidden; use '-freference-trace=5' to see all references

```

I think this is not intentional with the new bitcast changes, if that’s the case I’ll open a bug report.

# Other suspicious thing

This part of the build took ~1 minute, it’s on the LLVM emit object phase so it’s likely LLVM’s fault, but this is not a big project, and it took only a few seconds to compile the project in previous versions.

 ![image](https://ziggit.dev/uploads/default/original/2X/3/3470dff2c08bd185b73efa146744d80c2c236b09.jpeg)

---

<div class="post-metadata">

**Author:** ![andrewrk](https://ziggit.dev/user_avatar/ziggit.dev/andrewrk/32/7011_2.png) [@andrewrk](https://ziggit.dev/u/andrewrk)\
**Post date:** [August 1, 2026, 10:22pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/4 "2026-08-01T22:22:57Z")

</div>

> Other Suspicious Thing

see:

- [Devlog ⚡ Zig Programming Language](https://ziglang.org/devlog/2026/#2026-05-26)
- [Devlog ⚡ Zig Programming Language](https://ziglang.org/devlog/2026/#2026-06-30)

That has to be done once per different `zig version`. If you’re doing a lot of switching between zig versions or patching std lib you might benefit from using `ZIG_DEBUG_MAKER=1`.

---

<div class="post-metadata">

**Author:** ![mlugg](https://ziggit.dev/user_avatar/ziggit.dev/mlugg/32/437_2.png) [@mlugg](https://ziggit.dev/u/mlugg)\
**Post date:** [August 1, 2026, 10:23pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/5 "2026-08-01T22:23:40Z")

</div>

> [@Plebosaur](#):
>
> Is there a flag I can give to tell it to clear them?

`--error-style verbose_clear` (or `--error-style minimal_clear` for a more compact view) will make it clear the terminal on every rebuild. You can set the environment variable `ZIG_BUILD_ERROR_STYLE` to either `verbose_clear` or `minimal_clear` to avoid having to pass it every time.

---

<div class="post-metadata">

**Author:** ![mlugg](https://ziggit.dev/user_avatar/ziggit.dev/mlugg/32/437_2.png) [@mlugg](https://ziggit.dev/u/mlugg)\
**Post date:** [August 1, 2026, 10:25pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/6 "2026-08-01T22:25:16Z")

</div>

> [@Plebosaur](#):
>
> I think this is not intentional with the new bitcast changes, if that’s the case I’ll open a bug report.

This is working as intended—`@bitCast` is a primitive which it would very rarely make sense to use on an `extern struct`, since usually what you actually want with an `extern struct` is simple memory reinterpretation. In this case, it looks like you did indeed just want the raw bytes of the `RandomStruct`? If so, you should be able to do this:

```zig
const p: RandomStruct = .{};
const bytes: []const u8 = @ptrCast(&p);
std.debug.print("{any}", .{bytes});

```

---

<div class="post-metadata">

**Author:** ![Plebosaur](https://ziggit.dev/user_avatar/ziggit.dev/plebosaur/32/6857_2.png) [@Plebosaur](https://ziggit.dev/u/Plebosaur)\
**Post date:** [August 1, 2026, 10:39pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/7 "2026-08-01T22:39:33Z")

</div>

Actually the use case here was very weird:

I just wanted to pass the actual struct from build.zig to my program.  
However there’s a bug preventing that:  
[https://codeberg.org/ziglang/zig/issues/35842](https://codeberg.org/ziglang/zig/issues/35842)

So as a workaround I passed just the raw array of bytes

in build.zig

```zig
const arrtype = [@sizeOf(zorg.building.MTSDFfontBuilder.FontData)]u8;
// This used to be bitcast, I did this now
fontOptions.addOption(arrtype, "bitCastedMetadata", @as(*const arrtype, @ptrCast(&metadata)).*);

```

Then in the code

```zig
const metadata: zorg.building.MTSDFfontBuilder.FontData = @bitCast(jb.bitCastedMetadata);

```

Edit: here is what actually worked:

```zig
const metadata: zorg.building.MTSDFfontBuilder.FontData = 
    D: {
        var ans: zorg.building.MTSDFfontBuilder.FontData = undefined;
        const ptr: *[@sizeOf(zorg.building.MTSDFfontBuilder.FontData)]u8 = @ptrCast(&ans);
        ptr.* = jb.bitCastedMetadata;
        break :D ans;
    };

```

(If this line doesn’t work then I will probably do the same trick in reverse)  
Edit: Apparently 80% of my @bitCast uses are in extern structs, but switching to @ptrCast doesn’t seem like a difficult migration.

Edit: This got resolved - will still leave it here, will have to compiler explorer it though!  
I didn’t get to see if it worked, because of a completely different part of the codebase with `@Vector` in extern unions, the use case for that was simulating indexing into `[*]@Vector(32, u8)` for an exotic performance optimization, I initially tried using `[*][32]u8` but LLVM was confused about the alignment, then I went into an `extern union{}` that has both, I’ll have to take some time to write a seperate thread for that use case, sorry for rambling a bit.

---

<div class="post-metadata">

**Author:** ![Plebosaur](https://ziggit.dev/user_avatar/ziggit.dev/plebosaur/32/6857_2.png) [@Plebosaur](https://ziggit.dev/u/Plebosaur)\
**Post date:** [August 1, 2026, 10:43pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/8 "2026-08-01T22:43:58Z")

</div>

That should solve #problem 1, I will see if the incremental fails after I update the codebase.  
If that happens should I try to come back here on this thread, make a different one or try to copy paste the terminal output into a bug report?  
EDIT - I updated, it works.

Anyways, I just want to say that from a user perspective It’s very reassuring And appreciated to get this sort of response from the core team when something in the language is not working!

---

<div class="post-metadata">

**Author:** ![Plebosaur](https://ziggit.dev/user_avatar/ziggit.dev/plebosaur/32/6857_2.png) [@Plebosaur](https://ziggit.dev/u/Plebosaur)\
**Post date:** [August 1, 2026, 11:50pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/9 "2026-08-01T23:50:24Z")

</div>

After migrating the codebase incremental seems to work!!!

---

<div class="post-metadata">

**Author:** ![Southporter](https://ziggit.dev/user_avatar/ziggit.dev/southporter/32/2500_2.png) [@Southporter](https://ziggit.dev/u/Southporter)\
**Post date:** [August 3, 2026, 1:39pm UTC](https://ziggit.dev/t/troubleshooting-incremental-compilation-0-17-0-dev-657-2faf8debf/17035/10 "2026-08-03T13:39:37Z")

</div>

> [@Plebosaur](#):
>
> I assumed “mise use zig@master”

Also use `mise`, and that command uses the last downloaded version of master that is cached locally. You have to `mise uninstall zig@master` and then `mise install zig@master` to get mise to download a more recent version.
