Skip to content

Commit 67d22ae

Browse files
Merge #1123
1123: Use MinGW GCC with POSIX thread support when linking. r=Emilgardis a=Alexhuszagh This changes from using WIN32 threads to POSIX threads when linking. MinGW (when using `libstdc++`) doesn't support C11 and C++11 threading support with WIN32 threads. This PR also makes WINE builds more resilient. Note that this will not affect any multi-threaded Rust code, which uses the Win32 API, calling `CreateThread` and `WaitForSingleObject` directly. Closes #1122. Co-authored-by: Alex Huszagh <[email protected]>
2 parents a0721d8 + 21e5a29 commit 67d22ae

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

.changes/1123.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"description": "support external C/C++ dependencies using C11/C++11 threads for MinGW targets by switching linkers from `*-gcc` to `*gcc-posix`.",
3+
"type": "added",
4+
"issues": [1122],
5+
"breaking": true
6+
}

.changes/591-1095.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
{
1919
"type": "changed",
20-
"description": "updated powerpc64, riscv64, and sparc64 *-linux-gnu images to use a 6.x kernel instead of a 4.x kernel.",
20+
"description": "updated powerpc64, riscv64, and sparc64 `*-linux-gnu` images to use a 6.x kernel instead of a 4.x kernel.",
2121
"breaking": true,
2222
"issues": [1094]
2323
}

docker/Dockerfile.i686-pc-windows-gnu

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ RUN mkdir -p /usr/lib/binfmt-support/ && \
3434
COPY windows-entry.sh /
3535
ENTRYPOINT ["/windows-entry.sh"]
3636

37+
# for why we always link with pthread support, see:
38+
# https://github.com/cross-rs/cross/pull/1123#issuecomment-1312287148
3739
ENV CROSS_TOOLCHAIN_PREFIX=i686-w64-mingw32-
3840
ENV CROSS_SYSROOT=/usr/i686-w64-mingw32
39-
ENV CARGO_TARGET_I686_PC_WINDOWS_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
41+
ENV CARGO_TARGET_I686_PC_WINDOWS_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc-posix \
4042
CARGO_TARGET_I686_PC_WINDOWS_GNU_RUNNER=wine \
4143
CC_i686_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc-posix \
4244
CXX_i686_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"g++-posix \

docker/Dockerfile.x86_64-pc-windows-gnu

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ RUN mkdir -p /usr/lib/binfmt-support/ && \
3232
COPY windows-entry.sh /
3333
ENTRYPOINT ["/windows-entry.sh"]
3434

35+
# for why we always link with pthread support, see:
36+
# https://github.com/cross-rs/cross/pull/1123#issuecomment-1312287148
3537
ENV CROSS_TOOLCHAIN_PREFIX=x86_64-w64-mingw32-
3638
ENV CROSS_SYSROOT=/usr/x86_64-w64-mingw32
37-
ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
39+
ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc-posix \
3840
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER=wine \
3941
CC_x86_64_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc-posix \
4042
CXX_x86_64_pc_windows_gnu="$CROSS_TOOLCHAIN_PREFIX"g++-posix \

docker/wine.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -euo pipefail
77
. lib.sh
88

99
main() {
10+
local version="7.0.1~focal-1"
1011
install_packages wget
1112

1213
dpkg --add-architecture i386
@@ -26,9 +27,14 @@ main() {
2627
mv winehq-focal.sources /etc/apt/sources.list.d/
2728
sed -i s@/usr/share/keyrings/@/etc/apt/keyrings/@ /etc/apt/sources.list.d/winehq-focal.sources || true
2829

30+
# winehq requires all the dependencies to be manually specified
31+
# if we're not using the latest version of a given major version.
2932
apt-get update
3033
apt install --no-install-recommends --assume-yes \
31-
"winehq-stable=7.0.0.0~focal-1"
34+
"wine-stable=${version}" \
35+
"wine-stable-amd64=${version}" \
36+
"wine-stable-i386=${version}" \
37+
"winehq-stable=${version}"
3238

3339
purge_packages
3440
}

0 commit comments

Comments
 (0)