Skip to content

Commit

Permalink
windows-gnu: Update to ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Mar 3, 2024
1 parent 362aa1d commit c955316
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- target: x86_64-unknown-illumos

# Windows (MinGW)
# - target: i686-pc-windows-gnu # TODO
- target: i686-pc-windows-gnu
- target: x86_64-pc-windows-gnu
- target: x86_64-pc-windows-gnu
host: aarch64
Expand Down
109 changes: 86 additions & 23 deletions docker/base/windows-gnu-gcc-mingw-i686.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/debian/control.template b/debian/control.template
index 5c80a28..eb85d4b 100644
index 392ef08..d844772 100644
--- a/debian/control.template
+++ b/debian/control.template
@@ -1,7 +1,6 @@
Expand All @@ -10,52 +10,89 @@ index 5c80a28..eb85d4b 100644
${misc:Depends}
Recommends: @@RECOMMENDS@@
Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
@@ -32,22 +31,3 @@ Description: GNU @@LANGUAGE@@ compiler for MinGW-w64 targeting Win32
This package contains the @@LANGUAGE@@ compiler, supporting
cross-compiling to 32-bit MinGW-w64 targets.
@@ -68,58 +67,3 @@ Description: GNU @@LANGUAGE@@ compiler for MinGW-w64, Win32/Win32
cross-compiling to 32-bit MinGW-w64 targets, using the Win32
threading model.
Build-Profiles: <!stage1>
-
-Package: @@PACKAGE@@-mingw-w64-x86-64
-Architecture: any
-Depends: @@DEPENDS64@@,
-Architecture: all
-Depends: @@PACKAGE@@-mingw-w64-x86-64-posix,
- @@PACKAGE@@-mingw-w64-x86-64-win32,
- ${misc:Depends}
-Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64 targeting Win64
- MinGW-w64 provides a development and runtime environment for 32- and
- 64-bit (x86 and x64) Windows applications using the Windows API and
- the GNU Compiler Collection (gcc).
- .
- This metapackage provides the @@LANGUAGE@@ compiler, supporting
- cross-compiling to 64-bit MinGW-w64 targets.
-Build-Profiles: <!stage1>
-
-Package: @@PACKAGE@@-mingw-w64-x86-64-posix
-Architecture: @@ARCH@@
-Depends: @@DEPENDS64P@@,
- ${misc:Depends},
- ${shlibs:Depends}
-Suggests: gcc-@@VERSION@@-locales (>= ${local:Version})
-Breaks: @@BREAKS64@@
-Conflicts: @@CONFLICTS64@@
-Replaces: @@REPLACES64@@
-Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64 targeting Win64
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64, Win64/POSIX
- MinGW-w64 provides a development and runtime environment for 32- and
- 64-bit (x86 and x64) Windows applications using the Windows API and
- the GNU Compiler Collection (gcc).
- .
- This package contains the @@LANGUAGE@@ compiler, supporting
- cross-compiling to 64-bit MinGW-w64 targets.
- cross-compiling to 64-bit MinGW-w64 targets, using the POSIX
- threading model.
-Build-Profiles: <!stage1>
-
-Package: @@PACKAGE@@-mingw-w64-x86-64-win32
-Architecture: @@ARCH@@
-Depends: @@DEPENDS64W@@,
- ${misc:Depends},
- ${shlibs:Depends}
-Suggests: gcc-@@VERSION@@-locales (>= ${local:Version})
-Breaks: @@BREAKS64@@
-Conflicts: @@CONFLICTS64@@
-Replaces: @@REPLACES64@@
-Built-Using: gcc-@@VERSION@@ (= ${gcc:Version})
-Description: GNU @@LANGUAGE@@ compiler for MinGW-w64, Win64/Win32
- MinGW-w64 provides a development and runtime environment for 32- and
- 64-bit (x86 and x64) Windows applications using the Windows API and
- the GNU Compiler Collection (gcc).
- .
- This package contains the @@LANGUAGE@@ compiler, supporting
- cross-compiling to 64-bit MinGW-w64 targets, using the Win32
- threading model.
-Build-Profiles: <!stage1>
diff --git a/debian/rules b/debian/rules
index 9e7e40c..082ce5a 100755
index cfba9e6..ecabb89 100755
--- a/debian/rules
+++ b/debian/rules
@@ -58,7 +58,7 @@ ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
@@ -25,8 +25,7 @@ export NO_PKG_MANGLE=1

target_version := 10
target32 := i686-w64-mingw32
-target64 := x86_64-w64-mingw32
-targets := $(target32) $(target64)
+targets := $(target32)
threads := posix win32
gnat_arches := alpha amd64 arm64 armel armhf hppa i386 mips64el mipsel ppc64 ppc64el riscv64 s390x sh4 sparc64 x32

@@ -67,7 +66,7 @@ ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
INSTALL_TARGET := install-gcc
else
# Build the full GCC.
- languages := c,c++,fortran,objc,obj-c++,ada
- languages := c,c++,fortran,objc,obj-c++
+ languages := c,c++
BUILD_TARGET :=
INSTALL_TARGET := install install-lto-plugin
ifneq ($(filter $(DEB_HOST_ARCH),$(gnat_arches)),)
languages := $(languages),ada
endif
@@ -86,7 +86,7 @@ control-stamp:
for file in debian/*.in; do sed 'sX@@WARNING@@XThis file is generated using debian/rules control, do not editXg;s/@@VERSION@@/$(target_version)/g;s/@@BASEVERSION@@/$(base_version)/g' < $$file > $${file%%.in}; chmod --reference=$$file $${file%%.in}; done
touch $@

-targets := i686-w64-mingw32 x86_64-w64-mingw32
+targets := i686-w64-mingw32
threads := posix win32

# Hardening on the host, none on the target
@@ -220,6 +220,10 @@ CONFFLAGS += \
@@ -246,6 +245,10 @@ CONFFLAGS += \
# Enable libatomic
CONFFLAGS += \
--enable-libatomic
Expand All @@ -66,3 +103,29 @@ index 9e7e40c..082ce5a 100755
# Enable experimental::filesystem and std::filesystem
CONFFLAGS += \
--enable-libstdcxx-filesystem-ts=yes
@@ -314,11 +317,6 @@ ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
-B$(build_dir)/$(target32)-$$threads \
-D$(upstream_dir) -- \
$(CONFFLAGS) --disable-sjlj-exceptions --with-dwarf2; \
- target=$(target64); \
- dh_auto_configure \
- -B$(build_dir)/$(target64)-$$threads \
- -D$(upstream_dir) -- \
- $(CONFFLAGS); \
done
else
set -e; \
@@ -326,12 +324,7 @@ else
dh_auto_configure \
-B$(build_dir)/$(target32) \
-D$(upstream_dir) -- \
- $(CONFFLAGS) --disable-sjlj-exceptions --with-dwarf2; \
- target=$(target64); \
- dh_auto_configure \
- -B$(build_dir)/$(target64) \
- -D$(upstream_dir) -- \
- $(CONFFLAGS)
+ $(CONFFLAGS) --disable-sjlj-exceptions --with-dwarf2;
endif
touch $@

2 changes: 1 addition & 1 deletion docker/base/windows-gnu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
# SPDX-License-Identifier: Apache-2.0 OR MIT

ARG UBUNTU_VERSION=20.04
ARG UBUNTU_VERSION=22.04

FROM ghcr.io/taiki-e/build-base:ubuntu-"${UBUNTU_VERSION}" as builder
SHELL ["/bin/bash", "-eEuxo", "pipefail", "-c"]
Expand Down
8 changes: 1 addition & 7 deletions docker/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,6 @@ case "${RUST_TARGET}" in
# TODO(riscv32gc-unknown-linux-gnu): libstd's io-related feature on riscv32 linux is broken: https://github.com/rust-lang/rust/issues/88995
# TODO(x86_64-unknown-linux-gnux32): Invalid ELF image for this architecture
riscv32gc-unknown-linux-gnu | x86_64-unknown-linux-gnux32) ;;
# TODO(windows-gnu): https://github.com/rust-lang/rust/pull/121317
# wine: Call from 00006FFFFFC4FCF8 to unimplemented function KERNEL32.dll.WaitOnAddress, aborting
# wine: Call from 00006FFFFFC4FCF8 to unimplemented function KERNEL32.dll.WakeByAddressSingle, aborting
x86_64-pc-windows-gnu) ;;
# TODO(redox):
*-unknown-linux-* | *-android* | *-wasi* | *-emscripten* | *-windows-gnu*) no_run="" ;;
esac
Expand Down Expand Up @@ -1081,9 +1077,7 @@ case "${RUST_TARGET}" in
assert_file_info 'for MS Windows' "${bin}"
else
case "${RUST_TARGET}" in
# TODO: on ubuntu 22.04+
# aarch64-*) assert_file_info 'Aarch64 COFF object file' "${bin}" ;;
aarch64-*) assert_file_info 'data' "${bin}" ;;
aarch64-*) assert_file_info 'Aarch64 COFF object file' "${bin}" ;;
i686-*) assert_file_info 'Intel 80386 COFF object file' "${bin}" ;;
x86_64*) assert_file_info 'Intel amd64 COFF object file' "${bin}" ;;
*) bail "unrecognized target '${RUST_TARGET}'" ;;
Expand Down
25 changes: 14 additions & 11 deletions docker/windows-gnu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

ARG RUST_TARGET
ARG UBUNTU_VERSION=20.04
ARG UBUNTU_VERSION=22.04
ARG TOOLCHAIN_TAG=dev
ARG HOST_ARCH=amd64

Expand All @@ -29,14 +29,15 @@ for tool in "${RUST_TARGET}"-*-posix "$(</CC_TARGET)"-*-posix; do
done
EOF

RUN --mount=type=bind,target=/docker <<EOF
gcc_version="${GCC_VERSION:-"$(gcc --version | sed -n '1 s/^.*) //p')"}"
COMMON_FLAGS="--gcc-toolchain=\"\${toolchain_dir}\" -B\"\${toolchain_dir}\"/${RUST_TARGET}/bin -L\"\${toolchain_dir}\"/${RUST_TARGET}/lib -L${TOOLCHAIN_DIR}/lib/gcc-cross/${RUST_TARGET}/${gcc_version%%.*}" \
CFLAGS="-I\"\${toolchain_dir}\"/${RUST_TARGET}/include" \
CXXFLAGS="-I\"\${toolchain_dir}\"/${RUST_TARGET}/include -I\"\${toolchain_dir}\"/${RUST_TARGET}/include/c++/${gcc_version%%.*}/${RUST_TARGET}" \
SYSROOT=none \
/docker/clang-cross.sh
EOF
# TODO cannot find -lgcc: No such file or directory
# RUN --mount=type=bind,target=/docker <<EOF
# gcc_version="${GCC_VERSION:-"$(gcc --version | sed -n '1 s/^.*) //p')"}"
# COMMON_FLAGS="--gcc-toolchain=\"\${toolchain_dir}\" -B\"\${toolchain_dir}\"/${RUST_TARGET}/bin -L\"\${toolchain_dir}\"/${RUST_TARGET}/lib -L${TOOLCHAIN_DIR}/lib/gcc-cross/${RUST_TARGET}/${gcc_version%%.*}" \
# CFLAGS="-I\"\${toolchain_dir}\"/${RUST_TARGET}/include" \
# CXXFLAGS="-I\"\${toolchain_dir}\"/${RUST_TARGET}/include -I\"\${toolchain_dir}\"/${RUST_TARGET}/include/c++/${gcc_version%%.*}/${RUST_TARGET}" \
# SYSROOT=none \
# /docker/clang-cross.sh
# EOF

FROM ghcr.io/taiki-e/build-base:ubuntu-"${UBUNTU_VERSION}" as test-base
SHELL ["/bin/bash", "-eEuxo", "pipefail", "-c"]
Expand Down Expand Up @@ -81,7 +82,8 @@ ARG DEBIAN_FRONTEND=noninteractive
ARG RUST_TARGET
COPY --from=builder /"${RUST_TARGET}"/. /usr/local/
RUN /test/test.sh gcc
RUN /test/test.sh clang
# TODO cannot find -lgcc: No such file or directory
# RUN /test/test.sh clang
RUN touch /DONE

FROM test-base as test
Expand All @@ -93,7 +95,8 @@ ENV PATH="/${RUST_TARGET}/bin:$PATH"
RUN /test/check.sh
# TODO: test both thread=posix and thread=win32
RUN /test/test.sh gcc
RUN /test/test.sh clang
# TODO cannot find -lgcc: No such file or directory
# RUN /test/test.sh clang
# COPY --from=test-relocated /DONE /

FROM ubuntu:"${UBUNTU_VERSION}" as final
Expand Down
2 changes: 1 addition & 1 deletion docker/windows-gnullvm.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - https://github.com/rust-lang/rust/blob/1.70.0/src/doc/rustc/src/platform-support/pc-windows-gnullvm.md

ARG RUST_TARGET
ARG UBUNTU_VERSION=20.04
ARG UBUNTU_VERSION=22.04
ARG TOOLCHAIN_TAG=dev

# https://github.com/mstorsjo/llvm-mingw/releases
Expand Down

0 comments on commit c955316

Please sign in to comment.