JDK-8266405 : Fix CMake Generator error building Windows WebKit
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: openjfx17
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2021-05-01
  • Updated: 2021-05-04
  • Resolved: 2021-05-04
Related Reports
Relates :  
Description
The build of WebKit on Windows fails with the messages:

  CMake Error at CMakeLists.txt:13 (project):
    Generator

      Visual Studio 15 2017 Win64

    could not find any instance of Visual Studio.

SYSTEM / OS / JAVA RUNTIME INFORMATION

Microsoft Windows 10 Pro version 10.0.19042
Microsoft Visual Studio 2019 version 16.9.4

Cygwin 3.2.0
  $ uname -srm
  CYGWIN_NT-10.0 3.2.0(0.340/5/3) x86_64

CMake 3.20.0
  $ cmake --version
  cmake version 3.20.0

Oracle OpenJDK 15.0.2
  $ java --version
  openjdk 15.0.2 2021-01-19
  OpenJDK Runtime Environment (build 15.0.2+7-27)
  OpenJDK 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

Apache Ant 1.10.9
  $ ant -version
  Apache Ant(TM) version 1.10.9 compiled on September 27 2020

Gradle 6.3
  $ gradle --version

  ------------------------------------------------------------
  Gradle 6.3
  ------------------------------------------------------------

  Build time:   2020-03-24 19:52:07 UTC
  Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

  Kotlin:       1.3.70
  Groovy:       2.5.10
  Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
  JVM:          15.0.2 (Oracle Corporation 15.0.2+7-27)
  OS:           Windows 10 10.0 amd64

STEPS TO REPRODUCE

Follow the instructions for building JavaFX on Windows found here:

Building OpenJFX
https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX

Run a build that includes WebKit. For example, I ran:

  $ gradle -PCOMPILE_WEBKIT=true sdk

EXPECTED RESULTS

The build succeeds:

  BUILD SUCCESSFUL in 1h 10m 37s
  140 actionable tasks: 140 executed

ACTUAL RESULT

The build fails:

  > Task :web:compileNativeWin
  +  cmake ...
  CMake Error at CMakeLists.txt:13 (project):
    Generator

      Visual Studio 15 2017 Win64

    could not find any instance of Visual Studio.

  -- Configuring incomplete, errors occurred!
  See also "C:/cygwin64/home/john/src/jfx/
    modules/javafx.web/build/win/Release/CMakeFiles/CMakeOutput.log".

  > Task :web:compileNativeWin FAILED

  FAILURE: Build failed with an exception.

  * Where:
  Build file 'C:\cygwin64\home\john\src\jfx\build.gradle' line: 3491

  * What went wrong:
  Execution failed for task ':web:compileNativeWin'.
  > Process 'command 'perl'' finished with non-zero exit value 1

  ...

  BUILD FAILED in 4m 20s
  55 actionable tasks: 55 executed

SOURCE CODE FOR AN EXECUTABLE TEST CASE

None.

WORKAROUND

I worked around the problem by patching the file:

  modules/javafx.web/src/main/native/Tools/Scripts/webkitdirs.pm

as shown in the attached file called 'webkitdirs.pm.patch'.

Comments
OK. In that case, I recommend to close this JBS bug as "Not an issue".
04-05-2021

This problem went away when I added '/cygdrive/c/Windows/System32' to my PATH environment variable while finding a solution to JDK-8266396. I didn't bother to figure out why. My proposal to use JDK-8266396 to document the debug logging variable in the 'win.gradle' file should allow developers with problematic PATH settings to find and fix the original source of the error before ever encountering this one.
04-05-2021

I would definitely recommend CMake 3.13.3. As for Visual Studio, the one I just installed locally was also 16.9.4 (although our CI pipeline just updated to 16.9.3). The only version of Visual Studio I have on my system is VS 2019 16.9.4 as of now, and Cmake 3.13.3 was able to find it just fine. See the attached (partial) "build-webkit.log" file.
03-05-2021

How is it working on your system when the 'webkitdirs.pm' file hard-codes the generator as 'Visual Studio 15 2017 Win64'? Do you have both versions of Visual Studio installed? At this point, I think I should remove Visual Studio and CMake and reinstall the specific versions you're using: CMake version 3.13.3 and Visual Studio 2019 version 16.9.3. (I'm now using CMake 3.20.0 and Visual Studio 16.9.4.) By the way, I'm running all the builds through an SSH session to the Cygwin SSH server on my Windows QEMU/KVM guest virtual machine.
03-05-2021

We use cmake 3.13.3, as defined in build.properties, so I don't know whether that makes a difference or not. Perhaps the same thing that is causing JDK-8266396 is affecting this as well? Hard to say.
03-05-2021

The patch works on my system because Visual Studio 16 2019 is the default generator for CMake 3.20.0 on Windows, and that's the version of Visual Studio that I installed. See the attached 'cmake-help.txt' file and the excerpt below: Generators The following generators are available on this platform (* marks default): * Visual Studio 16 2019 = Generates Visual Studio 2019 project files. Use -A option to specify architecture. Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files. Optional [arch] can be "Win64" or "IA64". Visual Studio 9 2008 [arch] = Generates Visual Studio 2008 project files. Optional [arch] can be "Win64" or "IA64". ...
01-05-2021