graalvm-mobile 2021-06-29

@smith.adriane I got compilation working locally now, except the last part of the compile-shared script didn't work for me

# Printing build artifacts to: mobiletest-uber.build_artifacts.txt
[mobiletest-uber:80025]      [total]: 178,607.13 ms,  8.18 GB
+ rm -rf ./build/out
+ mkdir -p build/out
++ find . -name llvm.o -print0
++ xargs -r -0 ls -1 -t
++ head -1
xargs: illegal option -- r
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]
+ LLVM_PATH=
+ cp '' build/out
cp: : No such file or directory

Also, after opening the project in xcode, what should I do to run it?

I don't know what to do with this:

@borkdude, I updated the script to not use xargs. The graalvm llvm backend produces *.o object files that need to get copied over. you can probably just run the last bit of the script instead of recompiling everything

cd library
find ./tmp -name 'llvm.o' -exec cp {} build/out \;
find ./tmp -name 'mobiletest-uber.o' -exec cp {} build/out \;

You can press ⌘b to build without deploying. Hopefully no errors appear.

After that, you'll need to connect a device to deploy. I don't remember the exact steps it takes to set up a new device. It's something along the lines of: • Connect a device with USB • Select trust device on your phone • I think it prompts you for more steps when you try to deploy Check to make sure you have an Apple account connected: 1. Click on the MobileTest Project from the Project navigator in the left pane 2. Click on the MobileTest Target 3. Click on Signing and Capabilities

but I could also run a simulator right?

I think macOS would force me to upgrade macOS to upload to my phone. It's a trick I've stumbled upon before

In theory, I have not tried building for simluator

do you usually test on a real phone?

In general, I use the simulator to test, but I just wanted to see if I could get it working on my phone

so how do I run on a simulator? I mean "choose a simulated device", I didn't know how to do this, this is why I posted the message. Sorry that I wasn't clear :)

oh, right. It's a different target and architecture for native image, so I think it's just a matter of passing the right native-image flags

oh, and you have to link against some java native libraries in xcode, so you would need those too

ok, I'm going to try it your way first

I expect xcode nags me to upgrade macos

that sounds like something xcode might do

I can confirm your newest script works on my machine

🎉 1

Ok, it's unclear whether iOS simulator is supported by graalvm currently, https://github.com/oracle/graal/pull/3340

That seems pretty odd

That @main statement is on the same line in my AppDelegate.swift file

and it's just part of the boilerplate code generated from a new project

I can only build for ios 13.2

maybe that's the reason

ah, ok

I tried setting the deployment target to 13.2 and it still built

I will retry when I upgrade my OS but I only tend to do this when I have a new laptop ;)

Not sure my Xcode navigation is optimal, but that's how I navigate to that setting

Same error?

I also get #include <jni.h> not found

when I remove the @main

Oh, right you're using a different graalvm version

which one were you using?

21.1.0

nvmd

If you search graalvm, in the build settings, it should show the Header Search Paths

One is /Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/include/darwin/

oh right, I haven't installed graalvm like that

I usually just download it in my Downloads folder and set the environment manually

but I can fix that

I'll continue another time