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. I think this looks ok. What would be the reason for having MSYSTEM_HOST set to `x86_64-pc-cygwin` under msys? If this is a common/reasonable configuration, I wouldn't mind adding some special handling in platform.m4 to deal with it. ------------- Marked as reviewed by erikj (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/29810#pullrequestreview-3826220454
