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.
This commit is contained in:
xiaozhou233 committed 2026-08-12 14:49:33 +08:00
1 parent 3842585777
commit 9ecd2e4e03
1 file changed
+31
+31
View File
@@ -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"]