-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Potential cache issue leading to inconsistent #23869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Do you know if this is a regression in 0.14.0? |
Unfortunately I don't, and the repo won't build on 0.13.0 for some time, but I can try to apply my three commits onto an old branch. |
I don't think that effort would be hugely valuable; since cache bugs are often to do with filesystem races, it's quite easy for a change to expose an existing cache bug by coincidentally making it more likely. For instance, that happened with #23110; that bug wasn't actually a 0.14.0 regression, but a change I made in that release cycle happened to make it more likely. It's possible that this is a manifestation of #23110; that depends whether it can be repro'd on master (I'm aware you're currently trying to figure out a more consistent repro before trying that out). But that doesn't seem hugely likely to me. |
On master, when I build with a fresh cache, I get the consistent 0x20000001 entry point, which is incorrect for the second and fourth build. If I immediately build again with the normal cache directory, I 'correctly' get the weird entry point.
|
Is it possible that the underlying problem is as simple as the I can also reproduce a similar issue with the following on master: // build.zig
const std = @import("std");
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "repro",
.root_module = b.createModule(.{
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .wasi }),
.optimize = .ReleaseSmall,
.root_source_file = b.path("build.zig"),
}),
});
if (b.option([]const u8, "entry", "")) |name| exe.entry = .{ .symbol_name = name };
b.installArtifact(exe);
}
pub fn main() void {
std.debug.print("main\n", .{});
}
export fn other() void {
std.debug.print("other\n", .{});
} If I run |
Hah, you're right. There are actually also a few other link options which aren't put into the cache manifest. I'll put up a PR fixing all of those soon. |
Zig Version
0.14.0
(Built on M1 mac running Sonoma 14.2.1)
Steps to Reproduce and Observed Behavior
While trying to build a image for a microcontroller, with a custom entry point, I noticed that my build was not consistently producing a binary with the same header.
If I have commit A, which works, B, removes where we set the
Build.Step.Compile.entry
symbol, and then C, which re-adds it, I can sometimes build B and yield a binary with the entrypoint still set according to theentry
field.This behaviour is inconsistent, and sometimes hard (for others) to reproduce.
I have a repro branch in microzig called
build_bug
.You can try to repro by cloning the repo and running the following from the examples/raspberrypi/rp2xxxx directory.
Expected Behavior
Expected output is
But I sometimes get
Which suggests that it's not always using the
entry
field in theCompile
step which changes across each commit.The text was updated successfully, but these errors were encountered: