Feat: fixes

This commit is contained in:
2026-02-27 14:39:42 +01:00
parent 3dba8213d6
commit 25a5c77344
3 changed files with 15 additions and 4 deletions

View File

@@ -2,4 +2,6 @@
xtask = "run --package xtask --release --" xtask = "run --package xtask --release --"
[target.x86_64-pc-windows-gnu] [target.x86_64-pc-windows-gnu]
rustflags = ["-C", "link-args=-lstdc++ -lws2_32 -liphlpapi -lwinmm"] rustflags = [
"-C", "link-args=-Wl,-Bstatic -lstdc++ -lgcc -lgcc_eh -lpthread -Wl,-Bdynamic -lmingwex -lmsvcrt -lws2_32 -liphlpapi -lwinmm -lole32 -loleaut32 -luuid -lkernel32",
]

View File

@@ -4,10 +4,13 @@ fn main() {
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
if target_os == "windows" { if target_os == "windows" {
// rusty_link's build.rs only links stdc++ on linux — add it for windows too // C++ runtime (stdc++, gcc, gcc_eh, pthread) linked statically via .cargo/config.toml
println!("cargo:rustc-link-lib=stdc++"); // using -Wl,-Bstatic. Only Windows system DLLs go here.
println!("cargo:rustc-link-lib=ws2_32"); println!("cargo:rustc-link-lib=ws2_32");
println!("cargo:rustc-link-lib=iphlpapi"); println!("cargo:rustc-link-lib=iphlpapi");
println!("cargo:rustc-link-lib=winmm");
println!("cargo:rustc-link-lib=ole32");
println!("cargo:rustc-link-lib=oleaut32");
} }
#[cfg(windows)] #[cfg(windows)]

View File

@@ -7,7 +7,13 @@ RUN apt-get update && \
libclang-dev \ libclang-dev \
mingw-w64-tools \ mingw-w64-tools \
mingw-w64-x86-64-dev \ mingw-w64-x86-64-dev \
g++-mingw-w64-x86-64 \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& ln -sf windows.h /usr/x86_64-w64-mingw32/include/Windows.h \ && ln -sf windows.h /usr/x86_64-w64-mingw32/include/Windows.h \
&& ln -sf winsock2.h /usr/x86_64-w64-mingw32/include/WinSock2.h \ && ln -sf winsock2.h /usr/x86_64-w64-mingw32/include/WinSock2.h \
&& ln -sf ws2tcpip.h /usr/x86_64-w64-mingw32/include/WS2tcpip.h && ln -sf ws2tcpip.h /usr/x86_64-w64-mingw32/include/WS2tcpip.h \
&& GCCDIR=$(ls -d /usr/lib/gcc/x86_64-w64-mingw32/*-posix 2>/dev/null | head -1) \
&& ln -sf "$GCCDIR/libstdc++.a" /usr/x86_64-w64-mingw32/lib/libstdc++.a \
&& ln -sf "$GCCDIR/libgcc.a" /usr/x86_64-w64-mingw32/lib/libgcc.a \
&& rm -f /usr/x86_64-w64-mingw32/lib/libstdc++.dll.a \
&& rm -f /usr/lib/gcc/x86_64-w64-mingw32/*/libstdc++.dll.a