On Thu, 19 Feb 2026 07:24:42 GMT, Daishi Tabata <[email protected]> wrote:

> In the MSYS2 environment, the system is currently detected as a Cygwin 
> environment. As a result, the following code is not executed under MSYS2, 
> which in turn breaks the execution of `cmd.exe /c`:
> 
>   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then
>     # Must be done prior to calling any commands to avoid mangling of command 
> line
>     export MSYS2_ARG_CONV_EXCL="*"
>   fi
> 
> 
> I considered three possible approaches to fix this issue:
> 1. Modify `basic_windows.m4` so that `MSYS2_ARG_CONV_EXCL="*"` is also set in 
> non‑MSYS2 environments (such as WSL and Cygwin).
> 2. Introduce the following logic early in the `configure` processing and set 
> the environment variable `$MSYSTEM_CHOST` to the MSYS2 value:
> 
> if test "x$MSYSTEM" != "x"; then
>   MSYSTEM_CHOST="x86_64-pc-msys"
> fi
> 
> 3. Add a note to `build.md` (the approach adopted in this PR).
> 
> Approaches 1 and 2 are better in the sense that they do not require any 
> additional steps at build time, but they also have issues.
> With approach 1, the build proceeds as if it were in a Cygwin environment 
> even though it is actually an MSYS2 environment, which could lead to 
> unexpected errors.
> With approach 2, the logic needs to run very early in the configure process 
> (before `PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET`), and introducing 
> platform‑specific handling at such an early stage is not recommended.
> For these reasons, I chose approach 3.
> 
> One concern I still have is whether this issue also occurs with the ARM 
> version of MSYS2. Unfortunately, I do not have access to an ARM Windows 
> environment and cannot verify this myself. For now, the addition to 
> `build.md` is limited to `x86‑64`.  
> If someone can confirm that the same problem occurs (or does not occur) on 
> the latest ARM version of MSYS2, I will update the documentation accordingly.

This pull request has now been integrated.

Changeset: feecb042
Author:    Daishi Tabata <[email protected]>
Committer: Erik Joelsson <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/feecb042fe4abbb9bb3aa9324de4e40393e03ae1
Stats:     7 lines in 1 file changed: 6 ins; 0 del; 1 mod

8378218: MSYS2 reports cygwin triplet causing bash configure failure

Reviewed-by: erikj

-------------

PR: https://git.openjdk.org/jdk/pull/29810

Reply via email to