capy icon indicating copy to clipboard operation
capy copied to clipboard

Compiler Error

Open tmheath opened this issue 1 year ago • 2 comments

I just downloaded zig 0.12 on Windows 10 and I added, the sole line to import capy into the default program right at the top. It does not compile moreover upon looking up this error message, as of 0.12 zig compiler now happily enforces all variables requiring to be mutated at least once unless declared with const. This is my first real zig project I'm trying and I only just started, I might download 0.11 to use as a temporary workaround. I'd think this was my system if I didn't put two and two together.

https://ziggit.dev/t/error-local-variable-is-never-mutated/2238/20

C:\Users\Tim.Heath\AppData\Local\zig\p\12201751d2094cde9630bc080e6ce1d8982ff03bdd30a3103abd21321a8361a7e39d\android\build\auto-detect.zig:158:13: error: local variable is never mutated
        var android_studio_key: HKEY = for ([_]HKEY{ HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }) |root_key| {

This caught me entirely off guard because I just downloaded zig totally fresh, set my path, and went to follow the guide at the below link (not exactly but just one step at a time towards my goal).

https://capy-ui.org/docs/getting-started/first-application/

tmheath avatar Feb 16 '24 14:02 tmheath

Indeed, I downloaded zig 0.11 and the issue is gone. Rust's borrow checker is a source of extreme hype, I've gotten segfaults with it, it's irritating is all.

tmheath avatar Feb 16 '24 15:02 tmheath

I can't build zig-template on windows 11 either on zig 0.12.0-dev.3180+83e578a18 or zig 0.11.0 :(

build.zig.zon:

.{
    .name = "capy-template",
    .version = "0.0.0",
    .paths = .{"."},
    .dependencies = .{ .capy = .{
        .url = "https://github.com/capy-ui/capy/archive/bde4d1016b4cdebaf4237ea3f50dde306cbe4115.tar.gz",
        .hash = "12209fbb2509ded636aac9233e002679cbaa000d68d44e936d6eb3f36c93a7d4b6f3",
    } },
}

master branch of capy doesn't work either, nor any release I've tried...

Does anyone have a winning combo of zig-template + zig + capy versions?

JoshuaStather avatar Apr 05 '24 17:04 JoshuaStather

i got this error on win11 and ubuntu20, when build this example project: https://github.com/capy-ui/zig-template/archive/refs/heads/main.zip

C:\Users\xxx\AppData\Local\zig\p\12209f37ef449d9324234d06dffe240def0eaa86a7d1492c65a6122124014d71ce68\build_capy.zig:65:34: error: expected type 'net.Server.Connection', found 'mem.Allocator'
        var server = Server.init(allocator, .{ .reuse_address = true });
                                 ^~~~~~~~~
D:\program\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\lib\std\mem\Allocator.zig:1:1: note: struct declared here
//! The standard memory allocation interface.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\program\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\lib\std\net.zig:1904:28: note: struct declared here
    pub const Connection = struct {
                           ^~~~~~
D:\program\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\lib\std\http\Server.zig:35:35: note: parameter type declared here
pub fn init(connection: net.Server.Connection, read_buffer: []u8) Server {
                        ~~~~~~~~~~^~~~~~~~~~~
referenced by:
    create: C:\Users\xxx\AppData\Local\zig\p\12209f37ef449d9324234d06dffe240def0eaa86a7d1492c65a6122124014d71ce68\build_capy.zig:45:40
    install: C:\Users\xxx\AppData\Local\zig\p\12209f37ef449d9324234d06dffe240def0eaa86a7d1492c65a6122124014d71ce68\build_capy.zig:315:44
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

syaoo avatar Jul 03 '24 02:07 syaoo

i got this error on win11 and ubuntu20, when build this example project: https://github.com/capy-ui/zig-template/archive/refs/heads/main.zip

C:\Users\xxx\AppData\Local\zig\p\12209f37ef449d9324234d06dffe240def0eaa86a7d1492c65a6122124014d71ce68\build_capy.zig:65:34: error: expected type 'net.Server.Connection', found 'mem.Allocator'
        var server = Server.init(allocator, .{ .reuse_address = true });
                                 ^~~~~~~~~
D:\program\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\lib\std\mem\Allocator.zig:1:1: note: struct declared here
//! The standard memory allocation interface.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\program\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\lib\std\net.zig:1904:28: note: struct declared here
    pub const Connection = struct {
                           ^~~~~~
D:\program\zig-windows-x86_64-0.12.0-dev.3180+83e578a18\lib\std\http\Server.zig:35:35: note: parameter type declared here
pub fn init(connection: net.Server.Connection, read_buffer: []u8) Server {
                        ~~~~~~~~~~^~~~~~~~~~~
referenced by:
    create: C:\Users\xxx\AppData\Local\zig\p\12209f37ef449d9324234d06dffe240def0eaa86a7d1492c65a6122124014d71ce68\build_capy.zig:45:40
    install: C:\Users\xxx\AppData\Local\zig\p\12209f37ef449d9324234d06dffe240def0eaa86a7d1492c65a6122124014d71ce68\build_capy.zig:315:44
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

ok, this example current target version is zig 0.12.0-dev.2063+804cee3b9 ([2024.1.0-mach]

syaoo avatar Jul 03 '24 02:07 syaoo

Those errors shall all be fixed now that Capy fully upgraded to Zig 0.13.0 / 2024.5.0-mach

zenith391 avatar Jul 06 '24 21:07 zenith391