From 9ecd2e4e03077e18087a743cad65e5800fffcdbb Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Wed, 12 Aug 2026 14:49:33 +0800 Subject: [PATCH] Build: Use MinGW posix thread variant for std::mutex support The gcc/g++-mingw-w64-x86-64 metapackages pull in both posix and win32 variants, and update-alternatives defaults to win32 whose libstdc++ lacks std::mutex. Install only the posix variants and add an apt retry loop for flaky mirrors. --- Dockerfile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c6a937 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM debian:bookworm-slim + +# Use USTC mirror +RUN sed -i \ + 's|deb.debian.org/debian|mirrors.ustc.edu.cn/debian|g; \ + s|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' \ + /etc/apt/sources.list.d/debian.sources + +# Install build tools and MinGW-w64 x86_64 toolchain +RUN for i in 1 2 3 4 5; do \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + git \ + cmake \ + ninja-build \ + gcc-mingw-w64-x86-64-posix \ + g++-mingw-w64-x86-64-posix \ + binutils-mingw-w64-x86-64 \ + mingw-w64-x86-64-dev \ + && break \ + || { echo "apt install failed (attempt $i), retrying..."; sleep 5; }; \ + done \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get clean + +COPY toolchains/x86_64-w64-mingw32.cmake /opt/toolchains/mingw-x64.cmake + +WORKDIR /workspace + +CMD ["/bin/bash"] \ No newline at end of file