Glib is required to compile LCM for android. You need android-ndk-r9 to make this work
Download sources
glib 2.37.6: http://ftp.acc.umu.se/pub/gnome/sources/glib/2.37/
libiconv 1.14: http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
libffi 3.0.13: ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz
gettext 0.18.2: http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.tar.gz
Prepare android build environment on the current console
run source envprep where envprep is the script below
(Set NDK_ROOT as appropriate and set -I and -L flags to where you want android libraries installed. I have them in $HOME/Programs/android)
export NDK_ROOT=$HOME/Programs/android/android-ndk-r9 export API_LEVEL=18 export PREBUILT=$NDK_ROOT/toolchains/arm-linux-androideabi-4.8 export PLATFORM=$NDK_ROOT/platforms/android-$API_LEVEL/arch-arm export PATH=$PATH:$PREBUILT/prebuilt/linux-x86_64/bin #export CFLAGS="-fPIC -DANDROID -nostdlib -Wno-multichar" export CFLAGS="-fPIC -DANDROID -Wno-multichar -I$HOME/Programs/android/include -I$HOME/Programs/android/lib/libffi-3.0.13/include" export CPPFLAGS="-I$NDK_ROOT/platforms/android-$API_LEVEL/arch-arm/usr/include/ -I$HOME/Programs/android/include -I$HOME/Programs/android/lib/libffi-3.0.13/include -DANDROID -DNO_XMALLOC -mandroid" export LIBS="-lc " export LDFLAGS="-Wl,-rpath-link=$NDK_ROOT/platforms/android-$API_LEVEL/arch-arm/usr/lib/ -L$HOME/Programs/android/lib -L$NDK_ROOT/platforms/android-$API_LEVEL/arch-arm/usr/lib" export CROSS_COMPILE=arm-linux-androideabi export CC="${CROSS_COMPILE}-gcc --sysroot=$PLATFORM" export CXX="${CROSS_COMPILE}-g++ --sysroot=$PLATFORM" export AR=${CROSS_COMPILE}-ar export AS=${CROSS_COMPILE}-as export LD=${CROSS_COMPILE}-ld export RANLIB=${CROSS_COMPILE}-ranlib export NM=${CROSS_COMPILE}-nm export STRIP=${CROSS_COMPILE}-strip |
Compile libiconv
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --build=x86_64-unknown-linux-gnu --host=arm-eabi --disable-rpath --prefix=$HOME/Programs/android
make
make install
This will put libiconv.a and other stuff in ~/Programs/android/
Compile libffi
tar zxvf libffi-3.0.13.tar.gz
cd libffi-3.0.13
./configure --build=x86_64-unknown-linux-gnu --host=arm-eabi --prefix=$HOME/Programs/android --enable-static
make
make install
Compile gettext
tar zxvf ../gettext-0.18.3.tar.gz .
cd gettext-0.18.3
./configure --build=x86_64-unknown-linux-gnu --host=arm-eabi --disable-rpath --prefix=$HOME/Programs/android --disable-libasprintf --disable-java --disable-native-java --disable-openmp --disable-curses
make
make install
This will again install stuff into ~/Programs/android
Compile glib
tar xvf ../glib-2.37.6.tar.xz .
cd glib-glib-2.37.6
creare arm.cache containing the following (see also https://developer.gnome.org/glib/stable/glib-cross-compiling.html)
glib_cv_long_long_format=ll glib_cv_stack_grows=no glib_cv_sane_realloc=yes glib_cv_have_strlcpy=no glib_cv_va_val_copy=yes glib_cv_rtldglobal_broken=no glib_cv_uscore=no glib_cv_monotonic_clock=no ac_cv_func_nonposix_getpwuid_r=no ac_cv_func_posix_getpwuid_r=no ac_cv_func_posix_getgrgid_r=no glib_cv_use_pid_surrogate=yes ac_cv_func_printf_unix98=no ac_cv_func_vsnprintf_c99=yes ac_cv_func_realloc_0_nonnull=yes ac_cv_func_realloc_works=yes |
./configure --build=x86_64-unknown-linux-gnu --host=arm-linux-androideabi --prefix=$HOME/Programs/android --disable-dependency-tracking --cache-file=arm.cache --enable-included-printf --enable-static
make
(fix compile errors as they occur. I got the following three:)
gio/gdbusmessage.c, line 3474/3475, change “udi=%d” to “uid=%ld” in g_string_append_printf
In gio/gdbusprivate.c, line 2164, typecast second parameter as (unsigned int)bytes_written
In gio/gdbusprivate.c, line 2215, typecast second parameter as (unsigned int)bytes_read
make install
To compile LCM now, follow a similar configure/make/make install procedure
Cheers
Vilas
--
You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lcm-users+...@googlegroups.com.
To post to this group, send email to lcm-...@googlegroups.com.
Visit this group at http://groups.google.com/group/lcm-users.
For more options, visit https://groups.google.com/groups/opt_out.