From: Johannes Schindelin <johannes.schindelin@xxxxxx> By default, Rust wants to build MS Visual C-compatible libraries on Windows, because that is _the_ native C compiler. Git is historically lacking in its MSVC support, and the official Git for Windows versions are built using GCC instead. As a consequence, a (subset of a) GCC toolchain is installed as part of the `windows-build` job of every CI build. Naturally, this requires adjustments in how Rust is called, most importantly it requires installing support for a GCC-compatible build target. Let's make the necessary adjustment both in the CI-specific code that installs Rust as well as in the Windows-specific configuration in `config.mak.uname`. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> [en: Moved lib userenv handling to a later patch] Signed-off-by: Ezekiel Newren <ezekielnewren@xxxxxxxxx> --- ci/install-rust.sh | 3 +++ config.mak.uname | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 141ceddb17cf..c22baa629ceb 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -28,6 +28,9 @@ if [ "$BITNESS" = "32" ]; then $CARGO_HOME/bin/rustup default --force-non-host $RUST_VERSION || exit $? else $CARGO_HOME/bin/rustup default $RUST_VERSION || exit $? + if [ "$CI_OS_NAME" = "windows" ]; then + $CARGO_HOME/bin/rustup target add x86_64-pc-windows-gnu || exit $? + fi fi . $CARGO_HOME/env diff --git a/config.mak.uname b/config.mak.uname index 3e26bb074a4b..a22703284b56 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -727,19 +727,26 @@ ifeq ($(uname_S),MINGW) prefix = /mingw32 HOST_CPU = i686 BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup + CARGO_BUILD_TARGET = i686-pc-windows-gnu endif ifeq (MINGW64,$(MSYSTEM)) prefix = /mingw64 HOST_CPU = x86_64 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup + CARGO_BUILD_TARGET = x86_64-pc-windows-gnu else ifeq (CLANGARM64,$(MSYSTEM)) prefix = /clangarm64 HOST_CPU = aarch64 BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup + CARGO_BUILD_TARGET = aarch64-pc-windows-gnu else COMPAT_CFLAGS += -D_USE_32BIT_TIME_T BASIC_LDFLAGS += -Wl,--large-address-aware endif + + export CARGO_BUILD_TARGET + RUST_TARGET_DIR = rust/target/$(CARGO_BUILD_TARGET)/$(RUST_BUILD_MODE) + CC = gcc COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \ -fstack-protector-strong -- gitgitgadget