Has anyone used opam-cross-android with the jni (to actually build an apk)?


#1

After much struggling, I’ve managed to create a static library with all the right symbols such that I can include it in my app, but upon calling caml_startup, it segfaults.
Has anyone gotten opam-cross-android to work in an actual app?
There’s this issue from 2.5 years ago asking pretty much the same thing, and didn’t get an answer.


#2

Is there a tool (e.g. gdb followed by bt) where you can get a backtrace from ?


#3

Ok, latest information is: I figured out the segfault, it was a result of me not configuring the architecture right.
However, the big problem with running on modern android devices is that ocaml produces binaries with “text relocations”, which Android now forbids (for android N and onward). You can technically run it if you use an old sdk, but you get a nasty popup on app startup saying “your lib uses text relocations”.

Apparently this is something that has to be fixed in ocaml proper, but I haven’t the foggiest where to start :sweat_smile: