RFR: JDK-8212986 Make Visual Studio compiler check less strict

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Feb 5 11:11:37 UTC 2020


On more than one occasion, we have had reports about not being able to 
build on Windows due to Visual Studio being installed with a different 
language. This causes the check in toolchain.m4 to fail as it assumes 
the compiler greeting is in english. The latest failure gave this message:

configure: The C compiler (located as
/cygdrive/c/progra~3/micros~1.0/vc/bin/cl) does not seem to be the required
microsoft compiler.
configure: The result from running it was: "Compilador de optimizaci▒n de
C/C++ de Microsoft (R) versi▒n 19.00.24234.1 para x86"

(from 
http://mail.openjdk.java.net/pipermail/build-dev/2018-October/023663.html)

The check looks for "Microsoft.*Compiler". I think that to be language 
neutral we can only really look for "Microsoft". If the tool is also 
named cl.exe, then I think that's enough due diligence from us in trying 
to fail early.

Bug: https://bugs.openjdk.java.net/browse/JDK-8212986
Patch inline:
diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4
--- a/make/autoconf/toolchain.m4
+++ b/make/autoconf/toolchain.m4
@@ -450,9 +450,10 @@
      # There is no specific version flag, but all output starts with a 
version string.
      # First line typically looks something like:
      # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 
16.00.40219.01 for 80x86
+    # but the compiler name may vary depending on locale.
      COMPILER_VERSION_OUTPUT=`"$COMPILER" 2>&1 | $GREP -v 
'ERROR.*UtilTranslatePathList' | $HEAD -n 1 | $TR -d '\r'`
      # Check that this is likely to be Microsoft CL.EXE.
-    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > 
/dev/null
+    $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft" > /dev/null
      if test $? -ne 0; then
        AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as 
$COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
        AC_MSG_NOTICE([The result from running it was: 
"$COMPILER_VERSION_OUTPUT"])

/Magnus




More information about the build-dev mailing list