From c4f80b8c877e3ecf259c4da3e8f6be06e1ff8450 Mon Sep 17 00:00:00 2001
From: Esun Kim <veblush@google.com>
Date: Wed, 27 Nov 2019 10:39:31 -0800
Subject: [PATCH] Update ruby docker image to use pthread for win32

---
 third_party/rake-compiler-dock/Dockerfile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/third_party/rake-compiler-dock/Dockerfile b/third_party/rake-compiler-dock/Dockerfile
index e2a721c736..dfc4f2ec7e 100644
--- a/third_party/rake-compiler-dock/Dockerfile
+++ b/third_party/rake-compiler-dock/Dockerfile
@@ -11,4 +11,12 @@ RUN apt-get install -y g++-multilib
 # generated ruby package can run on CentOS 6 with GLIBC 2.12
 RUN sed -i 's/__GLIBC_MINOR__\t23/__GLIBC_MINOR__\t12/' /usr/include/features.h
 
+# Use posix pthread for mingw so that C++ standard library for thread could be
+# available such as std::thread, std::mutex, so on.
+# https://sourceware.org/pthreads-win32/
+RUN printf "1\n" | update-alternatives --config x86_64-w64-mingw32-gcc && \
+    printf "1\n" | update-alternatives --config x86_64-w64-mingw32-g++ && \
+    printf "1\n" | update-alternatives --config i686-w64-mingw32-gcc && \
+    printf "1\n" | update-alternatives --config i686-w64-mingw32-g++
+
 CMD bash
-- 
GitLab