gluonhq / gluonfx-maven-plugin

Plugin that simplifies creating native images for Java/JavaFX maven projects
BSD 3-Clause "New" or "Revised" License
186 stars 38 forks source link

Gluon plugin downloaded and specified an android NDK which doesn't contain ld.lld #475

Open metacodez opened 1 year ago

metacodez commented 1 year ago

Dear Gluon-Team,

thanks for the great work! I am impressed that I can use JavaFx alongside Java to build Android apps!

Lately I just updated a couple of dependencies when I encountered an error when building for Android:

Invoking mvn clean gluonfx:build gluonfx:package -Pandroid fails as of java.io.IOException, stating that I specified an android NDK, but it doesn't contain ~/.gluon/substrate/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld.

The ndk-bundle of the Android SDK downloaded by the plugin seems to be located in the folder ~/.gluon/substrate/Android/ndk/25.2.9519653.

To fix this issue, I created a simlink for the plugin to find the ndk-bundle again:

cd ~/.gluon/substrate/Android 
ln -s ndk/25.2.9519653/ ndk-bundle

The build messsage of the failed build looks as follows:

mvn clean gluonfx:build gluonfx:package -Pandroid
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] 
[INFO] -------------------< com.comcodes:comcodes-dingdash >-------------------
[INFO] Building com.comcodes:comcodes-dingdash 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.3.1:clean (default-clean) @ comcodes-dingdash ---
[INFO] Deleting /home/steiner/Workspaces/com.comcodes/comcodes-dingdash/target
[INFO] 
[INFO] -------------------< com.comcodes:comcodes-dingdash >-------------------
[INFO] Building com.comcodes:comcodes-dingdash 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- gluonfx-maven-plugin:1.0.18:build (default-cli) @ comcodes-dingdash ---
Downloading from apache: https://repo.maven.apache.org/maven2/com/gluonhq/substrate/0.0.58/substrate-0.0.58.pom
Downloaded from apache: https://repo.maven.apache.org/maven2/com/gluonhq/substrate/0.0.58/substrate-0.0.58.pom (2.2 kB at 4.9 kB/s)
Downloading from apache: https://repo.maven.apache.org/maven2/com/gluonhq/substrate/0.0.58/substrate-0.0.58.jar
Downloaded from apache: https://repo.maven.apache.org/maven2/com/gluonhq/substrate/0.0.58/substrate-0.0.58.jar (1.2 MB at 927 kB/s)
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] 
[INFO] -------------------< com.comcodes:comcodes-dingdash >-------------------
[INFO] Building com.comcodes:comcodes-dingdash 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> gluonfx-maven-plugin:1.0.18:compile (default-cli) > process-classes @ comcodes-dingdash >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:3.3.0:enforce (enforce-versions) @ comcodes-dingdash ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO] 
[INFO] --- build-helper-maven-plugin:3.4.0:regex-property (module-name) @ comcodes-dingdash ---
[INFO] 
[INFO] --- build-helper-maven-plugin:3.4.0:regex-property (module-domain) @ comcodes-dingdash ---
[INFO] 
[INFO] --- groovy-maven-plugin:2.1.1:execute (default) @ comcodes-dingdash ---
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ comcodes-dingdash ---
[INFO] Copying 120 resources from src/main/resources to target/classes
[INFO] 
[INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ comcodes-dingdash ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 39 source files with javac [forked debug optimize target 17 module-path] to target/classes
[INFO] 
[INFO] <<< gluonfx-maven-plugin:1.0.18:compile (default-cli) < process-classes @ comcodes-dingdash <<<
[INFO] 
[INFO] 
[INFO] --- gluonfx-maven-plugin:1.0.18:compile (default-cli) @ comcodes-dingdash ---
Juni 25, 2023 10:56:11 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: ANDROID_SDK not found and will be downloaded.
Juni 25, 2023 10:56:11 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: ANDROID_NDK not found and will be downloaded.
Juni 25, 2023 10:56:11 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: sysroot path not found and will be downloaded.
Juni 25, 2023 10:56:11 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Downloading JavaFX static libs...

Download progress: 0,01 / 23,85M
Download progress: 2,39 / 23,85M
Download progress: 4,77 / 23,85M
Download progress: 7,16 / 23,85M
Download progress: 9,55 / 23,85M
Download progress: 11,93 / 23,85M
Download progress: 14,31 / 23,85M
Download progress: 16,70 / 23,85M
Download progress: 19,09 / 23,85M
Download progress: 21,47 / 23,85M
Download progress: 23,85 / 23,85M
Juni 25, 2023 10:56:33 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: JavaFX static libs downloaded successfully
Juni 25, 2023 10:56:33 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Downloading Android SDK manager...

Download progress: 0,00 / 127,32M
Download progress: 12,73 / 127,32M
Download progress: 25,47 / 127,32M
Download progress: 38,20 / 127,32M
Download progress: 50,93 / 127,32M
Download progress: 63,66 / 127,32M
Download progress: 76,40 / 127,32M
Download progress: 89,13 / 127,32M
Download progress: 101,86 / 127,32M
Download progress: 114,59 / 127,32M
Download progress: 127,32 / 127,32M
Juni 25, 2023 10:57:40 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Android SDK manager downloaded successfully
Juni 25, 2023 10:57:40 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Downloading Android toolchain. It may take several minutes depending on your bandwidth.
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Juni 25, 2023 11:08:09 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Android toolchain downloaded successfully
Juni 25, 2023 11:08:09 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Downloading sysroot zip...

Download progress: 0,01 / 62,36M
Download progress: 6,24 / 62,36M
Download progress: 12,48 / 62,36M
Download progress: 18,71 / 62,36M
Download progress: 24,95 / 62,36M
Download progress: 31,18 / 62,36M
Download progress: 37,42 / 62,36M
Download progress: 43,66 / 62,36M
Download progress: 49,89 / 62,36M
Download progress: 56,12 / 62,36M
Download progress: 62,36 / 62,36M
Juni 25, 2023 11:08:51 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Sysroot zip downloaded successfully
Juni 25, 2023 11:08:51 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: ANDROID_NDK not found and will be downloaded.
Juni 25, 2023 11:08:51 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Downloading Android toolchain. It may take several minutes depending on your bandwidth.
..
Juni 25, 2023 11:08:53 AM com.gluonhq.substrate.util.Logger logInfo
INFORMATION: Android toolchain downloaded successfully
[So. Juni 25 11:08:53 MESZ 2023][INFORMATION] ==================== COMPILE TASK ====================
             _______  ___      __   __  _______  __    _
            |       ||   |    |  | |  ||       ||  |  | |
            |    ___||   |    |  | |  ||   _   ||   |_| |
            |   | __ |   |    |  |_|  ||  | |  ||       |
            |   ||  ||   |___ |       ||  |_|  ||  _    |
            |   |_| ||       ||       ||       || | |   |
            |_______||_______||_______||_______||_|  |__|

    Access to the latest docs, tips and tricks and more info on
    how to get support? Register your usage of Gluon Substrate now at

    https://gluonhq.com/activate

[So. Juni 25 11:08:53 MESZ 2023][INFORMATION] We will now compile your code for aarch64-linux-android. This may take some time.
java.io.IOException: You specified an android NDK, but it doesn't contain /home/steiner/.gluon/substrate/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld
    at com.gluonhq.substrate.target.AndroidTargetConfiguration.compile(AndroidTargetConfiguration.java:123)
    at com.gluonhq.substrate.SubstrateDispatcher.nativeCompile(SubstrateDispatcher.java:425)
    at com.gluonhq.NativeCompileMojo.execute(NativeCompileMojo.java:54)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    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:298)
    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:960)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:44 min
[INFO] Finished at: 2023-06-25T11:08:53+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.18:compile (default-cli) on project comcodes-dingdash: Error: You specified an android NDK, but it doesn't contain /home/steiner/.gluon/substraYou specified an android NDK, but it doesn't contain /home/steiner/.gluon/substrate/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld te/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld -> [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
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Skipping com.comcodes:comcodes-dingdash
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:48 min
[INFO] Finished at: 2023-06-25T11:08:53+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.18:build (default-cli) on project comcodes-dingdash: Error, gluonfx: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

Hope this helps, maybe others also have this issue -

Best regards, Siegfried

jperedadnr commented 1 year ago

Did you set ANDROID_NDK? Check that you don't have it, or if you do, it points to the current NDK location?

metacodez commented 1 year ago

I just verified that the ANDROID_NDK environment variable has not been set (it is quite a fresh Arch installation, so there is not much I installed manually). Maybe the issue has been resolved with yesterday's version 1.0.19, though I didn't test yet.