Snektron / vulkan-zig

Vulkan binding generator for Zig
MIT License
516 stars 58 forks source link

(MacOS) Errors compiling new vulkan-zig example #137

Open James-Riordan opened 6 months ago

James-Riordan commented 6 months ago

I'm on MacOS, and tested the command zig build --build-file $(pwd)/examples/build.zig run-triangle in vulkan-zig's root.

The following is the terminal output returned when trying to zig build with two different versions dev.4+c7ffdbcd4 and 0.13.0-dev.46+3648d7df1.

dev.4+c7ffdbcd4:

(shortened error):

thread 141985 panic: unable to find artifact 'vulkan-zig-generator'

(full error output):

info: available artifact: 'generator'
info: available artifact: 'triangle'
thread 141985 panic: unable to find artifact 'vulkan-zig-generator'
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/lib/std/Build.zig:1814:18: 0x108d7427d in artifact (build)
            panic("unable to find artifact '{s}'", .{name});
                 ^
/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/build.zig:23:60: 0x108d33961 in build (build)
    const vk_gen = b.dependency("vulkan_zig", .{}).artifact("vulkan-zig-generator");
                                                           ^
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/lib/std/Build.zig:2079:33: 0x108d16cd3 in runBuild__anon_8549 (build)
        .Void => build_zig.build(b),
                                ^
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/lib/compiler/build_runner.zig:300:29: 0x108d11ed6 in main (build)
        try builder.runBuild(root);
                            ^
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/lib/std/start.zig:511:37: 0x108d1951b in main (build)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x7ff8022b7365 in ??? (???)
Unwind information for `???:0x7ff8022b7365` was not available, trace may be incomplete

???:?:?: 0x0 in ??? (???)
error: the following build command crashed:
/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache/o/ef3e54b672e3fd41a6b0ab2daee2ee2e/build /Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/zig /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache /Users/jamesriordan/.cache/zig --seed 0xcff622a8 -Z29695bdf4bf38ab5 run-triangle

0.13.0-dev.46+3648d7df1:

(shortened error):

error: root struct of file 'std' has no member named 'ComptimeStringMap'

(full error output):

/Users/jamesriordan/.cache/zig/p/12203dd92af51de24d95545584c376f2d76698ff0b73d5e5b1cf0e1e12bba2ca4d48/generator/vulkan/render.zig:99:26: error: root struct of file 'std' has no member named 'ComptimeStringMap'
const builtin_types = std.ComptimeStringMap([]const u8, .{
                      ~~~^~~~~~~~~~~~~~~~~~
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.46+3648d7df1/lib/std/std.zig:1:1: note: struct declared here
pub const ArrayHashMap = array_hash_map.ArrayHashMap;
^~~
referenced by:
    renderName: /Users/jamesriordan/.cache/zig/p/12203dd92af51de24d95545584c376f2d76698ff0b73d5e5b1cf0e1e12bba2ca4d48/generator/vulkan/render.zig:564:17
    renderApiConstant: /Users/jamesriordan/.cache/zig/p/12203dd92af51de24d95545584c376f2d76698ff0b73d5e5b1cf0e1e12bba2ca4d48/generator/vulkan/render.zig:477:21
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
Snektron commented 6 months ago

Are you sure that you are on the latest version of vulkan-zig? ComptimeStringMap was removed in #129

James-Riordan commented 6 months ago

Are you sure that you are on the latest version of vulkan-zig? ComptimeStringMap was removed in #129

I downloaded a Zip from the master branch this morning just before trying, so I'd assume so.

I also ran wget https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/xml/vk.xml and put a copy both in registry/ and examples/registry/ just to be safe.

Also, FWIW, I'm running Vulkan-SDK version 1.3.268.1


Edit to this comment:

I just did a CMD + F on the project to search for std.ComptimeStringMap in the render.zig file, but it doesn't exist, like you said. This is a very peculiar issue.

James-Riordan commented 6 months ago

User Error discovered. I accidentally swapped out .vulkan_zig in build.zig.zon to use an outdated version.

Regardless, with version issues fixed, I still receive the following errors:

0.13.0-dev.46+3648d7df1:

run-triangle
└─ run triangle
   └─ install
      └─ install triangle
         └─ zig build-exe triangle Debug native failure
error: error: unable to find dynamic system library 'glfw' using strategy 'paths_first'. searched paths:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/lib/libglfw.tbd
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/lib/libglfw.dylib
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/lib/libglfw.so
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/lib/libglfw.a

error: the following command exited with error code 1:
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.46+3648d7df1/zig build-exe -lglfw -ODebug --dep vulkan --dep shaders -Mroot=/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/triangle.zig -Mvulkan=/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache/o/a620a53e2ae7bb70b2852b2d64811abf/vk.zig -Mshaders=/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache/shaders/h0G5grXZG86KQANON22yZ35X6HJ-GAcca_RGBn0wpnDB_VkZjjCUPzkfOEwwsl05 -lc --cache-dir /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache --global-cache-dir /Users/jamesriordan/.cache/zig --name triangle --listen=- 
Build Summary: 3/8 steps succeeded; 1 failed (disable with --summary none)
run-triangle transitive failure
└─ run triangle transitive failure
   ├─ zig build-exe triangle Debug native failure
   └─ install transitive failure
      └─ install triangle transitive failure
         └─ zig build-exe triangle Debug native (+2 more reused dependencies)
error: the following build command failed with exit code 1:
/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache/o/74e2174d1d8d2a4c0108d29b83b7abe7/build /Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.46+3648d7df1/zig /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache /Users/jamesriordan/.cache/zig --seed 0xc92bc799 -Z60b5da14e6314465 run-triangle

0.13.0-dev.4+c7ffdbcd4:

run-triangle
└─ run triangle
   └─ zig build-exe triangle Debug native
      └─ run vulkan-zig-generator (vk.zig)
         └─ zig build-exe vulkan-zig-generator Debug native 1 errors
src/vulkan/render.zig:106:26: error: root struct of file 'std' has no member named 'StaticStringMap'
const builtin_types = std.StaticStringMap([]const u8).initComptime(.{
                      ~~~^~~~~~~~~~~~~~~~
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/lib/std/std.zig:1:1: note: struct declared here
pub const ArrayHashMap = array_hash_map.ArrayHashMap;
^~~
referenced by:
    renderName: src/vulkan/render.zig:604:17
    renderApiConstant: src/vulkan/render.zig:517:21
    remaining reference traces hidden; use '-freference-trace' to see all reference traces
error: the following command failed with 1 compilation errors:
/Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/zig build-exe -ODebug -Mroot=/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/src/main.zig --cache-dir /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache --global-cache-dir /Users/jamesriordan/.cache/zig --name vulkan-zig-generator --listen=- 
Build Summary: 1/8 steps succeeded; 1 failed (disable with --summary none)
run-triangle transitive failure
└─ run triangle transitive failure
   ├─ zig build-exe triangle Debug native transitive failure
   │  └─ run vulkan-zig-generator (vk.zig) transitive failure
   │     └─ zig build-exe vulkan-zig-generator Debug native 1 errors
   └─ install transitive failure
      └─ install triangle transitive failure
         └─ zig build-exe triangle Debug native (+2 more reused dependencies)
error: the following build command failed with exit code 1:
/Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache/o/bb7b12f38710e2aafd46fe8ef991cfc5/build /Users/jamesriordan/zig/zig-macos-x86_64-0.13.0-dev.4+c7ffdbcd4/zig /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples /Users/jamesriordan/Workspaces/Code-Examples/vulkan-zig-master/examples/zig-cache /Users/jamesriordan/.cache/zig --seed 0x4f061167 -Z8174ad513090a2b2 run-triangle
Snektron commented 6 months ago

0.13.0-dev.4+c7ffdbcd4:

This build is too old, it was before the change relevant to #129. Regarding the other issue, well, it can't find GLFW. I'm not too familiar with how dependencies work on Mac OS to be honest, so I doubt that I can be of much help. Its not downloaded automatically by Zig at least - it needs to be provided by your system.