ci(windows-drivers): static-CRT .cargo/config (fixes StaticCrtNotEnabled)
wdk-build errored StaticCrtNotEnabled + the generated wdk-sys layout asserts overflowed (E0080) — UMDF needs the static CRT. Add the canonical windows-drivers-rs .cargo/config.toml: explicit target = x86_64-pc-windows-msvc (separates host proc-macros, which stay dynamic-CRT, from the driver) + target-feature=+crt-static scoped to that target. DLL now under the triple subdir. The WDK bindgen itself now runs (it generated out/types.rs) — this is the last build-config layer before the /INTEGRITYCHECK verdict. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,7 +125,8 @@ jobs:
|
||||
run: cargo build -p wdk-probe -v
|
||||
- name: Inspect the produced DLL's /INTEGRITYCHECK bit
|
||||
run: |
|
||||
$dll = "target\debug\wdk_probe.dll"
|
||||
# explicit --target (.cargo/config.toml) -> output under the triple subdir.
|
||||
$dll = "target\x86_64-pc-windows-msvc\debug\wdk_probe.dll"
|
||||
if (-not (Test-Path $dll)) { throw "wdk_probe.dll not produced at $dll" }
|
||||
$b = [IO.File]::ReadAllBytes($dll)
|
||||
$pe = [BitConverter]::ToInt32($b, 0x3c)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# windows-drivers-rs requires UMDF drivers to link the STATIC CRT (wdk-build errors `StaticCrtNotEnabled`
|
||||
# otherwise, and the generated wdk-sys bindings' layout asserts only hold with it).
|
||||
#
|
||||
# Setting an EXPLICIT build target is the trick that makes `target-feature=+crt-static` apply ONLY to the
|
||||
# driver cdylib and NOT to host build-scripts/proc-macros (which must stay dynamic-CRT): with an explicit
|
||||
# --target, cargo compiles host artifacts for the implicit host and the `[target.<triple>]` rustflags
|
||||
# apply only to the target. The Windows host (and thus its drivers) is x64-only by design.
|
||||
[build]
|
||||
target = "x86_64-pc-windows-msvc"
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
rustflags = ["-C", "target-feature=+crt-static"]
|
||||
Reference in New Issue
Block a user