Can anyone see any path towards running Julia code on iOS / Android?
It would be fantastic to be able to solve the two-language problem (e.g. prototyping in Python and deploying in C++).
The idea would be to release an app on the app-store that contains a Julia kernel.
Would it be possible to get Julia to precompile the Julia code, so that it generates a binary library exposing C-style functions, and the iOS/Android code could link against this library?
Something like this could massively accelerate the development of apps that require complex mathematics.
And how about the full-blown Julia process of dynamic compilation? Apple has a āno compilersā rule but IIRC it has allowed many apps that violate this rule in the past. If the app consumer is allowed to write and execute arbitrary Julia code this may fall foul, but if the developer is the only one writing the Julia code then Apple may be willing to allow it.
I use Julia on Android but it is not a direct way because Androidās own libc and ABI is not compatible with Juliaās generic binaries. However, having small linux directory and using proot through termux terminal app I can use Julia as if I am in regular linux. Some functions are not still usable but computationally I did not see any unusable features. Also, I use IJulia to interface Julia to a browser app instead of terminal screen.
Nontheless, this way may not work in the future Android releases as google restricts more user space features and deviates from regular linux.
i have a github account with a fork of julia. Termux provides a llvm clang etc and i have added gcc with gfortran and openblas. etc
This allows me to compile julia on device. Unless someone with more knowledge of Julia than i can get cross compiling working ( there is one guy trying afaik ) what i have done is the best there is for now with regards to geting julia that runs on the bionic libc aka real android.
The issue youāre going to run into with iOS is not App Store restrictions, but the fact that you cannot mark writable memory pages as executable. This is a security āfeatureā, but also means that any sort of JIT compilation just plain does not work.
In theory, yes, there should be no issue with shipping a compiled binary.
(BTW, for background I used to work on MacRuby and am familiar with the techniques that had to be employed for RubyMotion to deploy on iOS.)
The problem, of course, is maintaining dynamism while doing so. If all your types are specified in advance, itās no problem. If not, then you need to (re-)implement dynamic dispatch that doesnāt require JITāing. See here for a (very advanced) dive into how Obj-C and Swift handle dynamic dispatch differently.
Hello its-pointless, could you please tell me how did you install gfortran on your device? termux doesnāt have gfortran, libatomic nor awk, which are build dependencies too.
need to install bthread-dev. Its a pthread-cancel implementation for android. Its needed for juliaās libuv which is different.
The command
./buildjulia-termux.sh
should be enough as long as you installed the dependencies. Or i failed. One of those ones.
After installing that Iām getting this new error:
clang
ln -sf /data/data/com.termux/files/usr/lib/libmpfr.so /data/data/com.termux/files/home/bin/julia/usr/lib/julia
CC src/APInt-C.o
clang-6.0: warning: optimization flag '-falign-functions' is not supported [-Wignored-optimization-argument]
In file included from /data/data/com.termux/files/home/bin/julia/src/APInt-C.cpp:3:
./llvm-version.h:3:10: fatal error: 'llvm/Config/llvm-config.h' file not found
#include <llvm/Config/llvm-config.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
make[1]: *** [Makefile:136: APInt-C.o] Error 1
make: *** [Makefile:97: julia-src-release] Error 2
$
gcc
ln -sf /data/data/com.termux/files/usr/lib/libmpfr.so /data/data/com.termux/files/home/bin/julia/usr/lib/julia CC src/APInt-C.o
g++: warning: unrecognized command line option '-Wcovered-switch-default'; did you mean '-Wno-switch-defaul'?
g++: warning: unrecognized command line option '-Wstring-conversion'; did you mean '-Wint-conversion'?
cc1plus: error: unrecognized command line option '-Wcovered-switch-default'
cc1plus: error: unrecognized command line option '-Wstring-conversion'
make[1]: *** [Makefile:136: APInt-C.o] Error 1
make: *** [Makefile:97: julia-src-release] Error 2
$
I really really apreciate all your help, I know that all this must seem implicit to you, but I promise Iāll make a blog post to document it, this is truly awesome.