cosmic icon indicating copy to clipboard operation
cosmic copied to clipboard

Build error. Multiple errors "local variable is never mutated" and other errors

Open niezgoda-piotr opened this issue 2 years ago • 1 comments

Got multiple errors during build with command:

zig build run -Dpath="graphics/examples/demo.zig" -Dgraphics -Doptimize=ReleaseSafe

Errors that I got:

/cosmic/build.zig:419:9: error: local variable is never mutated
    var build_cosmic = b.addLog("", .{});
        ^~~~~~~~~~~~
/cosmic/lib/mimalloc/lib.zig:27:9: error: local variable is never mutated
    var c_flags = std.ArrayList([]const u8).init(b.allocator);
        ^~~~~~~
/cosmic/GitRepoStep.zig:50:9: error: local variable is never mutated
    var result = b.allocator.create(GitRepoStep) catch @panic("memory");
        ^~~~~~

After changing to const as compiler suggests, I got:

/cosmic/build.zig:235:23: error: no field or member function named 'addLog' in 'Build'
        const step = b.addLog("", .{});
                     ~^~~~~~~
/cosmic/GitRepoStep.zig:53:31: error: expected 1 argument(s), found 4
        .step = std.build.Step.init(.custom, "clone a git repository", b.allocator, make),
                ~~~~~~~~~~~~~~^~~~~
/cosmic/lib/clyon/lib.zig:33:35: error: expected 1 argument(s), found 4
            .step = std.build.Step.init(.custom, builder.fmt("lyon", .{}), builder.allocator, make),
                    ~~~~~~~~~~~~~~^~~~~

Zig version: 0.12.0-dev.1828+225fe6ddb Got the same issues with previous zig build, from week ago (although I don't remember the exact version, 0.12.0-dev.1824... i think)

niezgoda-piotr avatar Dec 14 '23 10:12 niezgoda-piotr

I'll upgrade Zig once I get around reorganizing the project. Just a heads up, the graphics library won't be standalone and the tesselator will get scrapped in favor of a simpler API for the purposes of Cosmic.

fubark avatar Dec 28 '23 00:12 fubark