From 70e896b3cb1bf0a12ab800f3a2d8f6f6c3b874d8 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Thu, 19 Nov 2026 23:06:23 +0100 Subject: [PATCH] ci: answer libobs-wrapper's X11 and Wayland links when crossing Its build script decides with #[cfg], and a build script is compiled for the host, so cross-building from Linux asks the linker for X11.lib and wayland-client.lib on a Windows target. Empty archives on the search path satisfy it and pull nothing into the exe. --- .github/workflows/record-daemon.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/record-daemon.yml b/.github/workflows/record-daemon.yml index 43d1bd9..7cfa1e7 100644 --- a/.github/workflows/record-daemon.yml +++ b/.github/workflows/record-daemon.yml @@ -71,6 +71,19 @@ jobs: run: cargo install cargo-xwin --locked - name: Build - run: cargo xwin build --target x86_64-pc-windows-msvc + # libobs-wrapper's build script asks for X11 and Wayland through #[cfg], which it + # resolves against the machine running the script rather than the target: a Linux + # host cross-building for Windows asks the linker for two libraries that cannot + # exist there. Empty archives on the search path answer it without adding anything + # to the exe. env: - RUSTFLAGS: -Dwarnings + RUSTFLAGS: -Dwarnings -L native=/tmp/xwin-stubs + run: | + mkdir -p /tmp/xwin-stubs + printf 'void stub(void) {}\n' > /tmp/xwin-stub.c + clang --target=x86_64-pc-windows-msvc -c /tmp/xwin-stub.c -o /tmp/xwin-stub.obj + libtool=$(command -v llvm-lib || ls /usr/lib/llvm-*/bin/llvm-lib | head -1) + for lib in X11 wayland-client; do + "$libtool" /out:/tmp/xwin-stubs/$lib.lib /tmp/xwin-stub.obj + done + cargo xwin build --target x86_64-pc-windows-msvc