ci: answer libobs-wrapper's X11 and Wayland links when crossing
record-daemon / Check and lint (Linux) (push) Successful in 1m7s
record-daemon / Build (Windows x64) (push) Successful in 1m45s

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.
This commit is contained in:
vhaudiquet committed 2026-11-19 23:06:23 +01:00
1 parent 6a604fe4d8
commit 70e896b3cb
1 file changed
+15 -2
+15 -2
View File
@@ -71,6 +71,19 @@ jobs:
run: cargo install cargo-xwin --locked run: cargo install cargo-xwin --locked
- name: Build - 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: 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