Gentle ping. This has been merged into MSYS2 at
https://github.com/msys2/MINGW-packages/commit/fc4afbaccc4fc855b2c96a881cc1a5bc81ab41d2,
and no regression till now.

On 2026/08/05 16:18, Zhongteng Gui wrote:
> On 2026/08/03 09:46, Zhongteng Gui wrote:
> Updated the patch a little.
> 
> Changes since v1: additional -L and -isystem appended to FLAGS_FOR_TARGET
> for mingw-w64 targets are all redundant.
> 
> Tested on MSYS2 and Conda-forge that this won't break building. Also
> avoids accidentally links to host libraries instead of newly built ones,
> because ${prefix}/mingw/lib is usually sed'ed to ${prefix}/lib by many
> distributions. See
> https://github.com/msys2/MINGW-packages/pull/29280#issuecomment-5180468708
> 
> ---
> 
> From 85dc1d24e8039aa343eac2978e36b11feecc6607 Mon Sep 17 00:00:00 2001
> From: Zhongteng Gui <[email protected]>
> Date: Thu, 30 Jul 2026 18:46:38 +0800
> Subject: [PATCH v2] mingw: Remove outdated /mingw stuff
> 
> /mingw is only used by MSYS 1, which has been obsolete for a long time.
> The current users of target *-w64-mingw32 either uses their own prefix
> (MSYS2 and its derivatives, w64devkit, etc.), or use the default prefix
> /usr (Cross-compiling on linux, e.g. Conda-forge).
> 
> Native mingw users usually use --sysroot=<prefix>, so don't hardcode
> NATIVE_SYSTEM_HEADER_DIR to /mingw/include, but use the default
> /usr/include (and can be overridden by --with-native-system-header-dir).
> Similar logic for STANDARD_STARTFILE_PREFIX_{1,2}, but since
> STANDARD_STARTFILE_PREFIX_2 can not be overridden from configure, we set
> it to empty for native builds because /usr/lib is not used for native
> builds. Cross-compiling users can still use the default /usr/lib.
> 
> local_include_dir is previously set to <prefix>/include in
> config/i386/x-mingw32, which forbids distributions to set their own
> local include dir, so we use the value from --with-local-prefix instead.
> 
> Commit 5d571eaa95b9b3413287f46a183912b2445d7667 added -L and -isystem
> for x86_64-*mingw* and *-w64-mingw* to FLAGS_FOR_TARGET in configure.ac,
> this is no longer needed since /mingw symlink is not used anymore, and
> ${prefix}/${target}/{lib,include} is always searched for all targets.
> 
> ChangeLog:
> 
>       * configure.ac (FLAGS_FOR_TARGET): Do not add -L or -isystem for
>       x86_64-*mingw* and *-w64-mingw*.
> 
> gcc/ChangeLog:
> 
>       * config.gcc (-mingw*): Don't hardcode native_system_header_dir
>       to /mingw/include.
>       * config/mingw/mingw32.h: Don't hardcode /mingw stuff.
>       (STANDARD_STARTFILE_PREFIX_1): Use the default /lib.
>       (STANDARD_STARTFILE_PREFIX_2): Set to empty for native builds,
>       use the default /usr/lib for cross-compiling.
>       (NATIVE_SYSTEM_HEADER_DIR): Don't hardcode /mingw/include, use
>       value from --with-native-system-header-dir.
>       * config/i386/x-mingw32: Don't force changing local_include_dir,
>       honor values from --with-local-prefix.
> 
> Signed-off-by: Zhongteng Gui <[email protected]>
> ---
>  configure.ac               |  4 +---
>  gcc/config.gcc             |  2 --
>  gcc/config/i386/x-mingw32  |  4 ----
>  gcc/config/mingw/mingw32.h | 12 ++----------
>  4 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index c5de225b0ac..c81755ebbb6 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -3948,9 +3948,7 @@ esac
>  
>  case "$target" in
>    x86_64-*mingw* | *-w64-mingw*)
> -  # MinGW-w64 does not use newlib, nor does it use winsup. It may,
> -  # however, use a symlink named 'mingw' in ${prefix} .
> -    FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib 
> -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem 
> ${prefix}/mingw/include'
> +  # MinGW-w64 does not use newlib, nor does it use winsup. No special flags 
> needed.
>      ;;
>    *-mingw*)
>    # MinGW can't be handled as Cygwin above since it does not use newlib.
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 8fe99616f82..55339363c6c 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1331,7 +1331,6 @@ aarch64-*-mingw*)
>       tm_file="${tm_file} mingw/winnt-dll.h"
>       tmake_file="${tmake_file} aarch64/t-aarch64"
>       tmake_file="${tmake_file} aarch64/t-aarch64-mingw"
> -        native_system_header_dir=/mingw/include
>       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
>       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.cc"
>       extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
> @@ -2339,7 +2338,6 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
>                       tmake_file="${tmake_file} i386/t-mingw-w32"
>                       ;;
>       esac
> -        native_system_header_dir=/mingw/include
>       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
>       target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.cc"
>       extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
> diff --git a/gcc/config/i386/x-mingw32 b/gcc/config/i386/x-mingw32
> index 3ac2ba57631..5a0d8b8ec4a 100644
> --- a/gcc/config/i386/x-mingw32
> +++ b/gcc/config/i386/x-mingw32
> @@ -16,10 +16,6 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
>  #
> -#
> -# Make local_includedir relative to EXEC_PREFIX 
> -#
> -local_includedir=$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 
> 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include
>  
>  # Add Windows socket library.
>  LIBS += -lws2_32
> diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
> index 1d319b77bf8..3afbee65974 100644
> --- a/gcc/config/mingw/mingw32.h
> +++ b/gcc/config/mingw/mingw32.h
> @@ -231,17 +231,9 @@ along with GCC; see the file COPYING3.  If not see
>    crtend.o%s"
>  
>  /* Override startfile prefix defaults.  */
> -#ifndef STANDARD_STARTFILE_PREFIX_1
> -#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
> +#if !defined(STANDARD_STARTFILE_PREFIX_2) && 
> !defined(CROSS_DIRECTORY_STRUCTURE)
> +#define STANDARD_STARTFILE_PREFIX_2 "" /* MSYS2 doesn't use /usr/lib for 
> MINGW */
>  #endif
> -#ifndef STANDARD_STARTFILE_PREFIX_2
> -#define STANDARD_STARTFILE_PREFIX_2 ""
> -#endif
> -
> -/* For native mingw-version we need to take care that 
> NATIVE_SYSTEM_HEADER_DIR
> -   macro contains POSIX-style path.  See bug 52947.  */
> -#undef NATIVE_SYSTEM_HEADER_DIR
> -#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
>  
>  /* Output STRING, a string representing a filename, to FILE.
>     We canonicalize it to be in Unix format (backslashes are replaced

Reply via email to