Open squeaktoy opened 9 months ago
If you use 0.11.0, this version of the template should work: https://github.com/aduros/wasm4/tree/4f840a0cb73b16a57ca348569e48ca2bc91b439f/cli/assets/templates/zig
Not sure why someone upgrade to 0.12.0 which is a moving target with no stability guarantees.
Not sure why someone upgrade to 0.12.0 which is a moving target with no stability guarantees.
Because that's what Zig recommends? From the Getting Started:
Zig releases tend to be far apart and eventually become stale given the current speed of development, […] we encourage you to upgrade to a nightly build.
Fair enough, just means regular PRs. But I also get the staleness problem. Just a harder problem for libraries.
This is a good read on a middle ground: https://devlog.hexops.com/2024/announcing-nominated-zig/
I was having some problems to build on version 0.13.0 and was able to execute it by changing .root_source_file
value from .{ .path = "src/main.zig" }
to .{ .cwd_relative = "src/main.zig" }
on the build.zig file:
Before
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = .{ .path = "src/main.zig" },
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
}),
.optimize = b.standardOptimizeOption(.{}),
});
After
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = .{ .cwd_relative = "src/main.zig" },
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
}),
.optimize = b.standardOptimizeOption(.{}),
});
@phcarvalho Note that you should do .root_source_file = b.path("src/main.zig"),
with current versions of Zig.
So something along these lines:
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = b.path("src/main.zig"),
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
}),
.optimize = .ReleaseSmall,
});
after doing
w4 new --zig test
and tryingzig build -Doptimize=ReleaseSmall
I get this:And even with Zig 0.11.0 it fails:
Removing the
exe.entry = .disabled;
line makes matters even worse: