Showing posts with label libiconv. Show all posts
Showing posts with label libiconv. Show all posts

Sunday, October 26, 2014

How to build LibIconv for Android on Windows

Prerequisites:

MSYS
MinGW
Android NDK
LibIconv source code


Download and extract LibIconv.

Let's assume that we have the following directory structure:
LibIconv in: D:\temp\android\libiconv-1.14
Android NDK in: D:\tools\android\android-ndk-r10b-win
MinGW in: D:\tools\mingw482_32

Start a MSYS console.

Add MinGW to PATH:
 export PATH=$PATH:/d/mingw482_32/bin  

Set Android NDK environment variables:
 export ANDROID_NDK_ROOT=/d/tools/android/android-ndk-r10b-win  
 export SR="$ANDROID_NDK_ROOT"/platforms/android-12/arch-arm/usr  
 export BR="$ANDROID_NDK_ROOT"/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-  
 export CC="$BR"gcc  
 export AR="$BR"ar  
 export STRIP="$BR"strip  
 export RANLIB="$BR"ranlib  
 export OBJDUMP="$BR"objdump  
 export CC="$BR"gcc CFLAGS=--sysroot=$SR CPP="$BR"cpp CPPFLAGS=$CFLAGS  

Go to libiconv directory:
 cd /d/temp/android/libiconv-1.14   

Configure:
 ./configure --host=arm --with-sysroot=$SR  

Make:
 make  


You can also download a prebuild version from here (libiconv-1.14_android.7z).