feat(devcontainer): the whole toolchain in a container, nothing on the host #407

Open
github-bot wants to merge 7 commits from github-bot/gh-407 into main AGit
Owner

@⁠Luxuride on GitHub · 2026-12-04 00:53 UTC · original
Luxuride:pr/devcontainer → main · +1007 −0 · 10 files · 7 commits · open

Why

docs/BUILD.md asks for clang-cl, lld-link, llvm-lib, mingw-w64 (with widl), ninja, glslang, flex, bison, unshare, libdrm ≥ 2.4.133 and wayland-protocols ≥ 1.49. On a distribution that ships older ones, every step of setup.sh is a package manager away, and most of those want root.

What it changes

No sudo. Just podman or docker, as your own user.

  • No host packages, no root-owned files in the checkout, nothing written outside it.
  • setup.sh and build.sh are unchanged and run as docs/BUILD.md describes.
  • Artifacts land in the tree through the mount: deps/msvc, deps/mesa-inst, deps/vkd3d/build, target/x86_64-pc-windows-msvc/release/victory.exe.
  • ./run.sh play still runs on the host unchanged; .devcontainer/play.sh is what runs it in a container over Wayland, and what it can and cannot do is spelled out below.

What it is not

  • It builds; playback over Wayland is wired but not yet verified. A run inside the container reaches title pipelines known and then blocks with no CPU and no error of its own; on the host the same binary reaches its device and presents frames, so the difference is inside the container and is still being chased. setup.sh wine|prefix|fsr4 are not supported inside it.
  • Two stand-ins. systemd-run --user (the scope only caps memory) and wine do not exist in a container. .devcontainer/standins carries a marked stand-in for each: the first runs the command it was given, the second answers command -v and explains if a step that needs Wine is asked for. Neither touches the checkout.
  • glibc 2.39 floor. The image is Ubuntu 24.04 deliberately: the host loads the driver it builds, so a host older than 2.39 cannot.

The one line outside .devcontainer

xtask/src/policy.rs allows a file by name or extension and Dockerfile is neither, so it is added to ALLOWED_NAMES, with an assertion in the same file's tests. The stand-ins are .sh and the image copies them into place under their real names, so nothing else needs an entry.

Since the first version

Three things were added to this branch after using it to carry real work:

  • .devcontainer/env.sh — the Windows target's sysroot in one place. It was
    four exports per command (CARGO_TARGET_…_LINKER, CC_…, AR_…, and the
    /winsysroot: flag), and the one that gets forgotten is the one that fails ten
    minutes later, in a crate's build script, with
    failed to find tool "ml64.exe":

    ./.devcontainer/env.sh cargo check -p victory-gpu --tests
    
  • The caches — the target, lld-link, clang-cl, llvm-lib and /target
    are in containerEnv, and four named volumes keep the cargo registry, cargo's
    git checkouts, /target and sccache between containers. sccache is in the
    image, pinned and checksummed. hostRequirements makes a small machine fail at
    up rather than at Mesa. post-create.sh takes the volumes as its user, runs
    cargo fetch --locked, and says so when devcontainer.json's Rust pin and
    rust-toolchain.toml disagree — the feature's version is the same number
    said twice.

  • .devcontainer/play.sh — a Wayland play run, which is the one thing the
    first version said it could not do. The host's compositor socket, /dev/dri,
    /dev/input (pads), PipeWire's pulse socket and a read-only Proton go in;
    --memory takes over the cap run.sh gets from systemd-run. The image gains
    the client libraries playing needs — xkbcommon, PulseAudio, ALSA, freetype,
    fontconfig, gnutls — and no build touches them.

The README gained the parts that only show up in use: podman and
userns=keep-id, the render node's permissions, :z versus
--security-opt=label=disable, the caches, and what the Wayland path leaves to
watch.

Verified

Inside the container, from an image built after podman rmi:

  • ./setup.sh sdk dlls mesa vkd3d victory — all pass; Mesa 26.3.1 builds in 1 m 03 s, victory in 1 m 07 s, the whole sequence in 14 s once the trees are present.

  • deps/mesa-inst/lib/x86_64-linux-gnu/libvulkan_radeon.so 21,630,216 B; deps/vkd3d/build/libs/d3d12core/d3d12core.dll 8,878,384 B; target/x86_64-pc-windows-msvc/release/victory.exe 13,596,160 B.

  • cargo xtask policy — 0 violations under .devcontainer; cargo test -p xtask accepts_source passes.

  • ./.devcontainer/env.sh cargo check -p victory-pe --tests — Finished in 8 s,
    against deps/msvc from setup.sh sdk.

  • A play image built from this Dockerfile: vulkaninfo --summary enumerates the
    cards through deps/mesa-inst's radeon_icd.x86_64.json (RX 7900 XTX,
    RX 6700 XT, the 9950X3D's iGPU), and VK_KHR_wayland_surface surfaces are
    created on the host's compositor.

  • Proton 11.0/files/bin/wine --version → wine-11.0 inside the container,
    against this image's glibc, with no Steam Linux Runtime around it.

  • bash .devcontainer/post-create.sh → exit 0: toolchain, tools, Mesa's
    pkg-config dependencies, the stand-in notices, and the crates fetched.

  • A real ./.devcontainer/play.sh run against the title: victory.exe starts
    under the host's Proton Experimental, the loader finds the dump through
    winepath's Z:\ mapping, and the pipeline cache is read
    (title pipelines known from earlier runs pipelines=94203 shaders=25761).
    It stops there: no device is created and no frame is presented, so nothing
    here claims playback.

  • Two defects that run found and this PR fixes: the image shipped no Vulkan
    ICD at all
    (/usr/share/vulkan/icd.d did not exist, vkCreateInstance: Found no drivers!), which is why the title sat at that line silently; it now
    installs Mesa's RADV for both architectures, and vulkaninfo --summary inside
    the image enumerates the host's card. And the 32-bit loader, the missing
    Proton path and the unmounted dump described below.

  • Two defects that only a real run finds, both fixed here: run.sh sources
    run.conf, so a PROTON= there cannot be overridden by the environment and
    Proton has to be mounted at the path it names; and Proton's 32-bit side needs
    libc6:i386, without which wine stops at
    /lib/ld-linux.so.2: could not open before printing its own banner.

Three things a fresh Ubuntu 24.04 does not have, and what the image does about them: meson (apt), widl (mingw-w64-tools ships only x86_64-w64-mingw32-widl, so it is linked), and mingw-w64 headers 13 — vkd3d-proton needs PATHCCH_NONE, which the distribution's 11 lacks.

Still red elsewhere

cargo test -p xtask on this branch is 9 passed, 1 failed:
switches::documented_switches_are_read. That is a documentation/switch defect
unrelated to the container and already being handled elsewhere; this branch does
not touch it. The asset-policy half that used to be red here now passes —
cargo test -p xtask policy → 7 passed, cargo xtask policy →
asset policy: 366 files ok — which is also why the Dockerfile name this
change adds to ALLOWED_NAMES is still the only line it needs there.

**@⁠Luxuride** on GitHub · 2026-12-04 00:53 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/407) `Luxuride:pr/devcontainer` → `main` · +1007 −0 · 10 files · 7 commits · open ## Why `docs/BUILD.md` asks for clang-cl, lld-link, llvm-lib, mingw-w64 (with `widl`), ninja, glslang, flex, bison, `unshare`, libdrm ≥ 2.4.133 and wayland-protocols ≥ 1.49. On a distribution that ships older ones, every step of `setup.sh` is a package manager away, and most of those want root. ## What it changes **No `sudo`. Just podman or docker, as your own user.** - No host packages, no root-owned files in the checkout, nothing written outside it. - `setup.sh` and `build.sh` are unchanged and run as `docs/BUILD.md` describes. - Artifacts land in the tree through the mount: `deps/msvc`, `deps/mesa-inst`, `deps/vkd3d/build`, `target/x86_64-pc-windows-msvc/release/victory.exe`. - `./run.sh play` still runs on the host unchanged; `.devcontainer/play.sh` is what runs it in a container over Wayland, and what it can and cannot do is spelled out below. ## What it is not - **It builds; playback over Wayland is wired but not yet verified.** A run inside the container reaches `title pipelines known` and then blocks with no CPU and no error of its own; on the host the same binary reaches its device and presents frames, so the difference is inside the container and is still being chased. `setup.sh wine|prefix|fsr4` are not supported inside it. - **Two stand-ins.** `systemd-run --user` (the scope only caps memory) and `wine` do not exist in a container. `.devcontainer/standins` carries a marked stand-in for each: the first runs the command it was given, the second answers `command -v` and explains if a step that needs Wine is asked for. Neither touches the checkout. - **glibc 2.39 floor.** The image is Ubuntu 24.04 deliberately: the host loads the driver it builds, so a host older than 2.39 cannot. ## The one line outside `.devcontainer` `xtask/src/policy.rs` allows a file by name or extension and `Dockerfile` is neither, so it is added to `ALLOWED_NAMES`, with an assertion in the same file's tests. The stand-ins are `.sh` and the image copies them into place under their real names, so nothing else needs an entry. ## Since the first version Three things were added to this branch after using it to carry real work: - **`.devcontainer/env.sh`** — the Windows target's sysroot in one place. It was four exports per command (`CARGO_TARGET_…_LINKER`, `CC_…`, `AR_…`, and the `/winsysroot:` flag), and the one that gets forgotten is the one that fails ten minutes later, in a crate's build script, with `failed to find tool "ml64.exe"`: ```sh ./.devcontainer/env.sh cargo check -p victory-gpu --tests ``` - **The caches** — the target, `lld-link`, `clang-cl`, `llvm-lib` and `/target` are in `containerEnv`, and four named volumes keep the cargo registry, cargo's git checkouts, `/target` and `sccache` between containers. `sccache` is in the image, pinned and checksummed. `hostRequirements` makes a small machine fail at `up` rather than at Mesa. `post-create.sh` takes the volumes as its user, runs `cargo fetch --locked`, and says so when `devcontainer.json`'s Rust pin and `rust-toolchain.toml` disagree — the feature's `version` is the same number said twice. - **`.devcontainer/play.sh`** — a Wayland play run, which is the one thing the first version said it could not do. The host's compositor socket, `/dev/dri`, `/dev/input` (pads), PipeWire's pulse socket and a read-only Proton go in; `--memory` takes over the cap `run.sh` gets from `systemd-run`. The image gains the client libraries playing needs — xkbcommon, PulseAudio, ALSA, freetype, fontconfig, gnutls — and no build touches them. The README gained the parts that only show up in use: podman and `userns=keep-id`, the render node's permissions, `:z` versus `--security-opt=label=disable`, the caches, and what the Wayland path leaves to watch. ## Verified Inside the container, from an image built after `podman rmi`: - `./setup.sh sdk dlls mesa vkd3d victory` — all pass; Mesa 26.3.1 builds in 1 m 03 s, `victory` in 1 m 07 s, the whole sequence in 14 s once the trees are present. - `deps/mesa-inst/lib/x86_64-linux-gnu/libvulkan_radeon.so` 21,630,216 B; `deps/vkd3d/build/libs/d3d12core/d3d12core.dll` 8,878,384 B; `target/x86_64-pc-windows-msvc/release/victory.exe` 13,596,160 B. - `cargo xtask policy` — 0 violations under `.devcontainer`; `cargo test -p xtask accepts_source` passes. - `./.devcontainer/env.sh cargo check -p victory-pe --tests` — Finished in 8 s, against `deps/msvc` from `setup.sh sdk`. - A play image built from this Dockerfile: `vulkaninfo --summary` enumerates the cards through `deps/mesa-inst`'s `radeon_icd.x86_64.json` (RX 7900 XTX, RX 6700 XT, the 9950X3D's iGPU), and `VK_KHR_wayland_surface` surfaces are created on the host's compositor. - `Proton 11.0/files/bin/wine --version` → `wine-11.0` inside the container, against this image's glibc, with no Steam Linux Runtime around it. - `bash .devcontainer/post-create.sh` → exit 0: toolchain, tools, Mesa's pkg-config dependencies, the stand-in notices, and the crates fetched. - A real `./.devcontainer/play.sh` run against the title: `victory.exe` starts under the host's Proton Experimental, the loader finds the dump through `winepath`'s `Z:\` mapping, and the pipeline cache is read (`title pipelines known from earlier runs pipelines=94203 shaders=25761`). It stops there: no device is created and no frame is presented, so nothing here claims playback. - Two defects that run found and this PR fixes: the image shipped **no Vulkan ICD at all** (`/usr/share/vulkan/icd.d` did not exist, `vkCreateInstance: Found no drivers!`), which is why the title sat at that line silently; it now installs Mesa's RADV for both architectures, and `vulkaninfo --summary` inside the image enumerates the host's card. And the 32-bit loader, the missing Proton path and the unmounted dump described below. - Two defects that only a real run finds, both fixed here: `run.sh` *sources* `run.conf`, so a `PROTON=` there cannot be overridden by the environment and Proton has to be mounted at the path it names; and Proton's 32-bit side needs `libc6:i386`, without which wine stops at `/lib/ld-linux.so.2: could not open` before printing its own banner. Three things a fresh Ubuntu 24.04 does not have, and what the image does about them: `meson` (apt), `widl` (mingw-w64-tools ships only `x86_64-w64-mingw32-widl`, so it is linked), and mingw-w64 headers 13 — vkd3d-proton needs `PATHCCH_NONE`, which the distribution's 11 lacks. ## Still red elsewhere `cargo test -p xtask` on this branch is 9 passed, 1 failed: `switches::documented_switches_are_read`. That is a documentation/switch defect unrelated to the container and already being handled elsewhere; this branch does not touch it. The asset-policy half that used to be red here now passes — `cargo test -p xtask policy` → 7 passed, `cargo xtask policy` → `asset policy: 366 files ok` — which is also why the `Dockerfile` name this change adds to `ALLOWED_NAMES` is still the only line it needs there.
setup.sh asks for clang-cl, lld-link, llvm-lib, mingw-w64, ninja, glslang,
flex, bison, libdrm 2.4.133 and wayland-protocols 1.49. On a distribution that
ships older ones, every step of it is a package manager away, and most of those
want root. .devcontainer supplies them in the versions the patches need, so
building needs podman or docker and the user's own account: no sudo, no host
packages, no files written outside the checkout. The driver, vkd3d-proton and
victory.exe land in the tree through the mount, and playing stays ./run.sh play
on the host, where the card, the display and the Wine that plays already are.

Two tools the scripts touch describe running the game and a container has
neither: systemd-run --user, whose scope only caps memory, and wine.
.devcontainer/standins carries a marked stand-in for each, the first running the
command it was given, the second answering the check and saying what to do
instead; setup.sh and build.sh are not changed. The asset policy allows a file by
name or extension and Dockerfile is neither, hence the one line in policy.rs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 00:56:25 +00:00
github-bot changed title from devcontainer: the whole toolchain in a container, nothing on the host to feat(devcontainer): the whole toolchain in a container, nothing on the host 2026-12-04 01:22:36 +00:00
The image could build, but every command around it was typed by hand and
every worktree paid for its dependencies twice.

- `env.sh`: the one place the MSVC sysroot is turned into the target's
  linker flags. It was four environment variables per command, and the
  one that was forgotten is the one that fails ten minutes later with
  `failed to find tool "ml64.exe"`.
- devcontainer.json: the target, the linker, `clang-cl`, `llvm-lib` and
  `/target` are in `containerEnv`, and four named volumes keep the cargo
  registry, cargo's git checkouts, `/target` and sccache between
  containers. `sccache` is in the image, pinned and checksummed.
  `hostRequirements` makes a 2 GB machine fail at `up`, not at Mesa.
- post-create.sh: takes the volumes as its user, fetches the crates
  Cargo.lock names, and says so when `devcontainer.json`'s Rust pin and
  `rust-toolchain.toml` disagree — the feature's `version` is the same
  number said twice.
- `play.sh`: a Wayland play run. The compositor's socket, `/dev/dri`,
  `/dev/input`, PipeWire's pulse socket and a read-only Proton go in;
  `--memory` takes over the cap `systemd-run` gave `run.sh`. Measured
  here: `VK_KHR_wayland_surface` surfaces are created on the host's
  compositor through the container's RADV, and Proton 11.0's `wine-11.0`
  answers in the container against this image's glibc.
- The Dockerfile gains the client libraries playing needs (xkbcommon,
  PulseAudio, ALSA, freetype, fontconfig, gnutls), which no build touches.
- README: podman and `userns=keep-id`, the render node's permissions,
  `:z` versus `--security-opt=label=disable`, the caches, and what the
  Wayland path leaves to watch.
github-bot force-pushed github-bot/gh-407 from 9d76d806d0 to c664837a07 2026-12-04 11:08:03 +00:00 Compare
github-bot force-pushed github-bot/gh-407 from c664837a07 to bc6f984bf2 2026-12-04 11:19:01 +00:00 Compare
An image built from this Dockerfile has no ICD in /usr/share/vulkan/icd.d,
so inside it `vkCreateInstance` fails with "Found no drivers!" and the
title never creates its device: it logs "title pipelines known" and then
blocks with no CPU and no error of its own, which reads like a game bug.

Install Mesa's RADV for both architectures. The patched Mesa that
`./setup.sh mesa` builds stays the thing to test with; playing needs a
driver that loads.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 13:54 UTC · original

A question for the maintainer and for anyone who builds this regularly — it decides what this PR should become, so better asked now than after a review round.

Three places this could land:

  1. Standard workflow. docs/BUILD.md gains the container as the recommended path, and a CI job runs cargo check/xtask policy inside it. Cost: the project then owns an image (base image bumps, LLVM and mingw versions, the glibc 2.39 floor because the host loads the Mesa it builds). Benefit: one reproducible toolchain, and a Windows-target check that runs on Linux runners.
  2. Opt-in config only, as it is. The files exist, docs/BUILD.md gets one sentence pointing at them, nothing else depends on it. Cost: it drifts unless someone uses it. Benefit: no maintenance obligation, and nobody who already has a working MSVC setup has to care.
  3. Hybrid. Opt-in, but the image is what the checks run against in CI so it cannot rot, and the docs say "if you have no MSVC, use this".

My own reading, for what it is worth: the honest value here is not convenience but verifiability — this repo is x86_64-pc-windows-msvc only, so on Linux the choice today is "install the SDK by hand" or "do not compile the parts that matter". The container makes cargo check --target x86_64-pc-windows-msvc -p victory-loader a one-liner, and that is what most of my fixes here were validated with.

What I would like to hear:

  • Maintainer: is a second supported build path acceptable at all, or should this stay something contributors opt into privately? If it is acceptable, is CI in scope, or only docs?
  • Contributors who build this today: would this fit the loop you actually use, or would it get in the way? Concretely — do you build on Windows, in WSL, or on Linux? Would you use a container for the Windows-target check while keeping your host for play? Anything that would make it a non-starter (image size, build time on first run, needing podman, the mount of /dev/dri)?

Measured on this machine, so the cost side is concrete: image ~6 GB, first build a few minutes on cached layers, post-create ~30 s warm, then cargo check -p victory-pe --tests finishes in 8 s. Playback inside the container is not verified yet — that part is honest in the description above, and I would not ask anyone to adopt this for playing until it is.

**@⁠Luxuride** on GitHub · 2026-12-04 13:54 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/407#issuecomment-7413542352) A question for the maintainer and for anyone who builds this regularly — it decides what this PR should become, so better asked now than after a review round. Three places this could land: 1. **Standard workflow.** `docs/BUILD.md` gains the container as the recommended path, and a CI job runs `cargo check`/`xtask policy` inside it. Cost: the project then owns an image (base image bumps, LLVM and mingw versions, the glibc 2.39 floor because the host loads the Mesa it builds). Benefit: one reproducible toolchain, and a Windows-target check that runs on Linux runners. 2. **Opt-in config only, as it is.** The files exist, `docs/BUILD.md` gets one sentence pointing at them, nothing else depends on it. Cost: it drifts unless someone uses it. Benefit: no maintenance obligation, and nobody who already has a working MSVC setup has to care. 3. **Hybrid.** Opt-in, but the image is what the checks run against in CI so it cannot rot, and the docs say "if you have no MSVC, use this". My own reading, for what it is worth: the honest value here is not convenience but verifiability — this repo is `x86_64-pc-windows-msvc` only, so on Linux the choice today is "install the SDK by hand" or "do not compile the parts that matter". The container makes `cargo check --target x86_64-pc-windows-msvc -p victory-loader` a one-liner, and that is what most of my fixes here were validated with. What I would like to hear: - **Maintainer:** is a second supported build path acceptable at all, or should this stay something contributors opt into privately? If it is acceptable, is CI in scope, or only docs? - **Contributors who build this today:** would this fit the loop you actually use, or would it get in the way? Concretely — do you build on Windows, in WSL, or on Linux? Would you use a container for the Windows-target check while keeping your host for play? Anything that would make it a non-starter (image size, build time on first run, needing podman, the mount of `/dev/dri`)? Measured on this machine, so the cost side is concrete: image ~6 GB, first build a few minutes on cached layers, `post-create` ~30 s warm, then `cargo check -p victory-pe --tests` finishes in 8 s. Playback inside the container is **not** verified yet — that part is honest in the description above, and I would not ask anyone to adopt this for playing until it is.
`env.sh` sets `VK_DRIVER_FILES` to the checkout's `deps/mesa-inst` ICD, and
that JSON names its library by absolute path. `play.sh` mounts the checkout
at `/w`, so inside the container the named path does not exist, the loader
drops the only ICD it was given, and the title never opens the GPU: the log
stops after "title pipelines known" and the process waits with no CPU.

Mount `deps/mesa-inst` at its own absolute path, the way the game dump is
mounted, and say why in the README.
ntsync, the X socket and its cookie are what the title waits for: without
them Wine has no desktop and the process sits in ntsync_schedule with no
/dri fd. A headless host now gets weston inside the container and the same
script works there.

The display is chosen once, from what the host has, instead of from flags:
x11 when /tmp/.X11-unix exists, the compositor socket otherwise, headless
when neither. PLAY_DISPLAY overrides it. The image gains Wine's X client
libraries (libXi/libXcursor/libXfixes/libXinerama were missing, so winex11
could not load) and weston for the headless case.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 20:41 UTC · original · edited 2026-12-04 20:43 UTC

Marked ready for review — ready to merge when you are!

**@⁠Luxuride** on GitHub · 2026-12-04 20:41 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/407#issuecomment-7423680688) · edited 2026-12-04 20:43 UTC Marked ready for review — ready to merge when you are!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/407/head:github-bot/gh-407'
git switch 'github-bot/gh-407'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-407'
git switch 'github-bot/gh-407'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-407'
git switch 'github-bot/gh-407'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-407'
git switch 'main'
git merge --squash 'github-bot/gh-407'
git switch 'main'
git merge --ff-only 'github-bot/gh-407'
git switch 'main'
git merge 'github-bot/gh-407'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.