RFR: 8277370: configure script cannot distinguish WSL version
Erik Joelsson
erikj at openjdk.java.net
Thu Nov 18 14:06:38 UTC 2021
On Thu, 18 Nov 2021 07:17:07 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> configure script distinguish WSL version if it is run on WSL. It is assumed WSL 2 if `/run/WSL` exists.
> However it exists in spite of WSL 1 on Windows 11 at least. We need to check it with other method.
>
> The method to distinguish WSL version has been discussed on https://github.com/microsoft/WSL/issues/4555 , however they do not seem to get consensus about it. `/run/WSL` was introduced in it, but I think `Hyper-V` in `/proc/interrupt` is more robustness because WSL 2 is run on Hyper-V. https://docs.microsoft.com/en-us/windows/wsl/faq#does-wsl-2-use-hyper-v--will-it-be-available-on-windows-10-home-
Marked as reviewed by erikj (Reviewer).
make/autoconf/basic_windows.m4 line 39:
> 37: # distinguishing between WSL1 and WSL2.
> 38: # Check whether "Hyper-V" appears in /proc/interrupts because WSL2 runs on Hyper-V.
> 39: grep Hyper-V /proc/interrupts > /dev/null 2>&1
You could use the -q switch to grep instead of piping to /dev/null.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6446
More information about the build-dev
mailing list