ios would he a lot harder due to the restrictions they have on apps and executing native code.
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.
That’s a good knowledge.
Should it be possible to precompile Julia code & ship the binary on iOS?
Basically I’m designing a complex algorithm that ships as a (binary) library. I’m currently prototyping in Python and then coding up in C++.
It would be fantastic if I was able to simply code it up in Julia.
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.
sure i have a seperate repo with all the needed packages at https://github.com/its-pointless/gcc_termux if you follow instructions in README.txt its relatively straight forward. From there you can install julia directly or you can clone https://github.com/its-pointless/julia and build it yourself.
I’m cloning your julia fork, I’m exited! Thanks!
I’m getting uv.h not found, and “cannot find lbthread”, I’m reading all your comments I can find, but I’m not sure how to proceed.
I’m stuck at the run: “setupclang and setupgcc-7” I don’t understand where should I get those commands.
need to install bthread-dev. Its a pthread-cancel implementation for android. Its needed for julia’s libuv which is different.
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:
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: *** [Makefile:136: APInt-C.o] Error 1 make: *** [Makefile:97: julia-src-release] Error 2 $
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: *** [Makefile:136: APInt-C.o] Error 1 make: *** [Makefile:97: julia-src-release] Error 2 $
yeah probably need all the llvm bits as well
libllvm-dev llvm libclang-dev etc
is you want to run before you execute the script
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.
Oh god, this one is more cryptic:
Segmentation fault make: *** [Makefile:187: /data/data/com.termux/files/home/bin/julia/usr/lib/julia/libgit2.so] Error 139 make: *** [Makefile:91: julia-base] Error 2 $
need to install system libgit2-dev ?
Why can’t it read missing x lib, instead of error #2? It’s about to finish now!
I’ll try to run the tests individually, you mention you have added some tests, is there any other command to run those or will they run with
I built yosterday succesfully and was able to use julia, then I melled up my PATH and I am starting again, because I had to reset Termux.
apt install julia-devprev
And then running Julia I get:
CANNOT LINK EKECUTABLE "julia": library "libopenblas.so" not found Aborted
If I do next:
apt install openblas
Then I get:
@its-pointless should I open an issue at your repo to track this?
Yes its probably best handled there since its likely purely a non-julia issue since you could build it yourself and its very likely an arch specific issue with how i compiled julia. Also its probably worth pointing out that there is a failsafe method to start termux that just loads busybox so you don’t have to reinstall termux if something like that happens to a bad path etc.