Building the following code with zig build results in what seems like a compiler crash:
error: unable to generate DLL import .lib file for then it just stops.
In the latest version of Zig I think it literally just says Compiler crashed or something
Here's a minial repro. Does anyone magincally know what the issue might? Otherwise could you offer some advice on how I might debug this?
// build.zig.zon
.{
.name = .testy,
.fingerprint = 0xf2b515400f15edcf,
.version = "0.1.0",
.dependencies = .{
.vulkan_headers = .{
.url = "https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.3.283.tar.gz",
.hash = "N-V-__8AAAkkoQGn5z1yoNVrwqZfnYmZp8AZ5CJgoHRMQI0c",
},
.vulkan_zig = .{
.url = "https://github.com/Snektron/vulkan-zig/archive/c66bddee009a8c4b71082ab7af723ed885161650.tar.gz",
.hash = "vulkan-0.0.0-r7YtxwZVAwDbCFXX5GpnS436SfBec9INY0zq-2OQ2BUp",
},
},
.paths = .{
"build.zig",
"src",
},
}
// build.zig
const std = @import("std");
const vkgen = @import("vulkan_zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const module = b.addModule("testy", .{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const exe = b.addExecutable(.{
.name = "testy",
.root_module = module,
});
b.installArtifact(exe);
const vulkan = b.dependency("vulkan_zig", .{
.registry = b.dependency("vulkan_headers", .{}).path("registry/vk.xml"),
}).module("vulkan-zig");
exe.root_module.addImport("vulkan", vulkan);
}
// src/main.zig
const std = @import("std");
const vk = @import("vulkan");
const vkGetInstanceProcAddr = @extern(vk.PfnGetInstanceProcAddr, .{
.name = "vkGetInstanceProcAddr",
.library_name = "vulkan",
});
pub fn main() void {
const vkb = vk.BaseWrapper.load(vkGetInstanceProcAddr);
std.mem.doNotOptimizeAway(vkb);
}