-
Notifications
You must be signed in to change notification settings - Fork 31
Description
When creating a simple project with
zig 0.15.2
zglfw (latest commit as of 2025/11/5)
vulkan-zig (latest commit as of 2025/11/5 of 0.15-compat branch)
with the build.zig ;ooking like
...
const vulkan_headers = b.dependency("vulkan_headers",.{});
const vulkan = b.dependency("vulkan_zig", .{
.registry = vulkan_headers.path("registry/vk.xml"),
}).module("vulkan-zig");
gpu.addImport("vulkan", vulkan);
lib_mod.addImport("vulkan", vulkan);
const zglfw = b.dependency("zglfw", .{
.target = target,
.optimize = optimize,
.import_vulkan = true,
});
zglfw.module("root").addImport("vulkan", vulkan);
lib_mod.linkLibrary(zglfw.artifact("glfw"));
...
the following snippet always fails and return error.NoVulkan
if(glfw.isVulkanSupported()) {
std.log.err("GLFW could not find libvulkan", .{});
return error.NoVulkan;
}
I have tested with my Linux distribution's native package manager and building against the native c version of glfw work perfectly every time.
Am I making a stupid error ? or is there some reason that zglfw does not seem to be able to dynamically link libvulkan.so but the native package managers version of glfw can do so easily ?
I also attempted to add the zig-gamedev/system_sdk to the project, by adding
if (target.result.os.tag == .linux) {
if (b.lazyDependency("system_sdk", .{})) |system_sdk| {
lib_mod.addLibraryPath(system_sdk.path("linux/lib/x86_64-linux-gnu"));
}
}
into the build.zig file
I also tried to add a a Library path for zglfw, by adding
if (target.result.os.tag == .linux) {
zglfw.module("root").addLibraryPath(
std.Build.LazyPath{.cwd_relative = "/usr/lib"}
);
}
into build.zig
I have also tried various combinations of
exe.linkSystemLibrary("vulkan");
lib.linkSystemLibrary("vulkan");
zglfw.module("root").linkSystemLibrary("vulkan")
But i recon these fail due to glfw only loading libvulkan dynamically.