Zig from msys2 dose not use msys2

i tryd zig libc -target x86_64-windows-gnu but it dose not work

$ zig libc -target x86_64-windows-gnu
error: unable to detect libc for non-native target
error: the following build command failed with exit code 1:
C:\\Users\\heloonihao\\AppData\\Local\\zig\\o\\a1c86a5b85607a86e1df5ddacc7d4773\\libc.exe D:\\msys64\\clang64lib\\zig -target x86_64-windows-gnu

build.zig

const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{ .default_target = .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu } });
    const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .Debug });

    const vulkan_zig = b.addModule("vulkan-zig", .{
        .root_source_file = b.path("src/vk.zig"),
        .target = target,
    });

    const renderer = b.addModule("renderer", .{
        .root_source_file = b.path("src/Renderer.zig"),
        .target = target,
    });

    const exe = b.addExecutable(.{
        .name = "cardzig",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{ .{ .name = "vulkan", .module = vulkan_zig }, .{ .name = "renderer", .module = renderer } },
        }),
    });

    exe.linkLibC();
    exe.linkSystemLibrary2("sdl3", .{ .use_pkg_config = .yes });
}
$ zig build -Dtarget=x86_64-windows-gnu
install
└─ install cardzig
   └─ compile exe cardzig Debug x86_64-windows-gnu failure
error: error: unable to find dynamic system library 'SDL3' using strategy 'paths_first'. searched paths: none

error: the following command exited with error code 1:
"D:\\msys64\\clang64\\bin\\zig.exe" build-exe -lSDL3 -ODebug -target x86_64-windows-gnu -mcpu baseline --dep vulkan --dep renderer "-Mroot=D:\\Proj\\cardzig\\src\\main.zig" -target x86_64-windows-gnu -mcpu baseline "-Mvulkan=D:\\Proj\\cardzig\\src\\vk.zig" -target x86_64-windows-gnu -mcpu baseline "-Mrenderer=D:\\Proj\\cardzig\\src\\Renderer.zig" -lc --cache-dir .zig-cache --global-cache-dir "C:\\Users\\heloonihao\\AppData\\Local\\zig" --name cardzig --zig-lib-dir "D:\\msys64\\clang64\\lib\\zig\\" --listen=-

We don’t generally put any effort into supporting environments like Cygwin and MSYS2 in Zig; Zig is native Windows software. To the extent that any patches are required to support these environments, they should be carried in downstream packaging. So that’s where you’d want to open an issue.

1 Like