Erlang on Android

Jérôme de Bretagne jerome.debretagne@REDACTED
Sun Sep 19 12:51:29 CEST 2021

Hey Dominic,

> just wanted to share another approach to running Erlang within an Android application that might be useful for others. In the quest to bring our companies app to Android we decided to use beam.smp binary as a shared library because on Linux (and Android for that matter) ELF binaries are just the same as shared libraries.
> So with only updated environment flags for compilation and linking, we compiled OTP and then renamed beam.smp into to use within our app

This is a very clever approach, pulling in a minimal dependency when
integrating an Erlang VM into an Android project, great work!

> Additional OTP compilation flags:
> CFLAGS="-Os -fPIC" CXXFLAGS="-Os -fPIC" LDFLAGS="-z global"

Interesting use of "-Os" to optimize for size. Your usage of global
linking is well documented at :
 What about "-fPIC", did you face any issues when not passing it
explicitly? I'm asking as the current cross compilation options in
erl-xcomp-arm-android.conf and erl-xcomp-arm64-android.conf don't use
it when compiling with Clang/LLVM.

> I also would like to mention Jérôme de Bretagne who worked on making Erlang run on Android 10 and whose insights there were extremely helpful.

Thanks a lot for the mention :-) For those interested, here is the
issue discussing the Android 10 new limitation and describing the
approach used to make a full Erlang installation run on Android 10+
(while still being compatible with older Android releases):

> Question #2: Has anyone tried bundling Erlang into iPad/iPhone apps with any pointers to repos?
Personally, I haven't looked into this at all.


More information about the erlang-questions mailing list