[libvoikko] Libvoikko compiled for Android
"Harri Pitkänen"
hatapitk at iki.fi
Sat Aug 4 22:17:05 EEST 2012
I have successfully built libvoikko for Android.
There are two ways to do the build. First one is to use Android NDK in
standalone toolchain mode. This is the easy way to build the library
separately from any Android application but the method is still not
officially supported by Google. Install the latest NDK and run the script
at the end of this message. You will need the latest libvoikko sources
from Git.
The second way is to build libvoikko as a part of Android application
project using ndk-build. This is the method Google recommends but it is
somewhat ugly and cannot take advantage of the Autotools build system. I
am developing a spell checker for Android where this method is used but
have not yet documented it properly (so don't bother trying this yet):
https://github.com/voikko/droidvoikko
For now the dictionaries need to be installed on a SD card. Libvoikko
cannot read them directly from the installed package file. I need to make
our dictionary loader more flexible so that we can ship dictionaries
within the application package and load them with AssetManager. This
should not be too difficult but it will require some explicit support in
all backends.
Only backends that do not require any external libraries (VFST and Malaga)
have been built for now. Supporting other backends is slightly more
complicated but definitely possible. Is anyone interested in having HFST
spellers for Android? This is mostly useful for recent Androids (4.0 or
later) since these have a system spell checker framework that can be
extended with custom implementations.
Harri
#!/bin/bash
export NDK=/usr/local/android/android-ndk
export SYSROOT=$NDK/platforms/android-14/arch-arm
export
PATH=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin:$PATH
export
CC="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
--sysroot=$SYSROOT"
export
CXX="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-g++
--sysroot=$SYSROOT"
export
CPP="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-cpp
--sysroot=$SYSROOT"
export
LD="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ld
--sysroot=$SYSROOT"
export
AR="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ar"
export
RANLIB="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-ranlib"
export
STRIP="$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-strip"
export CPPFLAGS="-I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/include
-I$NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include -DPOSIX"
ac_cv_func_realloc_0_nonnull=yes \
ac_cv_func_malloc_0_nonnull=yes \
./configure --prefix=/tmp/androidinst --enable-vfst --disable-buildtools
--disable-testtools --host=arm-linux-androideabi
make install
More information about the Libvoikko
mailing list