Open karussell opened 4 years ago
Your GraalVM is too old. CustomLD was added after the 19.3 freeze. It is in the tip now though.
you can get an unsupported build here: https://download2.gluonhq.com/subtrate/graalvm/graalvm-svm-linux-20.0.0-ea+20.zip
Thanks a lot!
Your GraalVM is too old. CustomLD was added after the 19.3 freeze.
Can I also use an older client-samples version that would work with 19.3?
It is in the tip now though.
What do you mean with "tip" - the readme?
you can get an unsupported build here:
Unfortunately the link is not working for me (404). And if it works: where do I copy it? Somewhere into graalvm-ce-java11-19.3.0/lib/svm/?
I was able to build graalvm from sources via this script without errors. I hope these are the correct and sufficient steps - I just copied them as I wasn't able to get it working with a different or official procedure.
Then I did:
export GRAALVM_HOME=/path/to/graal/sdk/latest_graalvm_home/
mvn clean client:build
but the mvn command still fails. Do I need a specific commit when compiling the graalvm repo or a specific NDK version?
The error is:
[hello.helloworld:32697] classlist: 2,598.27 ms, 1.00 GB
[hello.helloworld:32697] (cap): 936.35 ms, 1.24 GB
[hello.helloworld:32697] setup: 1,466.30 ms, 1.24 GB
Error: Error compiling query code (in /path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives.c). Compiler command gcc /path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives.c -o /path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives output included error: /path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives.c:250:147: error: ‘mcontext_t {aka struct <anonymous>}’ has no member named ‘fault_address’
type com.oracle.svm.core.posix.headers.Signal$mcontext_t
C file contents around line 250:
/path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives.c:249: printf("NativeCodeInfo:PosixDirectives:StructInfo:mcontext_t:PropertyInfo:size=%lu\n", sizeof(mcontext_t));
/path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives.c:250: printf("NativeCodeInfo:PosixDirectives:StructInfo:mcontext_t:StructFieldInfo:fault_address:PropertyInfo:size=%lu\n", sizeof(((mcontext_t *) 0)->fault_address));
/path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576329982130/PosixDirectives.c:251: printf("NativeCodeInfo:PosixDirectives:StructInfo:mcontext_t:StructFieldInfo:fault_address:PropertyInfo:offset=%lu\n", offsetof(mcontext_t, fault_address));
...
...
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
Compilation failed with result = 1
Compilation failed. The error should be printed above.
PROCESS ZIP, url = http://download2.gluonhq.com/substrate/clibs/android-aarch64.zip, zp = /path/to/graal/sdk/latest_graalvm_home/lib/svm/clibraries/android-aarch64.zip, folder = android-aarch64, version = null, name = android-aarch64-android-aarch64.md5
java.lang.IllegalArgumentException: Linking failed, since there is no objectfile named hello.helloworld.o under /path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm
at com.gluonhq.substrate.target.AbstractTargetConfiguration.lambda$link$0(AbstractTargetConfiguration.java:213)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at com.gluonhq.substrate.target.AbstractTargetConfiguration.link(AbstractTargetConfiguration.java:211)
at com.gluonhq.substrate.target.AndroidTargetConfiguration.link(AndroidTargetConfiguration.java:130)
at com.gluonhq.substrate.SubstrateDispatcher.nativeLink(SubstrateDispatcher.java:236)
at com.gluonhq.NativeLinkMojo.execute(NativeLinkMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
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: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:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
...
With client.plugin.version=0.1.7 I got a bit progress:
[INFO] Compiling 1 source file to /path/to/client-samples/Maven/HelloWorld/target/classes
We will now compile your code for aarch64-linux-android. This may take some time.
Build on Server(pid: 14905, port: 41153)
[hello.helloworld:14905] classlist: 342.95 ms, 1.00 GB
[hello.helloworld:14905] (cap): 218.75 ms, 1.00 GB
[hello.helloworld:14905] setup: 1,804.52 ms, 1.00 GB
[hello.helloworld:14905] (typeflow): 13,539.15 ms, 1.65 GB
[hello.helloworld:14905] (objects): 12,436.05 ms, 1.65 GB
[hello.helloworld:14905] (features): 1,004.77 ms, 1.65 GB
[hello.helloworld:14905] analysis: 27,657.25 ms, 1.65 GB
[hello.helloworld:14905] (clinit): 404.92 ms, 1.65 GB
[hello.helloworld:14905] universe: 1,222.24 ms, 1.65 GB
[hello.helloworld:14905] (parse): 2,945.15 ms, 1.65 GB
[hello.helloworld:14905] (inline): 3,097.57 ms, 1.65 GB
[hello.helloworld:14905] (compile): 22,274.88 ms, 1.65 GB
[hello.helloworld:14905] (bitcode): 197.53 ms, 1.65 GB
[hello.helloworld:14905] (prelink): 207.66 ms, 1.65 GB
[hello.helloworld:14905] compile: 28,982.56 ms, 1.65 GB
Fatal error: org.graalvm.compiler.debug.GraalError: LLVM linking failed into batch 0 (f0-f2048). Use -H:LLVMBatchesPerThread=-1 to compile each method individually. (/path/to/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm/tmp/SVM-1576338030707/llvm/b0.bc): 1
at com.oracle.svm.core.graal.llvm.LLVMNativeImageCodeCache.llvmLink(LLVMNativeImageCodeCache.java:552)
at com.oracle.svm.core.graal.llvm.LLVMNativeImageCodeCache.lambda$createBitcodeBatches$8(LLVMNativeImageCodeCache.java:433)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.accept(ForEachOps.java:204)
at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1
Compilation failed with result = 1
Compilation failed. The error should be printed above.
[INFO]
[INFO] --- client-maven-plugin:0.1.7:link (default-cli) @ helloworld ---
java.io.IOException: Missing library libjvm.a not in linkpath /path/to/graal/sdk/latest_graalvm_home/lib/svm/clibraries/android-aarch64
at com.gluonhq.substrate.target.PosixTargetConfiguration.checkPlatformSpecificClibs(PosixTargetConfiguration.java:46)
at com.gluonhq.substrate.target.AbstractTargetConfiguration.ensureClibs(AbstractTargetConfiguration.java:202)
at com.gluonhq.substrate.target.AbstractTargetConfiguration.link(AbstractTargetConfiguration.java:227)
at com.gluonhq.substrate.target.AndroidTargetConfiguration.link(AndroidTargetConfiguration.java:125)
at com.gluonhq.substrate.SubstrateDispatcher.nativeLink(SubstrateDispatcher.java:227)
at com.gluonhq.NativeLinkMojo.execute(NativeLinkMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
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: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:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
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:566)
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
Probably related to the recent changes: https://github.com/gluonhq/substrate/issues/168, https://github.com/gluonhq/substrate/issues/169, https://github.com/gluonhq/substrate/pull/170
With client.plugin.version=0.1.9 and:
export JAVA8_HOME=/path/to/jdk-8/
export ANDROID_SDK=/path/to/android-sdk-linux/
export ANDROID_NDK=/path/to/android-sdk-linux/ndk/20.1.5948944/
export GRAALVM_HOME=/path/to/graal/sdk/latest_graalvm_home/ # from sources 2019-12-23
mvn clean client:build
I get
[hello.helloworld:28168] compile: 31,704.61 ms, 2.08 GB
Error: ImageSingletons do not contain key org.graalvm.home.HomeFinder
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
Compilation failed with result = 1
Compilation failed. The error should be printed above.
[INFO]
[INFO] --- client-maven-plugin:0.1.9:link (default-cli) @ helloworld ---
java.lang.IllegalArgumentException: Linking failed, since there is no objectfile named hello.helloworld.o under /home/peter/Documents/quell/examples/client-samples/Maven/HelloWorld/target/client/aarch64-android/gvm
at com.gluonhq.substrate.target.AbstractTargetConfiguration.lambda$link$0(AbstractTargetConfiguration.java:208)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at com.gluonhq.substrate.target.AbstractTargetConfiguration.link(AbstractTargetConfiguration.java:206)
at com.gluonhq.substrate.target.AndroidTargetConfiguration.link(AndroidTargetConfiguration.java:137)
at com.gluonhq.substrate.SubstrateDispatcher.nativeLink(SubstrateDispatcher.java:227)
at com.gluonhq.NativeLinkMojo.execute(NativeLinkMojo.java:54)
which is a bit strange as https://github.com/oracle/graal/pull/1890 is already merged. Will try to build graal from scratch again.
Update: Still does not work. Is this due to the patched substratevm from gluon?
Error: ImageSingletons do not contain key org.graalvm.home.HomeFinder That doesn't ring a bell. Note that we currently build with a GraalVM that is a few weeks old, so this might be regression. Now that there is more bundled LLVM support in GraalVM, we'll create a new bundle soon and maybe that one fails then too, so that we can reproduce.
I have the same issue with the latest GraalVM head on iOS
Error: ImageSingletons do not contain key org.graalvm.home.HomeFinder
I created an issue in GraalVM: https://github.com/oracle/graal/issues/2033
you can get an unsupported build here: https://download2.gluonhq.com/subtrate/graalvm/graalvm-svm-linux-20.0.0-ea+20.zip
Unfortunately the link is not working for me (404).
This one is working for me: https://download2.gluonhq.com/substrate/graalvm/graalvm-svm-linux-20.0.0-ea+20.zip
The link given in the original reply contains a typo in "substrate" (the "s" between "b" and "t" has been missing).
You're right, sorry about the typo!
Cool! Thanks a lot to both of you - one step further!
So, instead of
export GRAALVM_HOME=/path/to/graal/sdk/latest_graalvm_home/ # from sources 2019-12-23
I'm using graalvm-svm-linux-20.0.0-ea+20
and it compiles without a problem now and created an executable in target/client/aarch64-android/helloWorld
.
Now I tried the following but I got a segmentation fault:
android-sdk-linux/platform-tools/adb push helloWorld /data/local/tmp/
android-sdk-linux/platform-tools/adb shell
$ /data/local/tmp/helloWorld
Segmentation fault
Or is this the wrong way to verify that it works on Android?
And "aarch64" requires an ARM based phone, right?
I would like to try another phone: how do I create binaries for another architectures? It seems there is also arch-arm,arch-x86 and arch-x86_64 supported by my installed NDK.
@johanvos Thank you for all your work!
I don't know if it is really realted to this issue as it is about "Ubuntu 18.10" and perhaps there is already a mixture of different problems. If I should open a separate issue, just comment and I will delete my post and comment in a new issue.
I tried to compile the simple project created by the "client-archetype-mobile" for android.
I used:
[INFO] Compiling 1 source file to /home/maggu2810/workspace/projects/gluon/prv/mobile-test/target/classes
We will now compile your code for aarch64-linux-android. This may take some time.
Build on Server(pid: 45267, port: 37145)
[de.maggu2810.playground.gluon.test1.hellogluon:45267] classlist: 2,204.20 ms, 1.00 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (cap): 83.71 ms, 1.00 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] setup: 548.37 ms, 1.00 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (typeflow): 13,383.86 ms, 3.54 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (objects): 13,251.56 ms, 3.54 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (features): 1,071.68 ms, 3.54 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] analysis: 28,902.67 ms, 3.54 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (clinit): 898.81 ms, 3.54 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] universe: 2,647.69 ms, 3.54 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (parse): 3,276.72 ms, 3.99 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (inline): 3,366.05 ms, 4.86 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (compile): 23,248.96 ms, 5.42 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (bitcode): 1,240.07 ms, 5.42 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (prelink): 12,399.58 ms, 5.42 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] (llvm): 14,734.79 ms, 5.42 GB
[de.maggu2810.playground.gluon.test1.hellogluon:45267] compile: 58,795.95 ms, 5.42 GB
Fatal error: org.graalvm.compiler.debug.GraalError: LLVM compilation failed for batch 3 (f10944-f14592). Use -H:LLVMBatchesPerThread=-1 to compile each method individually. (/home/maggu2810/workspace/projects/gluon/prv/mobile-test/target/client/aarch64-android/gvm/tmp/SVM-1579944097905/llvm/b3o.bc): 127
at com.oracle.svm.core.graal.llvm.LLVMNativeImageCodeCache.llvmCompile(LLVMNativeImageCodeCache.java:525)
at com.oracle.svm.core.graal.llvm.LLVMNativeImageCodeCache.lambda$compileBitcodeBatches$9(LLVMNativeImageCodeCache.java:447)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.accept(ForEachOps.java:204)
at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1
Compilation failed with result = 1
Compilation failed. See error printed above.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:44 min
[INFO] Finished at: 2020-01-25T10:23:10+01:00
[INFO] ------------------------------------------------------------------------
What needs to be changed to succeed or to get better diagnostic information?
@johanvos Can you please give me / us some instructions how to get a build running for the target type "android"?
I try to provide you with all the information I can give you, for example what I did today:
mvn archetype:generate \
-DarchetypeGroupId=com.gluonhq \
-DarchetypeArtifactId=client-archetype-mobile \
-DarchetypeVersion=0.0.2-SNAPSHOT
Confirm properties configuration:
groupId: de.maggu2810.playground.gluon
artifactId: gluon-mobile-test
version: 1.0-SNAPSHOT
package: de.maggu2810.playground.gluon
client-maven-plugin-version: 0.1.15
javafx-maven-plugin-version: 0.0.3
javafx-version: 13.0.1
(jcmd graalvm) [maggu2810@m3800 gluon-mobile-test]$ java --version
openjdk 11.0.5 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-jvmci-19.3-b05-LTS)
OpenJDK 64-Bit Server VM GraalVM 20.0.0-dev (build 11.0.5+10-jvmci-19.3-b05-LTS, mixed mode, sharing)
(jcmd graalvm) [maggu2810@m3800 gluon-mobile-test]$ javac --version
javac 11.0.5
export ANDROID_SDK=/home/maggu2810/Android/Sdk/
export ANDROID_NDK=/home/maggu2810/Android/Sdk/ndk/21.0.6113669/
mvn clean install
that succeededmvn clean client:build
[INFO] Compiling 1 source file to /home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/classes
We will now compile your code for aarch64-linux-android. This may take some time.
Build on Server(pid: 5278, port: 46419)
[de.maggu2810.playground.gluon.hellogluon:5278] classlist: 1,772.98 ms, 1.55 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (cap): 125.03 ms, 1.55 GB
[de.maggu2810.playground.gluon.hellogluon:5278] setup: 613.41 ms, 1.55 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (typeflow): 17,397.59 ms, 3.83 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (objects): 15,572.22 ms, 3.83 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (features): 1,308.69 ms, 3.83 GB
[de.maggu2810.playground.gluon.hellogluon:5278] analysis: 36,050.68 ms, 3.83 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (clinit): 1,304.26 ms, 4.78 GB
[de.maggu2810.playground.gluon.hellogluon:5278] universe: 3,347.75 ms, 4.78 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (parse): 4,284.79 ms, 5.15 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (inline): 3,757.27 ms, 5.37 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (compile): 29,558.33 ms, 5.70 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (bitcode): 1,060.21 ms, 5.70 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (prelink): 11,699.63 ms, 5.70 GB
[de.maggu2810.playground.gluon.hellogluon:5278] (llvm): 20,345.74 ms, 5.70 GB
[de.maggu2810.playground.gluon.hellogluon:5278] compile: 71,156.54 ms, 5.70 GB
Fatal error: org.graalvm.compiler.debug.GraalError: LLVM compilation failed for batch 6 (f22050-f25725). Use -H:LLVMBatchesPerThread=-1 to compile each method individually. (/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/tmp/SVM-1580550141578/llvm/b6o.bc): 127
at com.oracle.svm.core.graal.llvm.LLVMNativeImageCodeCache.llvmCompile(LLVMNativeImageCodeCache.java:525)
at com.oracle.svm.core.graal.llvm.LLVMNativeImageCodeCache.lambda$compileBitcodeBatches$9(LLVMNativeImageCodeCache.java:447)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.accept(ForEachOps.java:204)
at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1
[INFO]
[INFO] --- client-maven-plugin:0.1.15:link (default-cli) @ gluon-mobile-test ---
Compilation failed with result = 1
Compilation failed. See error printed above.
java.lang.IllegalArgumentException: Linking failed, since there is no objectfile named de.maggu2810.playground.gluon.hellogluon.o under /home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm
at com.gluonhq.substrate.target.AbstractTargetConfiguration.lambda$link$0(AbstractTargetConfiguration.java:210)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at com.gluonhq.substrate.target.AbstractTargetConfiguration.link(AbstractTargetConfiguration.java:208)
at com.gluonhq.substrate.target.AndroidTargetConfiguration.link(AndroidTargetConfiguration.java:132)
at com.gluonhq.substrate.SubstrateDispatcher.nativeLink(SubstrateDispatcher.java:216)
at com.gluonhq.NativeLinkMojo.execute(NativeLinkMojo.java:54)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
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: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:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
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:566)
[INFO] ------------------------------------------------------------------------
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:08 min
[INFO] Finished at: 2020-02-01T10:44:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.15:link (default-cli) on project gluon-mobile-test: Error: Linking failed, since there is no objectfile named de.maggu2810.playground.gluon.hellogluon.o under /home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm -> [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] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:12 min
[INFO] Finished at: 2020-02-01T10:44:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.15:build (default-cli) on project gluon-mobile-test: 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
That looks like one of the bitcode files can't be compiled. The error is unfortunately not shown. I'll file an issue with GraalVM that the error is printed in case it occurs. What you can do in this case is to manually invoke llc on the failing file (/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/tmp/SVM-1580550141578/llvm/b6o.bc) and see why it fails, that typically gives a hint
As it is about cross compiling I checked the command line that is executed:
/home/maggu2810/bin/pkgs/java/graalvm/graalvm-svm-linux-20.0.0-ea+20/bin/native-image --report-unsupported-elements-at-runtime -Djdk.internal.lambda.eagerlyInitialize=false -H:+ExitAfterRelocatableImageWrite -H:TempDirectory=/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/tmp -H:+SharedLibrary -H:+AddAllCharsets -H:ReflectionConfigurationFiles=/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/reflectionconfig-aarch64-android.json -H:JNIConfigurationFiles=/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/jniconfig-aarch64-android.json -H:ResourceConfigurationFiles=/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/resourceconfig-aarch64-android.json -H:CompilerBackend=llvm -H:-SpawnIsolates -Dsvm.targetArch=aarch64 -H:+UseOnlyWritableBootImageHeap -H:+UseCAPCache -H:CAPCacheDir=/home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/capcache -H:CustomLD=/home/maggu2810/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/ld.lld -H:CustomLLC=/home/maggu2810/.gluon/substrate/llc/x86_64-linux/1/llc-x86_64-linux-1 -H:IncludeResourceBundles=com/sun/javafx/scene/control/skin/resources/controls,com.sun.javafx.tk.quantum.QuantumMessagesBundle -Dsvm.platform=org.graalvm.nativeimage.Platform$LINUX_AARCH64 -cp /home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/classes:/home/maggu2810/.m2/repository/com/gluonhq/charm-glisten/6.0.1/charm-glisten-6.0.1.jar:/home/maggu2810/.m2/repository/com/gluonhq/attach/display/4.0.2/display-4.0.2.jar:/home/maggu2810/.m2/repository/com/gluonhq/attach/lifecycle/4.0.2/lifecycle-4.0.2.jar:/home/maggu2810/.m2/repository/com/gluonhq/attach/statusbar/4.0.2/statusbar-4.0.2.jar:/home/maggu2810/.m2/repository/com/gluonhq/attach/storage/4.0.2/storage-4.0.2.jar:/home/maggu2810/.m2/repository/com/gluonhq/attach/util/4.0.2/util-4.0.2.jar:/home/maggu2810/.gluon/substrate/javafxStaticSdk/14-ea+gvm8/android-aarch64/sdk/lib/javafx-base.jar:/home/maggu2810/.gluon/substrate/javafxStaticSdk/14-ea+gvm8/android-aarch64/sdk/lib/javafx-base.jar:/home/maggu2810/.gluon/substrate/javafxStaticSdk/14-ea+gvm8/android-aarch64/sdk/lib/javafx-controls.jar:/home/maggu2810/.gluon/substrate/javafxStaticSdk/14-ea+gvm8/android-aarch64/sdk/lib/javafx-controls.jar:/home/maggu2810/.gluon/substrate/javafxStaticSdk/14-ea+gvm8/android-aarch64/sdk/lib/javafx-graphics.jar:/home/maggu2810/.gluon/substrate/javafxStaticSdk/14-ea+gvm8/android-aarch64/sdk/lib/javafx-graphics.jar de.maggu2810.playground.gluon.HelloGluon
If I call the llc used in that command camnually and point to the "b5o.bc" file I get:
/home/maggu2810/.gluon/substrate/llc/x86_64-linux/1/llc-x86_64-linux-1 /home/maggu2810/workspace/projects/gluon/prv/gluon-mobile-test/target/client/aarch64-android/gvm/tmp/SVM-1580555647573/llvm/b5o.bc
/home/maggu2810/.gluon/substrate/llc/x86_64-linux/1/llc-x86_64-linux-1: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
llc looks for the libtinfo.so.5
file in the standard library paths on my machine and it cannot be found.
But there is a libtinfo.so.6
on my machine:
find /lib* /usr/lib* -name "libtinfo*"
/usr/lib64/libtinfo.so.6
/usr/lib64/libtinfo.so.6.1
So, let's ignore the wrong version at the moment and point 5 to 6:
sudo ln -s libtinfo.so.6 /usr/lib64/libtinfo.so.5
and build again...
Now it seems like it builds forever :wink: I will keep you informed if it fails or succeeds.
As this is a pre-build GraalVM on another machine, such so-version mismatches can be occur (AFAIK) all the time. Can't we build a static version or add this library to the GraalVM build itself?
the llc and required toolchain are part of the newer Graal distributions, but at this moment a patched llc is still required for x-compiling to iOS. Upcoming Graal distributions will probably have the required llc. This doesn't fix the lib version mismatch issue, but it is very good to know about it, so it can be tackled (either in Gluon Substrate or in GraalVM). As for compilation taking a long time: true :) But once it is compiled, it is extremely fast.
The compilation fails with "Error: Could not find option 'CustomLD'. Did you mean one of these: CustomLLC". Steps I did:
It seems the flag here is now unknown. Similar to #21.
Do I need an older NDK? (Update: tried various different NDK versions, but same problem)