You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If Substract VM allowed for writing libraries in any of the supported languages (most importantly Java) and these libraries could be called into from iOS application code (written in Swift or Objective-C) then this would be a complete game changer for the "holy grail" of mobile development: Joint code bases for truly native mobile applications.
Rich client logic could then be written purely in Java, packaged as a library and be usable from thin layers of UI code on either platform. Currently this is not properly possible.
There are a few tools promising a solution in that area (e.g. Robo VM or Multi-OS-Engine), but they all come with quite a few strings attached and severely lack the technological soundness of Graal.
It'd be absolutely awesome if Graal would finally be the tool to properly bridge this so far insurmountable chasm between the two major mobile universes.
Reacted by drewhk, Zahari Dichev, Zhongwei Yao, Oops, Juan José Vázquez, Amar Patel, Luka Jacobowitz, Raúl Raja Martínez, Zin, Schmitt Christian and 48 more
Hi @sirthias, iOS support is on our TODO list. AFAIK the kernel design on iOS is essentially the same as macOS, which we currently support. But first we need to implement AArch64 support. The Graal team is already working on an AArch64 back-end. Once that is implemented we need to extend the AArch64 support to SubstrateVM. Then we can support JVM languages that are currently supported on other platforms, i.e, Java, Scala, Kotlin, etc. As for other languages, i.e., JS, Python, etc., they are implemented using Truffle/Graal on top of SubstrateVM and interpreted/JITed at runtime. On iOS you cannot allocate executable memory so JITing is not possible. However you can still run Truffle languages in interpreter mode.
Thank you for this additional info, @cstancu!
So, JVM languages will be supported (eventually) via SubstrateVM's AOT compiler, but everything requiring Truffle/Graal can never be supported since JITting is disallowed on iOS.
While it'd be theoretically better to also have JS, Python, Ruby, etc. supported on iOS I'd say that the by far more important target is Java (and other JVM languages) since they are what people are already using on the Android side.
So to me the prospect of having SubstrateVM-powered Java/Scala/Kotlin/Closure-libraries run nicely on iOS is absolutely fantastic!
What would you personally say, how long the AArch64 support will take to arrive in SubstrateVM?
I know that estimates like this always have to be taken with several giant boulders of salt but it's still interesting to understand what the rough magnitude of this effort is and thus whether it's likely going to take months or rather years...
The Truffle languages can be supported as long as Truffle runs in interpreter mode. You won't get the same performance as with a JIT but it would still be useful for certain scenarios.
As for estimates, it is hard to give any estimate at this time, but it is definitely months not years. And of course we accept pull requests and would provide assistance if anyone wants to work on it.
Hi there @cstancu Thanks a lot for elaborating on these topics. So it appears to me that the two major pieces of work are finishing the AArch64 compiler backend and then providing support for that in SVM.
Is there any kind of board outlining planned broken down work on any of these major tasks. Just asking because if there is any way to help, I would be more than glad to (although the matter can be at times intimidating).
I see @daniel-stewart-qdt is doing some work on AArch64, so maybe he can provide some info on what the next planned steps are as well. In any case, willing to help where and how I can :)
Reacted by Ayodele, Thomas Wuerthinger, Tymur Berezhnoi and Klaus Wuestefeld
@sanzinger The description text of this ticket does not include any question.
Rather, this ticket was meant as a point of reference for other people looking for information about graal support for iOS. Judging from the number of upvotes and comments it appears to me as this ticket was actually doing this job.
Therefore I am a bit surprised to see it simply being closed, especially since the PR you've referenced doesn't mention "iOS" anywhere.
Does your closing of this ticket actually mean "Won't Fix"?
If no, i.e. there hasn't been a decision to not support iOS eventually, would it maybe be better to keep this ticket open until such a decision has actually been made, iOS support is available or another ticket properly supersedes it?
Ok, thank you for these details!
I guess we could live with all but your 3rd point, but maybe it's related to your first.
I'll definitely play around with your forks and try to get sth off the ground.
The good thing is that, in our use case, the shared library would simply be a heap of rather complicated business logic and nothing that needs interacting with native libs.
It would be great though to have proper threading support. Do you have any perspective on that? Did you encounter any issues wrt thread scheduling/concurrency abstractions?
Without having given it a lot of thought yet I'd assume the substrate-based shared lib to behave like any other native ios library, with the ability to start and use "its own" threads or simply run on the caller thread.
Are there any gotchas wrt the memory model? I would expect graal to make sure that all the JVM guarantees are properly upheld whatever the target platform but could imagine that there are certain edges cases that one should be aware of.
As far I remember, I had no concurrency issues / memory leaks during my testings (the framework is using akka / scala and makes use of concurrency).
I don't know if the random crashes were due to JNI loading ,but I sincerely doubt it, as it was rather random and backtrace were not necessary involving native code. However I might have done things the wrong way (and Graal have evolved too).
One of the "difficult" things was finding the proper LLVM / Graal combination to make the build "pass", afterwards it runs "properly".
@CedricGatay we have made quite a few improvements in the last couple of months:
The LLVM is shipped with Graal so there are no difficulties with finding the right version.
The LLVM backend passes all our tests.
The debug symbols are coming soon so the stack traces should become usable.
The build-time is improved quite a bit.
We are currently working on improving testing on mobile devices.
I was wondering about the artifact size, was it 200 MB with JavaFX or just your code?
Asking because a lot of the overhead comes from JavaFX at the moment. For the shared library use case @sirthias is referring to, I don't expect the binary to be large.
Reacted by Cedric Gatay, Mathias, Shafqat Ullah, re-easy and LifeIsStrange
It would be great though to have proper threading support. Do you have any perspective on that? Did you encounter any issues wrt thread scheduling/concurrency abstractions?
You can both start new threads and use the OS threads that are passed through the entry points. The memory model is the same as on the JVM.
The shared library is super interesting, compelling use case for us would be no jni etc. like kotlin mpp but without having to deal with kotlin migrations 🤔
@sanzinger@vjovanov when I google 'graalvm ios', this GitHub issue is the first result I see, and gives me the impression that iOS would not be supported by GraalVM.
What is the situation? Can you share a clarification? It seems users could be very confused.
I only know to look into this beyond this GitHub issue because I am familiar with JavaFX/ScalaFX, Gluon and the iOS announcements earlier.
The reason why I am asking this is because I am currently writing an article about Scala on iOS/Android and noticed this is now a possibility through GraalVM/Gluon.
@ScalaWilliam long story short it is working already but there are edge cases like os specific parts for example "Only Interpreter Mode" that is what your seeing in that example
So iOS is fully supported including webview via javaFx and so on.
I am Not aware of the shared lib stuff but for application development it is working.
It seems support for shared libraries on IOS is there! (not yet upstreamed) gluonhq/substrate@a1a6a37 @vjovanov@jperedadnr
Hope that means we are not far from a well working IOS support and from upstreaming to improve the default experience.
Activity
cstancu commentedon Apr 23, 2018
Hi @sirthias, iOS support is on our TODO list. AFAIK the kernel design on iOS is essentially the same as macOS, which we currently support. But first we need to implement AArch64 support. The Graal team is already working on an AArch64 back-end. Once that is implemented we need to extend the AArch64 support to SubstrateVM. Then we can support JVM languages that are currently supported on other platforms, i.e, Java, Scala, Kotlin, etc. As for other languages, i.e., JS, Python, etc., they are implemented using Truffle/Graal on top of SubstrateVM and interpreted/JITed at runtime. On iOS you cannot allocate executable memory so JITing is not possible. However you can still run Truffle languages in interpreter mode.
sirthias commentedon Apr 23, 2018
Thank you for this additional info, @cstancu!
So, JVM languages will be supported (eventually) via SubstrateVM's AOT compiler, but everything requiring Truffle/Graal can never be supported since JITting is disallowed on iOS.
While it'd be theoretically better to also have JS, Python, Ruby, etc. supported on iOS I'd say that the by far more important target is Java (and other JVM languages) since they are what people are already using on the Android side.
So to me the prospect of having SubstrateVM-powered Java/Scala/Kotlin/Closure-libraries run nicely on iOS is absolutely fantastic!
What would you personally say, how long the AArch64 support will take to arrive in SubstrateVM?
I know that estimates like this always have to be taken with several giant boulders of salt but it's still interesting to understand what the rough magnitude of this effort is and thus whether it's likely going to take months or rather years...
cstancu commentedon Apr 23, 2018
The Truffle languages can be supported as long as Truffle runs in interpreter mode. You won't get the same performance as with a JIT but it would still be useful for certain scenarios.
cstancu commentedon Apr 23, 2018
As for estimates, it is hard to give any estimate at this time, but it is definitely months not years. And of course we accept pull requests and would provide assistance if anyone wants to work on it.
sirthias commentedon Apr 24, 2018
Ok, great. Thank you, @cstancu!
zaharidichev commentedon May 22, 2018
Hi there @cstancu Thanks a lot for elaborating on these topics. So it appears to me that the two major pieces of work are finishing the AArch64 compiler backend and then providing support for that in SVM.
Is there any kind of board outlining planned broken down work on any of these major tasks. Just asking because if there is any way to help, I would be more than glad to (although the matter can be at times intimidating).
I see @daniel-stewart-qdt is doing some work on AArch64, so maybe he can provide some info on what the next planned steps are as well. In any case, willing to help where and how I can :)
ScalaWilliam commentedon Oct 27, 2018
This is interesting.
priand commentedon Jan 11, 2019
@cstancu Any ETA on the iOS support? As @sirthias said, having a AOT compiler for JVM based languages will be a game changer for the Java community.
sanzinger commentedon Jan 14, 2019
We have no ETA for this. We are currently working on SubstrateVM on AArch64 for Linux (See #910). Other platforms are not decided yet.
I hope this answers the original question.
sirthias commentedon Jan 16, 2019
@sanzinger The description text of this ticket does not include any question.
Rather, this ticket was meant as a point of reference for other people looking for information about graal support for iOS. Judging from the number of upvotes and comments it appears to me as this ticket was actually doing this job.
Therefore I am a bit surprised to see it simply being closed, especially since the PR you've referenced doesn't mention "iOS" anywhere.
Does your closing of this ticket actually mean "Won't Fix"?
If no, i.e. there hasn't been a decision to not support iOS eventually, would it maybe be better to keep this ticket open until such a decision has actually been made, iOS support is available or another ticket properly supersedes it?
sanzinger commentedon Jan 16, 2019
At the moment we do not have a decision if we are going to support iOS. At the moment we are occupied getting AArch64/Linux running.
I think we get a clear picture how iOS goes, when we have completed AArch64/Linux in a usable state.
11 remaining items
sirthias commentedon May 4, 2020
Ok, thank you for these details!
I guess we could live with all but your 3rd point, but maybe it's related to your first.
I'll definitely play around with your forks and try to get sth off the ground.
The good thing is that, in our use case, the shared library would simply be a heap of rather complicated business logic and nothing that needs interacting with native libs.
It would be great though to have proper threading support. Do you have any perspective on that? Did you encounter any issues wrt thread scheduling/concurrency abstractions?
Without having given it a lot of thought yet I'd assume the substrate-based shared lib to behave like any other native ios library, with the ability to start and use "its own" threads or simply run on the caller thread.
Are there any gotchas wrt the memory model? I would expect graal to make sure that all the JVM guarantees are properly upheld whatever the target platform but could imagine that there are certain edges cases that one should be aware of.
CedricGatay commentedon May 4, 2020
As far I remember, I had no concurrency issues / memory leaks during my testings (the framework is using akka / scala and makes use of concurrency).
I don't know if the random crashes were due to JNI loading ,but I sincerely doubt it, as it was rather random and backtrace were not necessary involving native code. However I might have done things the wrong way (and Graal have evolved too).
One of the "difficult" things was finding the proper LLVM / Graal combination to make the build "pass", afterwards it runs "properly".
sirthias commentedon May 4, 2020
Ok, thank you, Cedric!
vjovanov commentedon May 4, 2020
@CedricGatay we have made quite a few improvements in the last couple of months:
We are currently working on improving testing on mobile devices.
I was wondering about the artifact size, was it 200 MB with JavaFX or just your code?
Asking because a lot of the overhead comes from JavaFX at the moment. For the shared library use case @sirthias is referring to, I don't expect the binary to be large.
CedricGatay commentedon May 4, 2020
Glad that most of the issues are being fixed @vjovanov !
The binary size was coming from transitive dependencies I guess from the project I was building to native (https://github.com/ACINQ/eclair) without the GUI part (so without JFX parts). But it gets scala + akka as a base.
vjovanov commentedon May 4, 2020
You can both start new threads and use the OS threads that are passed through the entry points. The memory model is the same as on the JVM.
sirthias commentedon May 4, 2020
Thank you, @vjovanov, that's what I assumed, as otherwise lots of things would fall apart.
nhoughto commentedon May 4, 2020
The shared library is super interesting, compelling use case for us would be no jni etc. like kotlin mpp but without having to deal with kotlin migrations 🤔
https://kotlinlang.org/docs/reference/multiplatform.html
ScalaWilliam commentedon Mar 20, 2021
@sanzinger @vjovanov when I google 'graalvm ios', this GitHub issue is the first result I see, and gives me the impression that iOS would not be supported by GraalVM.
But then there are pages like this https://github.com/lazar-mitrovic/GraalREPL
What is the situation? Can you share a clarification? It seems users could be very confused.
I only know to look into this beyond this GitHub issue because I am familiar with JavaFX/ScalaFX, Gluon and the iOS announcements earlier.
The reason why I am asking this is because I am currently writing an article about Scala on iOS/Android and noticed this is now a possibility through GraalVM/Gluon.
frank-dspeed commentedon Aug 19, 2021
@ScalaWilliam long story short it is working already but there are edge cases like os specific parts for example "Only Interpreter Mode" that is what your seeing in that example
So iOS is fully supported including webview via javaFx and so on.
I am Not aware of the shared lib stuff but for application development it is working.
insinfo commentedon May 2, 2022
is it already possible to compile a native shared library written in java for iOS with GraalVM?
frank-dspeed commentedon May 3, 2022
@insinfo your correct this is possible but not supported at present but the moving parts are in place even jvm on jvm works in android
LifeIsStrange commentedon Jul 31, 2022
It seems support for shared libraries on IOS is there! (not yet upstreamed)
gluonhq/substrate@a1a6a37
@vjovanov @jperedadnr
Hope that means we are not far from a well working IOS support and from upstreaming to improve the default experience.
frank-dspeed commentedon Aug 1, 2022
@LifeIsStrange that is only a example that builds for ios everything is from graalvm upstream glueon did not invent anything there :)
hooji commentedon Feb 3, 2025
So, can we write a full iOS app in Java (including access to Apple APIs) and compile to native? If so, any tutorials/examples?