Search code examples
gluon-mobilegraalvm-native-image

Gluon Mobile GraalVM iOS 14.1


Since I’ve updated Xcode to version 12.2 because of update iOS to 14.1 I’m not able to build my Gluon Mobile project. An error occurs at the end of the build process by linking. I saw that the object files. They are created but not linked.

Object file folder : .../target/client/arm64-ios/gvm/tmp/SVM-1605296582688/llvm

I’ve tried to link only and got following errors in .../GraalVMGluonSample/target/client/log :

Process
=======
link

Command Line
============
clang /Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/Hello Gluon/AppDelegate.o /Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/tmp/SVM-1605296582688/com.GraalVMgluonsample.GraalVMgluonsample.o /Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/tmp/SVM-1605296582688/llvm/llvm.o -ljava -lnio -lzip -lnet -lprefs -ljvm -lfdlibm -lz -ldl -lj2pkcs11 -lsunec -ljaas -lextnet -lstdc++ -w -fPIC -arch arm64 -mios-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk -Wl,-force_load,/Users/kojojo/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/ios-arm64/sdk/lib/libprism_es2.a -Wl,-force_load,/Users/kojojo/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/ios-arm64/sdk/lib/libglass.a -Wl,-force_load,/Users/kojojo/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/ios-arm64/sdk/lib/libjavafx_font.a -Wl,-force_load,/Users/kojojo/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/ios-arm64/sdk/lib/libprism_common.a -Wl,-force_load,/Users/kojojo/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/ios-arm64/sdk/lib/libjavafx_iio.a -lpthread -llibchelper -lffi -ldarwin -Wl,-framework,Foundation -Wl,-framework,UIKit -Wl,-framework,CoreGraphics -Wl,-framework,MobileCoreServices -Wl,-framework,OpenGLES -Wl,-framework,CoreText -Wl,-framework,QuartzCore -Wl,-framework,ImageIO -Wl,-framework,CoreBluetooth -Wl,-framework,CoreImage -Wl,-framework,CoreLocation -Wl,-framework,CoreMedia -Wl,-framework,CoreMotion -Wl,-framework,CoreVideo -Wl,-framework,Accelerate -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,MediaPlayer -Wl,-framework,UserNotifications -Wl,-framework,ARKit -Wl,-framework,AVKit -Wl,-framework,SceneKit -Wl,-framework,StoreKit -o /Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/Hello Gluon.app/Hello Gluon -L/Users/kojojo/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/ios-arm64/sdk/lib -L/opt/graalvm/lib/svm/clibraries/ios-arm64 -L/Users/kojojo/.gluon/substrate/javaStaticSdk/11-ea+1/ios-arm64/labs-staticjdk/lib/static -L/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/lib -Wl,-force_load,/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/lib/libLifecycle.a -Wl,-force_load,/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/lib/libStatusbar.a -Wl,-force_load,/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/lib/libDisplay.a -Wl,-force_load,/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/lib/libUtil.a -Wl,-force_load,/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/lib/libStorage.a

Output
======
ld: building for iOS, but linking in object file built for macOS, file '/Users/kojojo/NetBeansProjects/GraalVMGluonSample/target/client/arm64-ios/gvm/tmp/SVM-1605296582688/llvm/llvm.o'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Result
======
result: 1

I upgraded the plugin <client.plugin.version>0.1.34</client.plugin.version> and then I folowed the instruction in the error message. I installed graalvm-ce-java11-20.2.0.hotfix-xcode12.zip and changed GRAALVM_HOME but anyway I get error during build :

Process
=======
compile

Command Line
============
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.2.0.hotfix-xcode12/bin/native-image -Djdk.internal.lambda.eagerlyInitialize=false --no-server -H:+ExitAfterRe$

Output
======
env: bash: No such file or directory


Result
======
result: 127

I noticed that the structure of the graalvm-ce-java11-20.2.0.hotfix-xcode12.zip is different than a regular relaese 20.2.0. It doesn‘t contain /Contents/Home folders. Can it cause an issue?


Solution

  • There is a solution based on the hints from José Pereda:

    1. Upgrade Gluon Client Plugin in pom.xml <client.plugin.version>0.1.34</client.plugin.version>

    2. Build your project. You will get a message with the instruction to upgrade GraalVM. Download graalvm-ce-java11-20.2.0.hotfix-xcode12.zip (Link is in the message)

    3. Unpack the zip file move to /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.2.0.hotfix-xcode12

    4. Set environment variable GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.2.0.hotfix-xcode12

    5. Check if environment variable PATH contains at least  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin