@smith.adriane trying to build grease and I'm getting this error. I've tried to update the jni-config to include the namespace, but that didn't really do anything:
Undefined symbols for architecture arm64:
"_JNI_OnLoad_sunec", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_io_ObjectInputStream_bytesToDoubles", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_io_ObjectInputStream_bytesToFloats", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_bind0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_connect0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_dataAvailable", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_datagramSocketClose", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_disconnect0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_init", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_peek", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_peekData", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_receive0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_send0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_socketGetOption", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainDatagramSocketImpl_socketSetOption0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_initProto", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketAccept", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketAvailable", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketBind", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketClose0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketConnect", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketCreate", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketGetOption", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketListen", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketSendUrgentData", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketSetOption0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_PlainSocketImpl_socketShutdown", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_SocketCleanable_cleanupClose0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_SocketInputStream_init", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_SocketInputStream_socketRead0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_SocketOutputStream_init", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_net_SocketOutputStream_socketWrite0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_nio_MappedByteBuffer_force0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_nio_MappedByteBuffer_isLoaded0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_java_nio_MappedByteBuffer_load0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_net_dns_ResolverConfigurationImpl_localDomain0", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_nio_ch_DatagramChannelImpl_initIDs", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_security_ec_ECDHKeyAgreement_deriveKey", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_security_ec_ECDSASignature_signDigest", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_security_ec_ECDSASignature_verifySignedDigest", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair", referenced from:
___svm_cglobaldata_base in bb.o
"_Java_sun_security_ec_ECKeyPairGenerator_isCurveSupported", referenced from:
___svm_cglobaldata_base in bb.o
ld: symbol(s) not found for architecture arm64Happy to read about your progress/experiments @rjsheperd 🙂
I got JDK 21 for iOS to build using this: https://github.com/utopia-rise/ios-graal-jdk-21 with some patches from https://github.com/openjdk/jdk17u-dev/tree/master (had to update libpng and the libjsound native CPP files for MacOSX) However, I think I need to add some modules to the ios-graal-jdk-21 builder to enable https://github.com/oracle/graal/tree/master/substratevm/src/com.oracle.svm.native.libchelper. Unless there's another way to get that?
I feel like I'm getting closer. I've managed to get liblibchelper.a built using the same Graal JVM that I used to build with the ios-graal-jdk-21 repo. Have to run to an appointment, but hoping I can get it all pulled together 🤞
Awesome! If you get it to work, it would be great to update the grease documentation. I can also update the github action which is a nice way to make sure that the process is reproducible.
Do you think it's worth having JDK 21 and JDK 17?
I was also thinking this could be a way to build for JDK 25: https://github.com/openjdk/mobile
I don't think it's worth trying to support JDK 21 and 17.
Does the openjdk/mobile project work?
¯\(ツ)/¯
Also, I targeted the minimum iOS version that I could since I don't have an earlier version of XCode (iOS 16), but I think you could potentially support earlier versions of iOS
That's maybe something that possible using a github action.
Sorry if this is the wrong place to debug this! I'm about to push up my fork here: http://github.com/rjsheperd/grease
I was hoping support for this use case would improve over time, but it seems like there's been a lot of bitrot instead.
If someone can get this working again, that would be great.
I believe the link from the static dependencies from gluon are broken. Did you download them from somewhere else?
What version of native image are you using?
If you were following the steps from grease, you should have hit an error much sooner.
I ended up getting to that point with some updates to the deps.edn file and by rebuilding libffi using version 3.5.2
Here's my fork: https://github.com/rjsheperd/grease I downloaded the static deps from the same URL you specified in the README. I was thinking that might be the issue...
the link in scripts/download-deps no longer works
If I were trying to get this to work, I probably wouldn't start with grease. I would probably either start with https://clojurians.slack.com/archives/C0260KHN0Q0/p1767891724536509?thread_ts=1767887733.921589&cid=C0260KHN0Q0 repo or the https://github.com/gluonhq/gluon-samples/tree/master/HelloGluon from gluon.
If you can get one of the basic java examples to work, then you can start to incorporate the features from grease/babashka.
Maybe grease isn't that far away, but it's hard to tell without a working example.
Do you think the issue with JNI_Load_sunec can be resolved with a newer version of Gluon's Graal VM? I see this was brought up in 2020: https://github.com/oracle/graal/issues/2713#event-3626730652
I did see the ios-graal-jdk-21 repo. That did look promising.
since the link to the static dependencies are broken, did you download them from somewhere else?
my guess is the missing symbols are from the missing jdk static libs
I updated to this build of Gluon and it did build!
https://github.com/gluonhq/graal/releases/tag/gluon-22.0.0.2-Final
2026-01-26 13:06:43.524709-0800 MobileTest[776:148485] [PreviewsAgentExecutorLibrary] Calling provided entry point.
java.lang.ExceptionInInitializerError: null
at com.phronemophobic.grease.interface.clj_eval(interface.java:-1)That's an older version than the version linked in the grease readme
Interesting. It does look like the bb.o file has the correct symbols:
(base) ➜ grease git:(main) ✗ otool -tV library/build/out/bb.o | grep interface
.... ...
_interface_clj_add_f157a51f56ba7a1e87df23f748c220e539822232:
_interface_clj_callback_fn_0081e7c938cf1e9f8347a00b86cc6b0b03c126fb:
_interface_clj_eval_dbbcdd90018a68974d23e62348582a7a4338e7b7:
_interface_clj_print_88c30eb43c7827f9cbdfb2a41cbbdf715f945901:
_interface_clj_print_hi_9293c36f4e350aea0c86e13fab9def0cbedcf6f3:
_interface_clj_prn_71eeefba7ccfac85df24a5638356c36f84d4b0d0:
_interface_clj_start_server_0ad7568083062a97012333d511479eb3cbbbe827:
_interface_clj_sub_cb4c4136dd76a61c4bf943affcc5159bff233d19: Ah, I had to add the com.phronemophobic.grease.interface class to the --initialize-run-time flag