docs: cross-compiling with clang-cl and xwin, and the startup debugger under Wine #1294
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1301"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-24T07:20:32Z.
Refs #870.
What this adds
Two sections in
docs/non-windows-hosts.md, next to the existing msvc-wine one. Docs only.Cross-compile with clang-cl and an xwin SDK. A toolchain file and the commands that build the eight startup stand-ins on Linux with clang-cl, lld-link and an
xwin splat, plus the four things that differ from an MSVC build:/EHais required and must come after CMake's default/EHsc. The stand-ins probe title memory inside__try(src/startup_stubs/local_log.h). With/EHsc, clang-cl does not catch the access violation of a load written directly in the__trybody, and the first probe of an unreadable address ends the process insided3d12_xs.dll. This one cost the most time to find.-fbracket-depth, for the 512-argument fold expression ind3d12_xs_device.cpp.OneCore.libversus the splat'sonecore.libon a case-sensitive file system.dxcto satisfyfind_program.It is presented the way the msvc-wine section is: a real compiler and the real SDK, usable as a compile check, with MSVC and Windows CI as the reference. It does not stub
cl, MASM, D3D12 or WARP.Startup debugger under Wine. What a
debug_launch.pyrun on those stand-ins needed under Wine with vkd3d-proton: the Windows build of CPython (and why the embeddable package needs its._pthfile removed), which D3D12 DLLs go into the prefix, mapping a package drive letter, FXC under Wine, where a desktopxgameruntime.dllcomes from, Wine's section backing on a small tmpfs, and two open differences (tagged descriptor handles, window order). It also records how slow one section per 64 KiB page is under Wine.Evidence
Commit: the head of this branch, on
mainat93cb6a2a./EHaas the only exception flag on the compile lines. Host: Debian 13, clang-cl 19.1.7, SDK 10.0.26100 fromxwin splat./EHastatement is measured both ways on that host: built with/EHsc, a startup run stopped at an unhandled access violation in the stand-in's readable-memory probe; rebuilt with/EHalast, the same run continued.python -B tests/docs_links_check.py: pass (290 links).python -B tests/bidi_controls_check.py: pass.git diff --check: clean.Not covered
Related
The page-mapping cost mentioned at the end is the subject of a separate code PR I am preparing. #1251 (mapping a package drive letter in the launcher) would replace the manual
dosdevicesstep for hosts where it applies.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T07:30:28Z.
Review: COMMENTED
Review at commit
932423c7f2d5489c1de75a5817bc1d8c4f5d1218:Verification
git diff --check origin/main...HEAD: clean (exit 0)/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (16 Markdown files, 290 links)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (1086 tracked files)docs/non-windows-hosts.md; no C++/test target changes).Review Notes
clang-cl+xwincross-compile toolchain (/EHaordering after/EHsc,-fbracket-depth=2048,OneCore.libcase-sensitivity symlink, anddxcrequirement) and explicitly scopes it as a compile check with MSVC/Windows CI remaining the reference.vkd3d-protonstartup debugger setup and known differences (python312._pth,d3d12/dxgioverrides,XDG_RUNTIME_DIRtmpfs note, descriptor handle tag bits, and section-per-page cost) while keeping title-neutral framing and explicitly noting it is not Windows verification.Imported from R0Y00/Xbox2Windows. Originally posted by nanyoudegege on 2026-11-24T07:40:11Z.
One small edge case in the cross-build example at
932423c7: the shell quotes-DXWIN="$XWIN"and-DLIBCASE="$PWD/out/libcase", but the toolchain snippet doesn't retain quotes around those paths inside its compiler/linker flag strings. A checkout or SDK directory with spaces can therefore split an argument. CMake documents this requirement for flag fragments.I checked the resulting flag fragments with a POSIX shell on cloud Linux and synthetic paths:
/imsvc /tmp/SDK Files/crt/include /libpath:/tmp/repo with space/out/libcasesplit into six arguments; quoting the two path operands kept the intended three. I did not run the actual CMake/clang-cl cross-build. Could the sample retain literal quotes inside the CMake strings (e.g./imsvc \"${XWIN}/crt/include\"and/libpath:\"${LIBCASE}\"), or document the no-spaces constraint if that's the supported route?AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-24T07:49:45Z.
@nanyoudegege you're right, thanks. Fixed in
429fb8f7: the toolchain file in the doc now keeps literal quotes around the five/imsvcpaths and the four/libpath:arguments inside its flag strings, as the CMake documentation asks for flag fragments.Checked with the actual cross-build rather than the shell split: I configured and built
xmem_shim,startup_stub_chadandd3d12_xs_shimwith the quoted file, with the SDK splat, theLIBCASEdirectory and the build directory each under a directory whose name contains a space (symlinks to the real ones). All three DLLs were produced. Host as in the PR: Debian 13, clang-cl 19.1.7, SDK 10.0.26100.Not checked: a checkout (source directory) path with spaces, and a path containing a double quote, which the quoting would not survive.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:17:15Z.
Review: COMMENTED
Re-reviewed at commit
3185186ec1f82737af56f1f5e457116be9c12e30(delta since932423c7f2d5489c1de75a5817bc1d8c4f5d1218).Delta Review (
docs/non-windows-hosts.md)429fb8f7+3185186e: quotesXWINandLIBCASEpaths inside theclang-cl/imsvcand/libpath:flag strings and explicitly documents which directories with spaces were tested (XWIN,LIBCASE, build directory) versus not tried (source directory). Looks clean and accurate.Verification (Linux, docs-only)
git diff --check origin/main...HEAD: cleanpython -B tests/docs_links_check.py: passed (16 Markdown files, 291 links)python -B tests/bidi_controls_check.py: passed (1093 files)