capy-ui / zig-template

Simple template for creating a Capy app in Zig
The Unlicense
26 stars 11 forks source link

zig build run does not work on MacOS, with zig 0.12.0-dev #6

Closed gyulanemeth closed 2 weeks ago

gyulanemeth commented 1 year ago

Hello,

I was trying to run the example with zig build run, and I got the following errors:

`gyulanemeth@Gyula-MacBook-Pro hello-capy % zig build run zig build-exe capy-template Debug native: error: the following command failed with 3 compilation errors: /Users/gyulanemeth/Desktop/zig-macos-x86_64-0.12.0-dev.163+6780a6bbf/zig build-exe /Users/gyulanemeth/private-workspace2/learn-zig/hello-capy/src/main.zig -lobjc -lc --cache-dir /Users/gyulanemeth/private-workspace2/learn-zig/hello-capy/zig-cache --global-cache-dir /Users/gyulanemeth/.cache/zig --name capy-template --mod zigimg::/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/vendor/zigimg/zigimg.zig --mod capy:zigimg,zigwin32:/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/src/main.zig --mod zigwin32::/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/vendor/zigwin32/win32.zig --deps zigwin32,capy -framework CoreFoundation -framework AppKit -framework ApplicationServices -framework CoreData -framework Foundation --subsystem native --listen=- Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none) run transitive failure └─ run capy-template transitive failure └─ zig build-exe capy-template Debug native 3 errors /Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/src/window.zig:41:24: error: no field or member function named 'setCallback' in 'backends.macos.backend.Window' try window.peer.setCallback(.Resize, sizeChanged);


/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/src/backends/macos/backend.zig:53:20: note: struct declared here
pub const Window = struct {
                   ^~~~~~
referenced by:
    main: src/main.zig:10:33
    callMain: /Users/gyulanemeth/Desktop/zig-macos-x86_64-0.12.0-dev.163+6780a6bbf/lib/std/start.zig:574:32
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/src/backends/macos/objc.zig:146:56: error: no field or member function named 'ptrBitWidth' in 'target.Target.Cpu.Arch'
pub const CGFloat = switch (@import("builtin").cpu.arch.ptrBitWidth()) {
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
/Users/gyulanemeth/Desktop/zig-macos-x86_64-0.12.0-dev.163+6780a6bbf/lib/std/target.zig:809:26: note: enum declared here
        pub const Arch = enum {
                         ^~~~
/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/src/window.zig:107:18: error: no field or member function named 'setUserData' in 'backends.macos.backend.Window'
        self.peer.setUserData(self);
        ~~~~~~~~~^~~~~~~~~~~~
/Users/gyulanemeth/.cache/zig/p/1220406249366af87d110f791157cc89a356264557dfbd22804faf03a3be6b3291df/src/backends/macos/backend.zig:53:20: note: struct declared here
pub const Window = struct {
                   ^~~~~~
gyulanemeth@Gyula-MacBook-Pro hello-capy % `
gyulanemeth commented 1 year ago

Shall I use a different zig version perhaps?

zenith391 commented 1 year ago

It's because macOS isn't yet supported, although it's planned.

gyulanemeth commented 1 year ago

I see, thanks for the info. I will try it out on a linux machine then.

What do you think, when will mac os be supported?

zenith391 commented 1 year ago

It depends (notably on whether I can get zig-objcrt to work) but at least a couple months.

dhrubrawat66 commented 8 months ago
  1. zig version ==>0.12.0-dev.3124+9e402704e
  2. but zig build not working on window os 11 this throws follolwing error Screenshot 2024-03-07 201924
zenith391 commented 2 weeks ago

Following the recent changes with the Label and Container component being added to the macOS backend by @geon, this should work now.