š
Nice.
I'm curious what you would be interesting in build as well what kind of GUI interface you would be looking for.
Responding in order:
It would be great to double check that theĀ basic mobile setupĀ 1) works , 2) is easy to follow.
Iāll try the project tonight.
It would great to get your take on what kind of GUI API you think would make sense (clj bindings for SwiftUI?, UIKit, something else?).
I think SwiftUI is the future for MacOS/iOS/iPad/iOS. I havenāt used it much (just a bit) but the model looks solid. Very close to React, but also made to do ādata syncā with classes/mutable objects.
UIKit is very low level in comparison, and a very mutable API, 90s style. Do this, do that. Mutable everything.
SwiftUI in comparison is very declarative. With caveats, from the surface, it feels like it can be a great fit for Clojure. But I donāt have enough experience with it and the interop between Swift/Clojure to say what the technical hurdles are going to be.
I'd also like to know what you think of React Native generally. One interesting strategy would be to create bindings to theĀ native sideĀ of React Native.
I like React Native. Itās very close to React, basically the same model. It can have limitations but they are mostly in performance for specific cases like animation performance, and can be worked around. There are libraries like Reanimated V2 which solve that quite well. Otherwise, RN is probably the best and most easily iterable way to build general UIs on iOS today.
SwiftUI does seem pretty functional. I haven't tried it in any real capacity though
React Native is built on top of UIKit, btw. It basically uses a āviewā like a ādivā.
Yes! It is. I have tried a few toy examples. Itās neat.
I wouldnāt say I like it more than React, but for what Swift/Obj-C is, itās definitely towards best they can have.
My sense is that's there's way more stuff built on top of UIKit. The other benefit is that objective-c seems more dynamically malleable compared to swift. It seems like it would be possible to implement interop on of obc_msgsend similar to how java interop works
However, I don't think that's the main consideration
Yes, there definitely is. But I think things should be moving towards the SwiftUI direction.
Obj-C definitely very dynamic. Whatās your sense about interop between Clojure and Swift? Would it be possible?
I'm sure it's possible
worst case scenario is that you use the reference api to generate the interface on both the clojure and swift sides
Cool. Iāve been doing a bit of Swift over the last 2 weeks. Definitely not an expert, but learning things. (I needed a custom camera solution and access to the raw frames of the camera, and re-made a component that interfaces with RN to do that)
https://developer.apple.com/tutorials/data/documentation/technologies.json?language=swift
If you get the compiler to be happy, Swift aināt that bad. But thatās a big if š.
I am still wrapping my head around the rules about initializations in Swift structs. As long as I stick to (mostly) static classes and static vars, things are much āeasierā and āfamiliarā, sort of Java-static style.
Iāll try the project and report here.
:thumbsup:
Going through the GraalVM setup. Should I be using Java 11 or Java 16, any difference?
Iāll try with Java 11 to start.
my setup was java 11
ideally, it shouldn't matter, but I haven't tried Java 16
Alright, not gonna go crazy to start, Java 11 it is š
Ok, got GraalVM installed, I believe. Perhaps adding a link to this issue can be helpful to somebody https://stackoverflow.com/questions/65786439/problem-with-installing-running-grallvm-on-mac
Or just a note about MacOS:
xattr -d com.apple.quarantine <PATH TO GRAALVM INSTALLATION>
good call. it's been so long that I forgot
For sure, itās a one-time pain.
trying to figure out the best place to put the link
it's on the release page: https://github.com/graalvm/graalvm-ce-builds/releases
but after all the links
Ah
I guess I didnāt scroll that far. I was going through this page at the moment: https://github.com/BrunoBonacci/graalvm-clojure/blob/master/doc/clojure-graalvm-native-binary.md
Omg, itās there also š
I am just impatient and donāt read things till the end š
to be fair, Mac OSX has been getting less developer friendly over the years
Yeah. Because security.
Ok, Iām running
./scripts/compile-shared
I get this:
./scripts/compile-shared: line 20: /bin/native-image: No such file or directory
do you have your graalvm home set?
rather GRAALVM_HOME
Ah, 1 sec.
I was trying to make it work via jenv
but I guess I need the GRAALVM_HOME
the compile script references GRAALVM_HOME
Right, I see it. No problem.
not sure what might be a better alternative
it's looking for graalvm's native-image
Compiling now.
Taking its time, assume thatās expected.
yup, it takes some time
Oh wow, went to make some food, this is still going š
Maybe somethingās wrong?
Output so far:
raspasov@MBP mobiletest % ./scripts/compile-sharedĀ Ā Ā Ā
+ set -e
+++ dirname ./scripts/compile-shared
++ cd ./scripts
++ pwd
+ DIR=/Users/raspasov/projects/github/mobiletest/scripts
+ cd /Users/raspasov/projects/github/mobiletest/scripts
+ PROJECT_DIR=/Users/raspasov/projects/github/mobiletest/scripts/..
+ cd ..
+ rm -rf ./classes
+ mkdir classes
+ clojure -X com.phronmophobic.mobiletest/compile-interface-class
+ clojure -X:depstar
[main] INFO hf.depstar.uberjar - Synchronizing pom.xml
Skipping paths: classes generated_classes native_test
[main] INFO hf.depstar.uberjar - Compiling com.phronmophobic.mobiletest ...
[main] INFO hf.depstar.uberjar - Compiling com.phronmophobic.mobiletest ...
[main] INFO hf.depstar.uberjar - Building uber jar: target/mobiletest-uber.jar
{:warning "could not find classpath entry", :path "generated_classes"}
{:warning "could not find classpath entry", :path "native_test"}
[main] INFO hf.depstar.uberjar - Processing pom.xml for {com.phronmophobic/mobiletest {:mvn/version "1.00-beta-1"}}
+ pushd library
~/projects/github/mobiletest/library ~/projects/github/mobiletest
+ /Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/bin/native-image --report-unsupported-elements-at-runtime --initialize-at-build-time --no-fallback --no-server -H:CompilerBackend=llvm -H:+ExitAfterRelocatableImageWrite -H:+SharedLibrary -H:+AddAllCharsets -H:+ReportExceptionStackTraces -H:-DeadlockWatchdogExitOnTimeout -H:DeadlockWatchdogInterval=0 -H:+RemoveSaturatedTypeFlows -H:-SpawnIsolates -H:PageSize=16384 -Djdk.internal.lambda.eagerlyInitialize=false -H:+ReportExceptionStackTraces -H:TempDirectory=/Users/raspasov/projects/github/mobiletest/scripts/../library/tmp -H:ReflectionConfigurationFiles=/Users/raspasov/projects/github/mobiletest/scripts/../conf/reflectionconfig-arm64-ios.json -H:JNIConfigurationFiles=/Users/raspasov/projects/github/mobiletest/scripts/../conf/jniconfig-arm64-ios.json -H:ResourceConfigurationFiles=/Users/raspasov/projects/github/mobiletest/scripts/../conf/resourceconfig-arm64-ios.json -J-Dclojure.spec.skip-macros=true -J-Xmx20G -J-XX:MaxDirectMemorySize=8G -J-Dclojure.compiler.direct-linking=true -J-Dtech.v3.datatype.graal-native=true -Dsvm.targetName=iOS -Dsvm.targetArch=arm64 -H:+UseCAPCache -H:CAPCacheDir=/Users/raspasov/projects/github/mobiletest/scripts/../conf/capcache '-Dsvm.platform=org.graalvm.nativeimage.Platform$IOS_AARCH64' -jar ../target/mobiletest-uber.jar -cp classes
[mobiletest-uber:8653]Ā Ā classlist: Ā 2,728.25 ms,Ā 0.94 GB
[mobiletest-uber:8653]Ā Ā Ā Ā (cap): Ā Ā 171.45 ms,Ā 0.94 GB
[mobiletest-uber:8653]Ā Ā Ā Ā setup: Ā 1,727.14 ms,Ā 0.94 GB
Keep waiting?
I'm a little surprised it's taking this long, but it's not completely crazy
especially if compiling the uberjar for the first time needed to download dependencies
Yeah it is weirdā¦ I am on a relatively recent MBP 2018, 2.9 GHz 6-Core Intel Core i9 (not sure if this makes a big difference in compilation)
Still waiting.
I have seen it get stuck on setup before and killing and restarting can help
Ok, Iāll try that then?
:thumbsup:
Restarted.
There a couple of warnings, {:warning ācould not find classpath entryā, :path āgenerated_classesā} {:warning ācould not find classpath entryā, :path ānative_testā} Do they matter?
It shouldn't. I'm just realizing those entries are from the avclj project that I based the initial project on
Ok, still waiting at the same spot now.
Random feedback for the README, perhaps add right before ./scripts/compile-shared
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-VERSION/Contents/Home
export PATH=$GRAALVM_HOME/bin:$PATH
(assuming MacOS)Hmm something looks very stuck, not sure whyā¦
(based on Activity Monitor, it doesnāt seem itās doing much CPU or network)
that does seem suspicous
i'm running it on my computer and all the activity seems to be showing up under java rather than "native-image"
Ok, let me seeā¦
weird. I'm running it now on my computer and it's taking forever
You said it needs to download something?
I don't remember it taking this long before
Maybe thereās a way to manually download it? Perhaps some server is down?
native image shouldn't be downloading anything
only to make the uberjar, which it looks like you've completed
Yes, the jar is there under /target
34.6MB mobiletest-uber.jar
now it's not working on my computer š. I swear this was all working earlier
I believe you. Hmm.
Gets stuck at the same spot?
ohh
I think I know the issue on my computer
I forgot to switch my JAVA_HOME to point to graalvm
if you do which java
, does it print the java in graalvm?
I think I didnāt put the $JAVA_HOME :
raspasov@MBP mobiletest % echo $JAVA_HOME raspasov@MBP mobiletest % which javaĀ /Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/bin/java
JAVA_HOME is empty but the java is correct
Iāll try to set JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home
Running againā¦Seems to be stuck same spotā¦
ok, looking back at my setup. My JAVA_HOME wasn't set, but I was using a different the first time around
I would try deleting the library/classes
directory
and trying again
Ok! Trying.
it did compile for me this time in 213,763.55 ms
aka ~3.5 minutes
Progress: Warning: RecomputeFieldValue.FieldOffset automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.objectFieldOffset(Field) was detected in the static initializer of tech.v3.datatype.UnsafeUtil. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Field) for the field offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.
nice!
that's actually a good sign
I've noticed that when it prints that, it's past the part where it gets stuck sometimes
Ok, error, but a bunch of output:
dang
raspasov@MBP mobiletest % ./scripts/compile-shared
+ set -e
+++ dirname ./scripts/compile-shared
++ cd ./scripts
++ pwd
+ DIR=/Users/raspasov/projects/github/mobiletest/scripts
+ cd /Users/raspasov/projects/github/mobiletest/scripts
+ PROJECT_DIR=/Users/raspasov/projects/github/mobiletest/scripts/..
+ cd ..
+ rm -rf ./classes
+ mkdir classes
+ clojure -X com.phronmophobic.mobiletest/compile-interface-class
+ clojure -X:depstar
[main] INFO hf.depstar.uberjar - Synchronizing pom.xml
Skipping paths: classes generated_classes native_test
[main] INFO hf.depstar.uberjar - Compiling com.phronmophobic.mobiletest ...
[main] INFO hf.depstar.uberjar - Compiling com.phronmophobic.mobiletest ...
[main] INFO hf.depstar.uberjar - Building uber jar: target/mobiletest-uber.jar
{:warning "could not find classpath entry", :path "generated_classes"}
{:warning "could not find classpath entry", :path "native_test"}
[main] INFO hf.depstar.uberjar - Processing pom.xml for {com.phronmophobic/mobiletest {:mvn/version "1.00-beta-1"}}
+ pushd library
~/projects/github/mobiletest/library ~/projects/github/mobiletest
+ /Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/bin/native-image --report-unsupported-elements-at-runtime --initialize-at-build-time --no-fallback --no-server -H:CompilerBackend=llvm -H:+ExitAfterRelocatableImageWrite -H:+SharedLibrary -H:+AddAllCharsets -H:+ReportExceptionStackTraces -H:-DeadlockWatchdogExitOnTimeout -H:DeadlockWatchdogInterval=0 -H:+RemoveSaturatedTypeFlows -H:-SpawnIsolates -H:PageSize=16384 -Djdk.internal.lambda.eagerlyInitialize=false -H:+ReportExceptionStackTraces -H:TempDirectory=/Users/raspasov/projects/github/mobiletest/scripts/../library/tmp -H:ReflectionConfigurationFiles=/Users/raspasov/projects/github/mobiletest/scripts/../conf/reflectionconfig-arm64-ios.json -H:JNIConfigurationFiles=/Users/raspasov/projects/github/mobiletest/scripts/../conf/jniconfig-arm64-ios.json -H:ResourceConfigurationFiles=/Users/raspasov/projects/github/mobiletest/scripts/../conf/resourceconfig-arm64-ios.json -J-Dclojure.spec.skip-macros=true -J-Xmx20G -J-XX:MaxDirectMemorySize=8G -J-Dclojure.compiler.direct-linking=true -J-Dtech.v3.datatype.graal-native=true -Dsvm.targetName=iOS -Dsvm.targetArch=arm64 -H:+UseCAPCache -H:CAPCacheDir=/Users/raspasov/projects/github/mobiletest/scripts/../conf/capcache '-Dsvm.platform=org.graalvm.nativeimage.Platform$IOS_AARCH64' -jar ../target/mobiletest-uber.jar -cp classes
[mobiletest-uber:10698]Ā Ā classlist: Ā 2,932.32 ms,Ā 0.95 GB
[mobiletest-uber:10698]Ā Ā Ā Ā (cap): Ā Ā 191.21 ms,Ā 0.95 GB
[mobiletest-uber:10698]Ā Ā Ā Ā setup: Ā 1,622.68 ms,Ā 0.95 GB
Warning: RecomputeFieldValue.FieldOffset automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.objectFieldOffset(Field) was detected in the static initializer of tech.v3.datatype.UnsafeUtil. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Field) for the field offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.Ā
[mobiletest-uber:10698] Ā Ā (clinit): Ā Ā 362.14 ms,Ā 2.69 GB
[mobiletest-uber:10698] Ā (typeflow): Ā 9,919.26 ms,Ā 2.69 GB
[mobiletest-uber:10698]Ā Ā (objects):Ā 10,759.01 ms,Ā 2.69 GB
[mobiletest-uber:10698] Ā (features): Ā 1,717.75 ms,Ā 2.69 GB
[mobiletest-uber:10698] Ā Ā analysis:Ā 23,893.47 ms,Ā 2.69 GB
[mobiletest-uber:10698] Ā Ā universe: Ā Ā 994.07 ms,Ā 3.86 GB
[mobiletest-uber:10698]Ā Ā Ā (parse): Ā 1,572.44 ms,Ā 3.86 GB
[mobiletest-uber:10698] Ā Ā (inline): Ā 5,622.28 ms,Ā 4.49 GB
[mobiletest-uber:10698]Ā Ā (compile): Ā 1,329.01 ms,Ā 4.49 GB
[mobiletest-uber:10698]Ā Ā Ā compile: Ā 8,696.35 ms,Ā 4.49 GB
7 fatal errors detected:
Fatal error:org.graalvm.compiler.graph.GraalGraphError: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at node: 6|Conditional { stamp=i32 [0 - 1] ā0000000000000001,Ā }
at method: void com.oracle.svm.core.graal.snippets.StackOverflowCheckSnippets.throwCachedStackOverflowError()Ā [Direct call from void FunctionPointerLogHandler.fatalError()]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Fatal error:org.graalvm.compiler.graph.GraalGraphError: com.oracle.svm.core.util.UserError$UserException: Using the LLVM backend requires LLVM to be installed on your machine.
at node: 61|Conditional { stamp=i32 [0 - 1] ā0000000000000001,Ā }
at method: void com.oracle.svm.core.thread.VMThreads.detachThread(IsolateThread)Ā [Direct call from int CEntryPointSnippets.detachThreadMT(IsolateThread)]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: com.oracle.svm.core.util.UserError$UserException: Using the LLVM backend requires LLVM to be installed on your machine.
at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
at com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker.getLLVMVersion(LLVMFeature.java:149)
at com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker.<clinit>(LLVMFeature.java:135)
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Fatal error:org.graalvm.compiler.graph.GraalGraphError: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at node: 119|Conditional { stamp=i32 [-1 - 2] ā0000000000000002,Ā }
at method: int com.oracle.svm.core.graal.snippets.CEntryPointSnippets.initializeIsolate(CEntryPointCreateIsolateParameters)Ā [Direct call from int CEntryPointNativeFunctions.createIsolate(CEntryPointCreateIsolateParameters, CEntryPointNativeFunctions$IsolatePointer, CEntryPointNativeFunctions$IsolateThreadPointer)]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Fatal error:org.graalvm.compiler.graph.GraalGraphError: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at node: 5|Conditional { stamp=i32 [0 - 1] ā0000000000000001,Ā }
at method: void com.oracle.svm.core.graal.snippets.StackOverflowCheckSnippets.throwNewStackOverflowError()Ā [Direct call from void CEntryPointSnippets.ensureJavaThread()]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Fatal error:org.graalvm.compiler.graph.GraalGraphError: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at node: 167|Conditional { stamp=i32 [0 - 1] ā0000000000000001,Ā }
at method: JNIObjectHandle com.oracle.svm.jni.functions.JNIFunctions.AllocObject(JNIEnvironment, JNIObjectHandle)Ā [Direct call from JNIObjectHandle IsolateEnterStub.JNIFunctions_AllocObject_fd679b648ff7a5bbe75e2b56d7c12125e4e73817(JNIEnvironment, JNIObjectHandle)]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Fatal error:org.graalvm.compiler.graph.GraalGraphError: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at node: 34|Conditional { stamp=i32 [0 - 1] ā0000000000000001,Ā }
at method: void com.oracle.svm.core.thread.Safepoint.enterSlowPathSafepointCheck()Ā [Direct call from void CEntryPointSnippets.ensureJavaThread()]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Fatal error:org.graalvm.compiler.graph.GraalGraphError: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at node: 42|Conditional { stamp=i32 [0 - 1] ā0000000000000001,Ā }
at method: void com.oracle.svm.core.thread.Safepoint.enterSlowPathTransitionFromNativeToNewStatus(int)Ā [Direct call from IsolateThread IsolateEnterStub.CEntryPointBuiltins_createIsolate_315bd7239ea2b5ed6515910416de2648c30349ea()]
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:291)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.generate(SubstrateLLVMBackend.java:147)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitLLVM(SubstrateLLVMBackend.java:123)
at com.oracle.svm.core.graal.llvm.SubstrateLLVMBackend.emitBackEnd(SubstrateLLVMBackend.java:103)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compile(GraalCompiler.java:146)
at jdk.internal.vm.compiler/org.graalvm.compiler.core.GraalCompiler.compileGraph(GraalCompiler.java:130)
at com.oracle.svm.hosted.code.CompileQueue.defaultCompileFunction(CompileQueue.java:998)
at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:960)
at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:265)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:183)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.svm.core.graal.llvm.LLVMFeature$LLVMVersionChecker
at com.oracle.svm.core.graal.llvm.LLVMGenerator.emitConditionalMove(LLVMGenerator.java:646)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitConditional(NodeLLVMBuilder.java:395)
at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.calc.ConditionalNode.generate(ConditionalNode.java:297)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.emitNode(NodeLLVMBuilder.java:327)
at com.oracle.svm.core.graal.llvm.NodeLLVMBuilder.doBlock(NodeLLVMBuilder.java:287)
... 15 more
Error: Image build request failed with exit status 1
Does not like something about LLVM.
yea
that's a new error to me
oh
I think I might know what it is. one sec
from https://www.graalvm.org/reference-manual/native-image/LLVMBackend/
gu install llvm-toolchain
that should definitely be in the Readme somewhere
Trying that command.
Is it a good idea to be nuking the /library folder every time?
probably
Ok!
that's probably worth putting in the script
Yes, canāt hurt.
Hmm it seems to be getting stuck again at that previous spot. Unpredictable.
I guess if it gets stuck before the Warning: RecomputeFieldValue.FieldOffset
, then it's worth restarting
Yesā¦
So weird why it would do that. Have you seen that before?
yea. I have noticed it getting stuck there before
š
Ok, restarting once without nuking /library made it go forward.
(thatās a guess as to the cause)
interesting
Perhaps you need to run it once, and then one more time.
I thought I noticed happening less often, but I could never tell if it was just random or not
Seems to be going through the steps.
[mobiletest-uber:11153]Ā Ā classlist: Ā 2,731.31 ms,Ā 1.20 GB
[mobiletest-uber:11153]Ā Ā Ā Ā (cap): Ā Ā 232.85 ms,Ā 1.20 GB
[mobiletest-uber:11153]Ā Ā Ā Ā setup: Ā 1,997.64 ms,Ā 1.20 GB
Warning: RecomputeFieldValue.FieldOffset automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.objectFieldOffset(Field) was detected in the static initializer of tech.v3.datatype.UnsafeUtil. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Field) for the field offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.Ā
[mobiletest-uber:11153] Ā Ā (clinit): Ā Ā 394.12 ms,Ā 4.66 GB
[mobiletest-uber:11153] Ā (typeflow): Ā 9,692.06 ms,Ā 4.66 GB
[mobiletest-uber:11153]Ā Ā (objects):Ā 11,286.21 ms,Ā 4.66 GB
[mobiletest-uber:11153] Ā (features): Ā 1,601.63 ms,Ā 4.66 GB
[mobiletest-uber:11153] Ā Ā analysis:Ā 24,224.42 ms,Ā 4.66 GB
[mobiletest-uber:11153] Ā Ā universe: Ā 1,081.17 ms,Ā 4.66 GB
[mobiletest-uber:11153]Ā Ā Ā (parse): Ā 2,090.61 ms,Ā 4.66 GB
[mobiletest-uber:11153] Ā Ā (inline): Ā 3,401.28 ms,Ā 4.66 GB
[mobiletest-uber:11153]Ā Ā (compile):Ā 21,491.40 ms,Ā 7.37 GB
[mobiletest-uber:11153]Ā Ā (bitcode): Ā 1,810.94 ms,Ā 7.37 GB
[mobiletest-uber:11153]Ā Ā (prelink): Ā 4,937.09 ms,Ā 7.37 GB
I think it completed well:
# Printing build artifacts to: mobiletest-uber.build_artifacts.txt
[mobiletest-uber:11153]Ā Ā Ā [total]: 136,380.22 ms,Ā 7.61 GB
+ rm -rf ./build/out
+ mkdir -p build/out
++ find . -name llvm.o -print0
++ xargs -r -0 ls -1 -t
++ head -1
+ LLVM_PATH=./tmp/SVM-1623922437105/llvm/llvm.o
+ cp ./tmp/SVM-1623922437105/llvm/llvm.o build/out
++ find . -name mobiletest-uber.o -print0
++ xargs -r -0 ls -1 -t
++ head -1
+ MOBILETEST_PATH=./tmp/SVM-1623922437105/mobiletest-uber.o
+ cp ./tmp/SVM-1623922437105/mobiletest-uber.o build/out
+ popd
~/projects/github/mobiletest
š
yep
Ok, XCode next?
XCode error:
ld: warning: directory not found for option '-L/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/lib/svm/clibraries/ios-arm64'
ld: library not found for -ljvm
interesting
Something about the paths
MacBook-Air:mobiletest adrian$ ls '/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/lib/svm/clibraries/ios-arm64'
clibraries-ios-arm64.md5 libffi.a liblibchelper.a
libdarwin.a libjvm.a libstrictmath.a
I am missing the āios-arm64ā directory
raspasov@MBP ~ % ls '/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/lib/svm/clibraries/ios-arm64'
ls: /Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/lib/svm/clibraries/ios-arm64: No such file or directory
raspasov@MBP ~ %
Perhaps need to install something?
is that the right graalvm path?
Yesā¦
raspasov@MBP ~ % ls /Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/lib/svm/clibraries/
darwin-amd64
^^ path exists up to āclibrariesā
ok
let's see if I can figure out how I got those clibraries
MacBook-Air:mobiletest adrian$ cd '/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.1.0/Contents/Home/lib/svm/'
MacBook-Air:svm adrian$ ls
LICENSE_NATIVEIMAGE.txt builder clibraries.zip macros
bin clibraries library-support.jar
MacBook-Air:svm adrian$ ls -lt
total 320
drwxr-xr-x 4 adrian staff 128 Jun 5 23:18 clibraries
-rw-r--r-- 1 adrian staff 75393 Jun 5 23:18 clibraries.zip
drwxr-xr-x 16 adrian staff 512 May 9 23:30 macros
drwxr-xr-x 4 adrian staff 128 May 9 23:30 bin
-rw-r--r-- 1 adrian staff 21035 May 9 23:30 LICENSE_NATIVEIMAGE.txt
drwxr-xr-x 11 adrian staff 352 May 9 23:23 builder
-rw-r--r-- 1 adrian staff 59506 Apr 16 04:41 library-support.jar
Btw, are you on Intel or Arm mac?
I'm on Arm/M1
(not sure if that makes a difference)
it looks like I got that clibraries on June 5th
before trying with clojure
I tried Gluon Mobile
and it looks like their maven plugin modified my setup
Iāve seen the Gluon Mobile, what is it exactly?
And how does it relate to GraalVM?
They don't make it easy to decipher, but I think it's an implementation of JavaFX and some other stuff that runs iOS/android
Does it use GraalVM under the hood?
it does
I've tried to exclude any proprietary stuff
Got it, so a wrapper on top of GraalVM to help run some Java stuff.
specifically the javaFX libraries I think
ā¦ to help run JavaFX on mobile.
they have included some updates to the JVM implementation for mobile as well
(never used javaFX myself)
but most of those changes are released under GPL
I think
they're integrating those back in to the regular JVM repo afaik
Got it; alright Iāll google around as well about the missing āios-arm64ā directory.
You think you got it through Gluon Mobile or unsure?
anyway, the clibs can be downloaded from https://download2.gluonhq.com/substrate/clibs/ios-arm64.zip
Aha!
I referenced their maven plugin to figure out how to compile for iOS
Aaaand weāre liveā¦ āHello, world!ā
whoo!
did it print anything to console?
āhello42ā 2021-06-17 02:55:22.904126-0700 MobileTest[12654:4364688] the result is: 42 2021-06-17 02:55:22.904233-0700 MobileTest[12654:4364688] the result is: 42
š
š„
so you have clojure running on your device now
Very nice! Thank you! š
now I just need to go back through the chat and improve the docs
Looking at the project, which Clojure code is being executed?
oh, I haven't pushed my changes that starts the nrepl socket server
https://github.com/phronmophobic/mobiletest/blob/main/src/com/phronmophobic/mobiletest.clj
NSLog("the result is: %d",result2);
(because I see this is printed from Swift)
which is called from https://github.com/phronmophobic/mobiletest/blob/main/xcode/MobileTest/MobileTest/AppDelegate.swift#L17
Wow, ok.
Eval? String?
For real? š That works??
On iOS?
Is it expected to work like that?
call_eval
calls into https://github.com/phronmophobic/mobiletest/blob/main/xcode/MobileTest/csource/Bridge.c#L63 which calls into clj_eval
in the clojure file
yea, I was surprised too. Thanks to the magic of sci
So is this like ā¦compiled Clojure or interpreted?
the eval is interpreted by sci
but sci is compiled to native
This is totally wild š
So do we get full Clojure here or Sci? (sorry, I am not very familiar with sci, need to learn more)
https://github.com/borkdude/sci you get sci, but you can hook it up to whatever Clojure library you want
Should be fun for making a 4clojure app in ios or so
right. the union of whatever is graalvm compatible or can be executed by sci
or exposing the nrepl server to do whatever from a distance
like, making a picture when you tell it to? dunno ;)
That is totally wild I gotta say š Is there a big performance penalty, do you expect to be able to just code a full app with this at this point?
not totally sure, but I think so. phones are pretty powerful these days
@raspasov if you are familiar with babashka, it's the same interpreter. performance is pretty good for say, replacing bash scripts
you can try this "full stack app" in babashka + scittle (the CLJS version of sci): https://github.com/kloimhardt/babashka-scittle-guestbook
Got it, cool š
The thing where it becomes noticeably slower is when you have a loop with 1M iterations. In sci this can take 500ms whereas in Clojure it's only 20ms for example, because Clojure emits direct bytecode.
@smith.adriane what about that demo where you had some UI, was this using the same method?
But note that the functions you can hook into sci can be natively compiled, so you only pay the performance penalty for the "glue" code
@borkdude understood; That much looping is actually rare in a mobile app; so for some UI dev work definitely useable, I assume.
more or less. I also linked in a graphics library called skia. I have a cross platform UI library that can draw render using skia.
not sure itās ready for general use, but youāre welcome to try
So you can actually get a REPL running in this? So actually do dev work, like change the UI, etc? Youād need some way to constantly serve the updated code, ala figwheel-main, shadow-cljs etc I assume.
babashka has a nrepl compatible server
I use emacs/cider, so it "just worked" for me
That should be no problem then, yes.
to do actual dev work, it depends what is evaluated at runtime and what is baked statically into the binary
@borkdude thatās a good pointā¦ Wonder if thereās gonna be a difference there between UIKit and SwiftUI
UIKit/Objective-C is very dynamic, I think you can do almost anything at runtime.
Not sure about SwiftUI though.
I lack enough knowledge about the Objective-C runtime/Swift itself to say with 100% certainty.
But definitely very cool, wide open possibilities š
just pushed my changes that start an nrepl server
@smith.adriane Do you have an end goal with this experiment, or itās just an exploration? I think if you can actually code native UIās through Clojure, that can serve a niche, even if small.
Ok, Iāll pull.
How do you guys deploy the app to your phone? I have 0 experience with mobile, but I do have an iPhone :)
XCode, you need a dev account (I think?)
eventually, I'd like to replace html/css/javascript with pure clojure, but no specific timeline š
I forget if you need a dev account to run on the phone.
$99 a yearā¦ But you can definitely run on simulator without an account.
I think you're supposed to be able to run apps on your phone with a free account, but there's a 10 day expiration after each deploy
if I recall correctly
Ah, got itā¦ @borkdude it comes down to knowing where to click inside of XCode, and itās confusing š
Gotta select a teamā¦
And thatās about it, it should be able to run at this point, assuming no build errors.
(Selecting Team applies the correct certificate)
ok, I might try it in the weekend
what's the link of the repo again?
iOS simulator is pretty good, so you wonāt get much out of the phone per-se. Unless you need to access camera, and some APIs which are not available on the simulator. For most UI work, the simulator is 99% accurate (performance aside, that can be misleading).
I'll try to update the docs by this weekend based on this chat
cool, I'll try the simulator as well. but for me it's not real unless I can tell others to download the app and install it :)
Haha for sure. Submitting the app is a whole another can of worms.
There is a side-loading thing for iOS right?
I haven't tried to compile for the simulator yet. I assume there's some script changes necessary
TestFlight, yes. Thatās easier to setup.
@smith.adriane let me try, should be the same
Except for IP changes, Simulator is pretty much identical on iOS/XCode. Itās one of the few good things about Xcode š
Ha! Actuallyā¦ error
yea, I think the architecture is different
Ok, that is strange now. I just pulled the changesā¦ maybe that changed something.
how long does compilation take on your machines? it seems it's stuck at the setup step on mine
I just managed to compile it 30 min ago, but now I get this error.
Strange.
I mean the shared lib
@borkdude yesā¦ We went through those problems in the chatā¦.
Youāre referring to
$ ./scripts/compile-shared
you'll have to recompile the shared library
?
yes
I am just compiling the shared library
the repo adds a new shared library function
this is what I was referring to, it's not working for me
well, it takes longer than I would expect, let's say
Ahā¦ Gotta recompile!
Got it
Yesā¦ try restarting the compilation.
Or nuking ālibraryā folderā¦ It was not very clear what was the cause of that issue.
it seems like a deadlock, which could be related to native library loading
Yeah it was strange.
This comment might be helpful: https://github.com/oracle/graal/issues/3251#issuecomment-842820130
Pressing ctrl-\ dumps a thread dump
I don't think the current repo is loading any native libraries.
@smith.adriane FWIW, killing it right now and starting again without nuking ālibraryā made it continue for meā¦
at least, not directly from clojure
(compiling again with the new changes)
yea, that seems like a promising thread to pull
maybe it's as simple as creating all the necessary directories?
like ./library/tmp
Got an error: Fatal error:org.graalvm.compiler.debug.GraalError: LLVM linking failed into batch 8 (f8000-f9000). Use -H:LLVMMaxFunctionsPerBatch=1 to compile each method individually. (/Users/raspasov/projects/github/mobiletest/scripts/../library/tmp/SVM-1623926169792/llvm/b8.bc): 1
trying with the newest dev build... https://github.com/graalvm/graalvm-ce-dev-builds/releases/tag/21.2.0-dev-20210616_2034
I've seen that error, but I thought it was usually when I compile with the wrong jvm
maybe it's something different or some cache error
raspasov@MBP mobiletest % java --version Ā Ā Ā Ā Ā openjdk 11.0.11 2021-04-20 OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing)
It should be correct.
Ok let me try deleting.
It has a suggestion:
-H:LLVMMaxFunctionsPerBatch=1
same problem
I'll check back later, exciting stuff
I've tried that before, but it never seems to help
Ok, good to know.
however, I've been using quite a bit of guess and check without 100% understanding what every flag does, so any improvements or experimentation are welcome
Yeahā¦ This is getting stuck again for me. Perhaps youāre seeing it less often because youāre on M1, and if it is a deadlock like borkdude was suggesting, it could be behaving differently on different CPUs.
Yeah, unfortunately this is getting stuck for me as well, and not able to compile anymore š
Iāll check back later as well, chat soon.
btw, you can always make an issue at oracle/graal about the (seemingly) deadlock thing, as long as you provide clear build instructions (which you already have in the repo)
maybe make a branch (to keep a reference for the issue)