fubark / cosmic

A platform for computing and creating applications.
https://cosmic.ooo
MIT License
328 stars 16 forks source link

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

Open niezgoda-piotr opened 6 months ago

niezgoda-piotr commented 6 months ago

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)

fubark commented 6 months ago

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.