Search code examples
javamavenjavafxvisual-studio-2019graalvm

Gluon client maven plugin for JavaFX on Windows fails to compile?


I've been experimenting with Gluon's client maven plugin on a Windows machine for a project of mine. I decided to try out one of their "hello world" examples, here. I followed all of the steps on how to configure the machine.

However, I've encountered some errors. For some reason, the compiling always fails and gives me an error "Cannot run program "cl"". Does anyone have any clue on how to fix this?

I am running the client:build command in a "x64 Native Tools Command Prompt for VS 2019" window.

The logs are below:

java.io.IOException: Cannot run program "cl" (in directory "C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\hellofxml"): CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.substrate.util.ProcessRunner.setupProcess(ProcessRunner.java:336)
[INFO] BUILD FAILURE
        at com.gluonhq.substrate.util.ProcessRunner.runProcess(ProcessRunner.java:194)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.substrate.target.AbstractTargetConfiguration.compileAdditionalSources(AbstractTargetConfiguration.java:330)
[INFO] Total time:  2.860 s
        at com.gluonhq.substrate.target.AbstractTargetConfiguration.compile(AbstractTargetConfiguration.java:130)
[INFO] Finished at: 2020-06-02T17:37:39-04:00
        at com.gluonhq.substrate.SubstrateDispatcher.nativeCompile(SubstrateDispatcher.java:414)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.NativeCompileMojo.execute(NativeCompileMojo.java:54)
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.26:compile (default-cli) on project hellofxml: Error: Cannot run program "cl" (in directory "C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\hellofxml"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] For more information about the errors and possible solutions, please read the following articles:
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessImpl.create(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:420)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:151)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
        ... 29 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.141 s
[INFO] Finished at: 2020-06-02T17:37:39-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.26:build (default-cli) on project hellofxml: Error, client:build failed -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

When I add C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64 to my system path, the plugin gives the following error in the logs. (I ran this command in admin mode)

[Tue Jun 02 18:28:07 EDT 2020][INFO] ==================== COMPILE TASK ====================
[Tue Jun 02 18:28:08 EDT 2020][FINE] PB Command for check version: D:\graalvm-ce-java11-20.2.0-dev\bin\java -version
[Tue Jun 02 18:28:08 EDT 2020][FINE] Start process check version...
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] openjdk version "11.0.7" 2020-04-14
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] OpenJDK Runtime Environment GraalVM CE 20.2.0-dev (build 11.0.7+10-jvmci-20.1-b02)
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] OpenJDK 64-Bit Server VM GraalVM CE 20.2.0-dev (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
[Tue Jun 02 18:28:09 EDT 2020][FINE] Result for check version: 0
[Tue Jun 02 18:28:09 EDT 2020][INFO] We will now compile your code for x86_64-microsoft-windows. This may take some time.
[Tue Jun 02 18:28:09 EDT 2020][FINE] Extracting native libs to: C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\lib
[Tue Jun 02 18:28:09 EDT 2020][FINE] Looking for resource: /native/windows/launcher.c
[Tue Jun 02 18:28:09 EDT 2020][FINE] PB Command for compile-additional-sources: cl -c -DSUBSTRATE /MD /D_UNICODE /DUNICODE /DWIN32 /D_WINDOWS -IC:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\hellofxml launcher.c
[Tue Jun 02 18:28:09 EDT 2020][FINE] Start process compile-additional-sources...
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28610.4 for x64
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] Copyright (C) Microsoft Corporation.  All rights reserved.
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] 
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] launcher.c
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] launcher.c(28): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
[Tue Jun 02 18:28:09 EDT 2020][FINE] Result for compile-additional-sources: 2
[Tue Jun 02 18:28:09 EDT 2020][SEVERE] Process compile-additional-sources failed with result: 2
Check the log files under C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/client/ for more information.
[Tue Jun 02 18:28:09 EDT 2020][INFO] Logging process [compile-additional-sources] to file: C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\log\process-compile-additional-sources-1591136889122.log
[Tue Jun 02 18:28:09 EDT 2020][SEVERE] Compiling failed.
Check the log files under C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/client/ for more information.

These are the VS 2019 components I have installed.


Solution

  • I've had the same two issues:

    1. No cl operations possible
    2. stdio.h or similar file cannot be found

    Solution for the first issue (author did already):

    Make sure the system path contains the Visual Studio entry. Something like "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64"

    Visual Studio seems to miss the entry on the path variable sometimes on installation. I had it installed to a different directory. That might cause the problem.

    Solution for the second issue:

    The documentation states that you have to run all maven or gradle commands in the Native Tools Command Prompt if running on Windows. I missed that part a few times while reading the docs.

    If you are running on Windows, you need to run all the Client goals from an x64 terminal.

    After that i was able to use the client:compile and client:link goals.