Erlang on Android

Dave Cottlehuber dch@REDACTED
Mon Sep 20 17:25:32 CEST 2021


On Sun, 19 Sep 2021, at 10:51, Jérôme de Bretagne wrote:
> 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 liberlang.so 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 :
> https://github.com/elixir-desktop/runtimes/commit/fdefb0d6f047affd3087dedb47f86ddd6f326ae7

Great to see this knowledge being shared. thanks!

https://github.com/nanovms/erlang has a couple of handy hacks:

one a simple permissions warning, and the other to embed epmd & erlexec directly.

A+
Dave


More information about the erlang-questions mailing list