Build on Linux: cross-compile for MSVC, run under Wine #195

Closed
Naitrate wants to merge 1 commit from upstream-pr/195 into main
Naitrate commented 2026-11-24 01:18:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Naitrate on 2026-11-24T01:18:16Z.


What

VIctory can now be built on Linux and run under Wine. It is still a Windows program: it is cross-compiled for x86_64-pc-windows-msvc with cargo-xwin and run with VKD3D-Proton and DXVK.

  • README: a "Building and running on Linux" section covering the toolchain (rustup, cargo-xwin, clang-cl, lld-link, llvm-lib), a Wine prefix with VKD3D-Proton and DXVK, running the title, and which tests fail under Wine.
  • shell.nix: the toolchain for Nix users, plus WINEPREFIX, DLL overrides, the test runner, and the VKD3D-Proton/DXVK shader caches kept in the prefix.
  • Asset policy: allows .nix files.
  • Wine's missing network functions: Wine's ws2_32.dll lacks WSAConnectByList and GetAddrInfoExA, and its winhttp.dll lacks WinHttpGetProxySettingsEx. Forwarding to them panicked (the host lacks ...).
    • WSAConnectByList now tries each vetted candidate in turn with connect. It blocks, and the timeout isn't honoured.
    • GetAddrInfoExA answers WSAHOST_NOT_FOUND, as it already does for a blocked name.
    • WinHttpGetProxySettingsEx never calls the host's function. The export test exempts all three, and a new test covers the connect fallback.
  • view_format is #[cfg(windows)], like host_resource, its only callee. Before this, cargo test --workspace failed on any non-Windows host with cannot find function host_resource.
  • .githooks/pre-commit is executable (100755). Git ignored it on Linux even after cargo xtask install-hooks reported it as installed.

Why

Wine's own D3D12 rejects the shader model 6.6 query (E_INVALIDARG), so the title shows only a white window. VKD3D-Proton reports SM 6.6–6.8 and runs the translated shaders.

Testing

Tested on NixOS with Wine 11.21 (Staging), VKD3D-Proton 3.0.1, DXVK 3.1.1 and an RTX 5060 Ti:

  • cargo xwin build --release --target x86_64-pc-windows-msvc builds.
  • cargo xwin test -p victory-hle under Wine passes all 87 tests, including only_loopback_is_reachable, which panicked before.
  • The full workspace under Wine passes 259 tests and fails 6:
    • Environment: load_probe and repository_passes_policy (they start cargo and git from inside Wine), and stub_pipeline_is_created (VKD3D-Proton doesn't check DXIL hashes).
    • Not yet explained: buffer_data_reaches_the_host_texture, argument_clamp_builds and a_rejected_blob_gives_an_empty_library fail under VKD3D-Proton. The README lists them.
  • cargo xtask policy and the xtask tests pass natively.
  • The title starts, plays its first screens at 30 fps, and stops after about a minute on one of its own assertions. I'm investigating that separately; this PR doesn't change it.

Not tested on Windows. Every Rust change is a no-op there except the WSAConnectByList and GetAddrInfoExA fallbacks, which only run when the host lacks those exports.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6572399335 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/195). Originally posted by [Naitrate](https://github.com/Naitrate) on 2026-11-24T01:18:16Z. --- ## What VIctory can now be built on Linux and run under Wine. It is still a Windows program: it is cross-compiled for `x86_64-pc-windows-msvc` with cargo-xwin and run with VKD3D-Proton and DXVK. - **README:** a "Building and running on Linux" section covering the toolchain (rustup, cargo-xwin, clang-cl, lld-link, llvm-lib), a Wine prefix with VKD3D-Proton and DXVK, running the title, and which tests fail under Wine. - **`shell.nix`:** the toolchain for Nix users, plus `WINEPREFIX`, DLL overrides, the test runner, and the VKD3D-Proton/DXVK shader caches kept in the prefix. - **Asset policy:** allows `.nix` files. - **Wine's missing network functions:** Wine's `ws2_32.dll` lacks `WSAConnectByList` and `GetAddrInfoExA`, and its `winhttp.dll` lacks `WinHttpGetProxySettingsEx`. Forwarding to them panicked (`the host lacks ...`). - `WSAConnectByList` now tries each vetted candidate in turn with `connect`. It blocks, and the timeout isn't honoured. - `GetAddrInfoExA` answers `WSAHOST_NOT_FOUND`, as it already does for a blocked name. - `WinHttpGetProxySettingsEx` never calls the host's function. The export test exempts all three, and a new test covers the `connect` fallback. - **`view_format` is `#[cfg(windows)]`**, like `host_resource`, its only callee. Before this, `cargo test --workspace` failed on any non-Windows host with `cannot find function host_resource`. - **`.githooks/pre-commit` is executable (100755).** Git ignored it on Linux even after `cargo xtask install-hooks` reported it as installed. ## Why Wine's own D3D12 rejects the shader model 6.6 query (`E_INVALIDARG`), so the title shows only a white window. VKD3D-Proton reports SM 6.6–6.8 and runs the translated shaders. ## Testing Tested on NixOS with Wine 11.21 (Staging), VKD3D-Proton 3.0.1, DXVK 3.1.1 and an RTX 5060 Ti: - `cargo xwin build --release --target x86_64-pc-windows-msvc` builds. - `cargo xwin test -p victory-hle` under Wine passes all 87 tests, including `only_loopback_is_reachable`, which panicked before. - The full workspace under Wine passes 259 tests and fails 6: - Environment: `load_probe` and `repository_passes_policy` (they start `cargo` and `git` from inside Wine), and `stub_pipeline_is_created` (VKD3D-Proton doesn't check DXIL hashes). - Not yet explained: `buffer_data_reaches_the_host_texture`, `argument_clamp_builds` and `a_rejected_blob_gives_an_empty_library` fail under VKD3D-Proton. The README lists them. - `cargo xtask policy` and the xtask tests pass natively. - The title starts, plays its first screens at 30 fps, and stops after about a minute on one of its own assertions. I'm investigating that separately; this PR doesn't change it. Not tested on Windows. Every Rust change is a no-op there except the `WSAConnectByList` and `GetAddrInfoExA` fallbacks, which only run when the host lacks those exports. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SkippySteve commented 2026-11-24 01:28:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T01:28:28Z.

Review: APPROVED


I checked this out on a second Linux host (Arch, UMU-Proton 11.0-2e, whose prefix ships vkd3d-proton and DXVK) and re-ran the tests. I did not launch the title; this covers the crate tests and the docs only. I could not test on Windows.

Results

Cross-build: cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-run builds all 13 test binaries cleanly at 4b38ecf.

victory-hle under Proton's wine, at 4b38ecf compared with main (d2a4bae):

main this PR
victory-hle unit tests 85 passed, 1 failed (only_loopback_is_reachable: ws2_32.dll lacks WSAConnectByList) 87 passed, 0 failed (including the new connect_by_list_falls_back_to_connect)
no_dll_planting 1/1 1/1

So the missing-export panic happens on Proton's Wine too, not only on Wine Staging 11.21, and this PR fixes it.

Full workspace under wine with WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11=n,b": 259 passed and 6 failed. These are the same numbers and the same six tests as in the PR description:

  • Caused by the environment: load_probe (running cargo: Invalid handle), repository_passes_policy (running git) and stub_pipeline_is_created (digest [00 …] accepted).
  • Not yet explained, failing the same way here: buffer_data_reaches_the_host_texture (row 0 reads back all zeros), argument_clamp_builds (clamp().is_some() fails) and a_rejected_blob_gives_an_empty_library. Those three also fail on a second vendor/driver stack, so the cause is probably in vkd3d-proton, not this PR.

For contrast, without the overrides (Wine's builtin d3d12) those four GPU tests pass. Instead, 7 valu_tests fail with neither hardware nor WARP SM 6.6 device available. That supports the README's point that Wine's own D3D12 is not enough.

Native Linux:

  • The #[cfg(windows)] on view_format works. On main, cargo test -p victory-gpu stops at E0425 cannot find function host_resource. On this branch it builds and passes 23 tests.
  • cargo xtask policy passes (152 files). .githooks/pre-commit is now 100755 in the index.

Notes (none of them blocking)

  1. The vkd3d cache can break the policy check, and not only for Nix users. I ran the tests from the repository root without shell.nix, and vkd3d-proton left a vkd3d-proton.cache there. After that, cargo xtask policy failed with binary content (NUL bytes). shell.nix already handles this. The README's plain-Wine steps could add the same two lines (export VKD3D_SHADER_CACHE_PATH=… DXVK_STATE_CACHE_PATH=…) so that people who don't use Nix don't hit it.
  2. Wording of the "cargo test --workspace on non-Windows" claim. The gpu fix works. However, a native cargo test --workspace still stops in victory-hle (windows_sys, xmem, lifecycle, files are not gated; that is #90/#112). Saying "victory-gpu now builds on non-Windows hosts" would be more accurate.
  3. connect_each (minor, and only reachable with loopback candidates). If the socket is non-blocking, connect returns WSAEWOULDBLOCK, and the code then treats that candidate as failed. The real WSAConnectByList blocks regardless of the socket's mode. The doc comment already says "Blocking; the timeout is not kept". It could also mention that a non-blocking socket will report failure here. Retrying connect on the same socket after WSAECONNREFUSED is allowed by the Winsock docs, so trying the candidates in turn is fine.

Overlap with #149

#149 (docs/linux-proton.md plus a one-line README pointer) covers host tests, the umu-run/Proton flow, logging through cmd.exe /c, and the list of open Wine PRs. This PR covers the code fixes, shell.nix, and a plain-Wine section in the README. They mostly complement each other. My suggested merge order is #195 first. #149 would then be rebased on top of it to:

  • drop its "main does not build on Linux: host_resource" paragraph, which this PR fixes;
  • link to this README section for the plain-Wine and Nix setup instead of repeating it;
  • keep only the Proton/umu specifics.

If it's useful, this section could later link to docs/linux-proton.md for Proton users, but that can be done in #149.

Approving: the code changes are small, are gated so that they only take effect when the host lacks the export, and I reproduced every test number in the description.

<!-- greyfinch-sync:Marvisak/VIctory:review:6032258807 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/195#pullrequestreview-6032258807). Originally posted by [SkippySteve](https://github.com/SkippySteve) on 2026-11-24T01:28:28Z. **Review:** APPROVED --- I checked this out on a second Linux host (Arch, UMU-Proton 11.0-2e, whose prefix ships vkd3d-proton and DXVK) and re-ran the tests. I did not launch the title; this covers the crate tests and the docs only. I could not test on Windows. ## Results **Cross-build:** `cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-run` builds all 13 test binaries cleanly at 4b38ecf. **victory-hle under Proton's wine, at 4b38ecf compared with `main` (d2a4bae):** | | main | this PR | |---|---|---| | victory-hle unit tests | 85 passed, 1 failed (`only_loopback_is_reachable`: `ws2_32.dll lacks WSAConnectByList`) | **87 passed**, 0 failed (including the new `connect_by_list_falls_back_to_connect`) | | no_dll_planting | 1/1 | 1/1 | So the missing-export panic happens on Proton's Wine too, not only on Wine Staging 11.21, and this PR fixes it. **Full workspace under wine with `WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11=n,b"`:** 259 passed and 6 failed. These are the same numbers and the same six tests as in the PR description: - Caused by the environment: `load_probe` (`running cargo: Invalid handle`), `repository_passes_policy` (`running git`) and `stub_pipeline_is_created` (`digest [00 …] accepted`). - Not yet explained, failing the same way here: `buffer_data_reaches_the_host_texture` (row 0 reads back all zeros), `argument_clamp_builds` (`clamp().is_some()` fails) and `a_rejected_blob_gives_an_empty_library`. Those three also fail on a second vendor/driver stack, so the cause is probably in vkd3d-proton, not this PR. For contrast, without the overrides (Wine's builtin d3d12) those four GPU tests pass. Instead, 7 `valu_tests` fail with `neither hardware nor WARP SM 6.6 device available`. That supports the README's point that Wine's own D3D12 is not enough. **Native Linux:** - The `#[cfg(windows)]` on `view_format` works. On `main`, `cargo test -p victory-gpu` stops at `E0425 cannot find function host_resource`. On this branch it builds and passes 23 tests. - `cargo xtask policy` passes (152 files). `.githooks/pre-commit` is now `100755` in the index. ## Notes (none of them blocking) 1. **The vkd3d cache can break the policy check, and not only for Nix users.** I ran the tests from the repository root without `shell.nix`, and vkd3d-proton left a `vkd3d-proton.cache` there. After that, `cargo xtask policy` failed with `binary content (NUL bytes)`. `shell.nix` already handles this. The README's plain-Wine steps could add the same two lines (`export VKD3D_SHADER_CACHE_PATH=… DXVK_STATE_CACHE_PATH=…`) so that people who don't use Nix don't hit it. 2. **Wording of the "`cargo test --workspace` on non-Windows" claim.** The gpu fix works. However, a native `cargo test --workspace` still stops in `victory-hle` (`windows_sys`, `xmem`, `lifecycle`, `files` are not gated; that is #90/#112). Saying "victory-gpu now builds on non-Windows hosts" would be more accurate. 3. **`connect_each` (minor, and only reachable with loopback candidates).** If the socket is non-blocking, `connect` returns `WSAEWOULDBLOCK`, and the code then treats that candidate as failed. The real `WSAConnectByList` blocks regardless of the socket's mode. The doc comment already says "Blocking; the timeout is not kept". It could also mention that a non-blocking socket will report failure here. Retrying `connect` on the same socket after `WSAECONNREFUSED` is allowed by the Winsock docs, so trying the candidates in turn is fine. ## Overlap with #149 #149 (`docs/linux-proton.md` plus a one-line README pointer) covers host tests, the umu-run/Proton flow, logging through `cmd.exe /c`, and the list of open Wine PRs. This PR covers the code fixes, `shell.nix`, and a plain-Wine section in the README. They mostly complement each other. My suggested merge order is **#195 first**. #149 would then be rebased on top of it to: - drop its "main does not build on Linux: `host_resource`" paragraph, which this PR fixes; - link to this README section for the plain-Wine and Nix setup instead of repeating it; - keep only the Proton/umu specifics. If it's useful, this section could later link to `docs/linux-proton.md` for Proton users, but that can be done in #149. Approving: the code changes are small, are gated so that they only take effect when the host lacks the export, and I reproduced every test number in the description.
upstream-sync closed this pull request 2026-11-24 06:51:47 +00:00
ligmaSec commented 2026-11-24 06:54:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ligmaSec on 2026-11-24T01:20:49Z.


duplicate of #191

<!-- greyfinch-sync:Marvisak/VIctory:comment:7119009096 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/195#issuecomment-7119009096). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-11-24T01:20:49Z. --- duplicate of #191
DaviTostes commented 2026-11-24 06:54:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:27:27Z.


Tested 4b38ecf under Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build of victory-hle: 87 passed, 0 failed, 0 ignored.

  • The WSAConnectByList fallback in net.rs fixes the one failure the suite had here (Wine's ws2_32 does not export it): modules::net::tests::only_loopback_is_reachable now passes, and the whole HLE suite is green.
  • The #[cfg(windows)] on view_format and the shell.nix/README additions also apply cleanly.
  • This does not touch #128; the GPU upload test is still the only cross-environment GPU failure.

No game data used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7119117738 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/195#issuecomment-7119117738). Originally posted by [DaviTostes](https://github.com/DaviTostes) on 2026-11-24T01:27:27Z. --- Tested `4b38ecf` under **Wine 11.22 + vkd3d-proton 3.1** on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build of `victory-hle`: **87 passed, 0 failed, 0 ignored**. - The `WSAConnectByList` fallback in `net.rs` fixes the one failure the suite had here (Wine's `ws2_32` does not export it): `modules::net::tests::only_loopback_is_reachable` now passes, and the whole HLE suite is green. - The `#[cfg(windows)]` on `view_format` and the shell.nix/README additions also apply cleanly. - This does not touch #128; the GPU upload test is still the only cross-environment GPU failure. No game data used.
Naitrate commented 2026-11-24 06:54:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Naitrate on 2026-11-24T01:31:07Z.


Closing as a duplicate of #191, which covers the Linux build. The parts #191 doesn't include (Wine fallbacks for missing ws2_32 exports, the view_format cfg fix and the pre-commit hook's executable bit) will follow in a separate, smaller PR that works with either toolchain.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7119177711 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/195#issuecomment-7119177711). Originally posted by [Naitrate](https://github.com/Naitrate) on 2026-11-24T01:31:07Z. --- Closing as a duplicate of #191, which covers the Linux build. The parts #191 doesn't include (Wine fallbacks for missing ws2_32 exports, the `view_format` cfg fix and the pre-commit hook's executable bit) will follow in a separate, smaller PR that works with either toolchain.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!195
No description provided.