Files
2026-11-23 03:28:32 +02:00

37 lines
2.1 KiB
Markdown

# Building the Windows native set on Linux
The GW native DLLs (Bridge, Wire, Backend, codec) can be built on Linux with the
same compiler version the Windows MSYS2 host uses. Verified 2026-11-21 by
rebuilding signed final7 from its exact source manifest: `verify_matched_set.py`
passes, and builds via `cmake/toolchains/linux-msys2-ucrt64.cmake` differ from
the original Linux wrapper build only in the link timestamp/checksum bytes.
## Requirements
- Arch/CachyOS: `pacman -S mingw-w64-gcc` (GCC 16.2.0), plus `clang`/`lld` for the codec link.
- MSYS2 ucrt64 packages extracted (not installed) under
`/mnt/Games/@project/tools/msys2-ucrt64/root/ucrt64` (override with `MSYS2_UCRT64`):
`crt`/`headers`/`winpthreads` 14.0.0.r598, `gcc` + `gcc-libs` 16.2.0-6 (Rev6, as on Windows),
`openssl` 3.6.5-1, `zlib` 1.3.2-2 (both byte-equal to the DLLs shipped in the client once
Authenticode is stripped), `boost` 1.92.0-4 (headers only).
## Build
```sh
CFLAGS=-ffile-prefix-map=/mnt/Games/@project=D:/@project \
CXXFLAGS=-ffile-prefix-map=/mnt/Games/@project=D:/@project \
cmake -G Ninja -S . -B build-win \
-DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/toolchains/linux-msys2-ucrt64.cmake \
-DGW_WINDOWS_NOHELPER_PROFILE5=ON -DGW_WINDOWS_SOURCE_ENDPOINT=OCTO ... # rest of the build's cmake-defs
/usr/bin/ninja -C build-win
```
## Pitfalls
- `cmake-defs.txt` written on Windows has CRLF endings: strip `\r`, or every option silently becomes OFF.
- Pass extra flags through `CFLAGS`/`CXXFLAGS`, not `-DCMAKE_C_FLAGS` (that overrides the toolchain's flags).
- Arch's mingw crt has no `atexit` in `libmingw32.a`; the Wire links `-nostartfiles`, so the MSYS2 runtime must come first (the toolchain does this).
- The distro cross GCC defaults to `-march=x86-64`; MSYS2's defaults to `nocona` (set by the toolchain).
- The game's stock `WowB_loader.dll` only loads an Authenticode-signed native set (a self-signed certificate is accepted). Sign Linux-built DLLs before installing them.
- Under Proton (GE-Proton11-12) the signed set loads from `_classic_beta_` via `WowB_loader` and Wine's built-in wintrust.