Fork me on GitHub
#graalvm-mobile
<
2021-06-29
>
borkdude09:06:16

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

borkdude09:06:28

# 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

borkdude09:06:58

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

borkdude09:06:15

I don't know what to do with this:

phronmophobic15:06:42

@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 \;

phronmophobic15:06:26

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

phronmophobic15:06:55

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

borkdude15:06:18

but I could also run a simulator right?

borkdude15:06:45

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

phronmophobic15:06:47

In theory, I have not tried building for simluator

borkdude15:06:25

do you usually test on a real phone?

phronmophobic15:06:25

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

borkdude15:06:26

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 :)

phronmophobic15:06:37

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

phronmophobic15:06:05

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

borkdude15:06:38

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

borkdude15:06:44

I expect xcode nags me to upgrade macos

phronmophobic15:06:07

that sounds like something xcode might do

borkdude15:06:19

I can confirm your newest script works on my machine

🎉 2
phronmophobic15:06:35

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

phronmophobic15:06:06

That seems pretty odd

phronmophobic15:06:42

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

phronmophobic15:06:00

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

borkdude15:06:58

I can only build for ios 13.2

borkdude16:06:03

maybe that's the reason

phronmophobic16:06:44

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

borkdude16:06:47

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

phronmophobic16:06:51

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

borkdude16:06:13

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

borkdude16:06:19

when I remove the @main

phronmophobic16:06:46

Oh, right you're using a different graalvm version

borkdude16:06:18

which one were you using?

phronmophobic16:06:53

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

phronmophobic16:06:01

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

borkdude16:06:50

oh right, I haven't installed graalvm like that

borkdude16:06:04

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

borkdude16:06:09

but I can fix that

borkdude16:06:54

I'll continue another time