[erlang-questions] Erlang4Android

Erik Reitsma erlang@REDACTED
Fri Jan 25 20:17:35 CET 2013


Hi,

I am using this script to set environment variables, in order to use the 
Android Arm toolchain:

export 
TOOLCHAIN_ROOT=/home/user/android-ndk/toolchains/arm-linux-androideabi-4.7
export erl_xcomp_sysroot=${TOOLCHAIN_ROOT}/sysroot
export CROSS_COMPILE=arm-linux-androideabi-
export CC=${TOOLCHAIN_ROOT}/bin/${CROSS_COMPILE}gcc
export CXX=${TOOLCHAIN_ROOT}/bin/${CROSS_COMPILE}g++
export SHLIB_LD=${TOOLCHAIN_ROOT}/bin/${CROSS_COMPILE}gcc
export LD=${TOOLCHAIN_ROOT}/bin/${CROSS_COMPILE}ld
export AR=${TOOLCHAIN_ROOT}/bin/${CROSS_COMPILE}ar
export RANLIB=${TOOLCHAIN_ROOT}/bin/${CROSS_COMPILE}ranlib
export CFLAGS=
export LDFLAGS=""
export ERLANDROID_ROOT=`pwd`
export ERL_TOP=`pwd`/otp_src_R15B03

And then I configure using:
./configure --prefix=/tmp/arm_erlang 
--with-ssl=/home/user/openssl/openssl-android-master --without-java 
--disable-hipe --without-termcap --disable-smp-support 
--host=arm-linux-androideabi --build=i686-pc-linux-gnu

Note that I have compiled openssl for Android. If you do not need it, 
you can disable openssl by using --without-ssl

Then I compile using:

TARGET=arm-linux-androideabi make noboot -j12
TARGET=arm-linux-androideabi ./otp_build release -a 
${ERLANDROID_ROOT}/arm_erlang_R15B03_rel

That gives me a directory arm_erlang_R15B03_rel with the compiled 
Erlang/OTP. This directory contains a script Install, which you should 
call with appropriate arguments. I call it like this:
./Install -cross -minimal 
/data/data/com.ernovation.erlangforandroid/files/erlang

Anyway, you are right that the cross compiler finds the Android NDK's 
lib/include from erl_xcomp_sysroot.

On 01/25/2013 07:05 PM, Dongsheng Wang wrote:
>
> hi, Erik,
>
> I have been trying to cross compile erlang for Android as well. I am 
> working on a Mac here. Question about the your configure script:
>
> http://code.google.com/p/erlang4android/downloads/detail?name=otp_src_R15B03.android.tgz&can=2&q=
>
> How does the cross compiler find the Android NDK's lib/include? I am 
> guessing it is using
>
> erl_xcomp_sysroot=${TOOLCHAIN_ROOT}/sysroot
>
> Some now, but could not figure out how.
>
> ds
*Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130125/2f4c3923/attachment.htm>


More information about the erlang-questions mailing list