Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32 on linux64: build run -fwine: host system (x86_64-linux-gnu) is unable to execute binaries from target (x86-windows-gnu) #22361

Open
Des-Nerger opened this issue Dec 30, 2024 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@Des-Nerger
Copy link
Contributor

Zig Version

0.14.0-dev.2577+271452d22

Steps to Reproduce and Observed Behavior

$ winepath -u c:\\windows\\system32 | grep -Eo 'sys.*' # Although I guess it shouldn't matter if this were 'syswow64'.
system32
$ mkdir all-your-base && cd all-your-base && zig init 2>/dev/null && zig build run -fwine -Dtarget=x86-windows-gnu 2>&1 | sed -n '/error:/{p;q}'
error: the host system (x86_64-linux.6.12.6...6.12.6-gnu.2.39) is unable to execute binaries from the target (x86-windows.win10...win11_dt-gnu

Expected Behavior

$ zig targets | grep -FA1 native | tail -n1
  "triple": "x86_64-linux.6.12.6...6.12.6-gnu.2.39",
$ mkdir all-your-base && cd all-your-base && zig init 2>/dev/null && zig build run -fwine -Dtarget=x86-windows-gnu
All your codebase are belong to us.
Run `zig build test` to run the tests.
@Des-Nerger Des-Nerger added the bug Observed behavior contradicts documented or intended behavior label Dec 30, 2024
@Des-Nerger Des-Nerger changed the title win32 on linux64: build run -fwine: host system (x86_64-linux-gnu) is unable to execute binaries from target (x86-windows-gnu) win32 on linux64: build run -fwine: host system (x86_64-linux-gnu) is unable to execute binaries from target (x86-windows-gnu) Dec 30, 2024
@Des-Nerger
Copy link
Contributor Author

A workaround for now:

// build.zig
// ...
const run_cmd = if (target.result.os.tag == .windows and builtin.os.tag != .windows and
    target.result.cpu.arch == .x86 and builtin.cpu.arch == .x86_64)
    b.addSystemCommand(&.{ "wine", "zig-out/bin/app.exe" })
else
    b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
// ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

1 participant