Compiling ICUs using arm-linux-androideabi-4.4.3

I would like to cross-compile the static ICU libraries for Android using Cygwin. So far I have managed to configure and make versions of Cygwin / MSVC and Cygwin. I installed android-ndk-r7 and see the gcc version in the toolchains directory. A few examples suggest using host: arm-eabi - but this is not on my machine.

I copied mh-linux to mh-unknown in / icu / source / config and ran the following:

export HOST_ICU=/cygdrive/d/__/External/SQLite/icu export ICU_CROSS_BUILD=/cygdrive/d/__/External/SQLite/icu-cygwin export NDK_ROOT=/cygdrive/d/__/android-ndk-r7 export CPPFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib" export CXXFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib" export CFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib" export LDFLAGS="-lc -Wl,-rpath-link=$NDK_ROOT/platforms/android-8/arch-arm/usr/lib/ -L $NDK_ROOT/platforms/android-8/arch-arm/usr/lib/" $HOST_ICU/source/configure --with-cross-build=$ICU_CROSS_BUILD --enable-extras=no --enable-strict=no --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools=no --host=arm-eabi --with-data-packaging=archive 

I get the following error:

 checking for ICU version numbers... release 4.8.1.1, library 48.1.1, unicode version 6.0 checking build system type... i686-pc-cygwin checking host system type... arm-unknown-eabi checking target system type... arm-unknown-eabi checking whether to build debug libraries... no checking whether to build release libraries... yes checking for arm-eabi-gcc... no checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/cygdrive/d/Projects/__/External/SQLite/icu-android': configure: error: C compiler cannot create executables See `config.log' for more details 

I am sure this is a "stupid" question, but how can I configure the ICU configure script on gcc under $ NDK_ROOT \ toolchains \ arm-linux-androideabi-4.4.3 \ prebuilt \ windows \ lever Linux-androideabi \ bin? Am I missing any installation or installation? Should I configure my PATH so that the first gcc found is the only one in arm-linux-androiedeabi?

Update 1. I just noticed that although windows \ arm-linux = androideabi \ bin contains gcc, windows \ bin contains arm-linux-androideabi-gcc. How do I get the ICU to call it?

Update 2. At the suggestion of Stephen R. Loomis, I took updates for config.sub and config.guess from

http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD http://git.savannah.gnu.org/gitweb/?p = config.git; a = blob_plain; f = config.guess; hb = HEAD

put android-ndk-r7 / toolchains / arm-linux-androideabi-4.4.3 / prebuilt / windows / bin in my path and restarted configure with -host = arm-linux-androideabi ... this time:

 checking for arm-linux-androideabi-gcc... arm-linux-androideabi-gcc checking whether the C compiler works... no 

Definitely closer.

Detailed error from config.log
 gcc version 4.4.3 (GCC) configure:3125: $? = 0 configure:3114: arm-linux-androideabi-gcc -V >&5 arm-linux-androideabi-gcc.exe: '-V' option must have argument configure:3125: $? = 1 configure:3114: arm-linux-androideabi-gcc -qversion >&5 arm-linux-androideabi-gcc.exe: unrecognized option '-qversion' arm-linux-androideabi-gcc.exe: no input files configure:3125: $? = 1 configure:3145: checking whether the C compiler works configure:3167: arm-linux-androideabi-gcc -I/cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-arm/usr/include / -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib -I/cygdrive/d/Projec ts/android-ndk-r7/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF1 6_STRING=0 -fno-short-enums -nostdlib -lc -Wl,-rpath-link=/cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-a rm/usr/lib/ -L /cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-arm/usr/lib/ conftest.c >&5 D:/Projects/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/ 4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find -lc collect2: ld returned 1 exit status configure:3171: $? = 1 configure:3209: result: no configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:3214: error: in `/cygdrive/d/Projects/__/External/SQLITE/icu-android': configure:3216: error: C compiler cannot create executables See `config.log' for more details 

Update 3. Changes to config.sub and config.guess worked on the fact that we are now using the correct gcc compiler. The -lc error occurs due to the inability to find libc.so (which is located in android-ndk-r7 / platform / android-8 / arch-arm / usr / lib), although this is in LDFLAGS. extra space after -L in the original LDFLAGS, but removing this did not help.

Update 4 .. By the old entry at http://groups.google.com/group/android-ndk/browse_thread/thread/46295616a889bc12

"The Windows ndk toolchain (fortunately) is native to windows, so it does not go through the cygwin translation layer, which will translate / cygdrive."

Update 5. Replaced all instances of / cygdrive / d / with D: /. Now the C compiler works, although it still doesn’t. Wait for ICU_CROSS_BUILD to be in the icu / source directory.

 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether arm-linux-androideabi-gcc accepts -g... yes checking for arm-linux-androideabi-gcc option to accept ISO C89... none needed checking for arm-linux-androideabi-g++... arm-linux-androideabi-g++ checking whether we are using the GNU C++ compiler... yes checking whether arm-linux-androideabi-g++ accepts -g... yes checking how to run the C preprocessor... arm-linux-androideabi-gcc -E checking for a BSD-compatible install... /usr/bin/install -c checking for gmake... /usr/bin/gmake configure: error: D:/Projects/__/External/SQLite/icu-cygwin/config/icucross.mk not found. Please build ICU in D:/Projects/__/External/SQLite/icu-cygwin first. 

Update 6 .. I reconfigured and updated the Cygwin folder in icu-cygwin. Go figure, this time there was icucross.mk. Successful configuration! But...

Update 7 Make it not so good.

 $ make D:/Projects/__/External/SQLite/icu/source/config/mh-linux:41: *** target pattern contains no `%'. Stop. 

What?!?! It seems that now we again want the path of Cygwin .. :(

Update 8. My paths have been changed so that HOST_ICU and ICU_CROSS_BUILD use Cygwin paths, but NDK_ROOT is the path to Windows (since Android NDK ld cannot handle cygwin paths).

It's time but

 arm-linux-androideabi-gcc.exe: /cygdrive/d/Projects/__/External/SQLit e/icu/source/stubdata/stubdata.c: No such file or directory arm-linux-androideabi-gcc.exe: no input files 

It seems that what should happen is that arm-linux-androideabi-gcc needs to be done for cygwin, or cross-build will not work.

Update 9. It seems that arm-linux-androideabi-gcc does not support cygwin paths, although ndk_build does. However, the ICU is configured to invoke arm-linux-androideabi-gcc, while cygwin paths are required for make. Maybe it's time to upgrade to OSX or Linux for this.

Update 10 - Still no success. Cygwin - Apparently, the Crystax linux-androideabi Crystax assembly also does not support the cygwin paths in -L. Attempting to cross-compile under Cygwin will give the -lc error, because it cannot parse the -L / cygdrive / d / ... path to the library. Switching to D: / helps, but later on the reasons become unsuccessful, as Cygwin does.

Linux Using the normal NDK r7 build, the configuration will fail with wchar_t = 0. The Crystax NDK construct will fix this and make will not complain about uint64_t in Android sys / type.h. See the ICU library in the Android NDK . You can force it to be identified, and this will lead to another error about size mismatch.

OSX Probably the most successful, compiled using the official build or Crystax build, it leads directly to the uint64_t error. If you crack it, it will lead you to

 icu/source/common/ustrenum.cpp:118: error: must #include <typeinfo> before using typeid 

Help!

+7
source share
1 answer

00. Download android ndk http://developer.android.com/tools/sdk/ndk/index.html

example install d:\android-r9b

01. Download installation example d:\msys MSys http://www.mingw.org/wiki/MSYS 1.01

02. Download gcc 3.8.1 w64 http://mingw-w64.sourceforge.net/ example install d:\mingw32_64

03. Download icu versin 52.1 http://site.icu-project.org/download/52#TOC-ICU4C-Download

04. Extract the icu source code to d:\icu

05. Type msys use export PATH=/d/msys/1.0/bin:/d/ming32_64/mingw32/bin:$PATH

06.cd cd /d/icu;mkdir mingw;mkdir android;cd mingw

these are the next icu readme.html cross-compilation steps

07. cd /d/icu/ming ;../source/runConfigureICU MinGW ;make

no problem, everything works, and cross compilation tools are created in /d/icu/mingw/bin later.

08. cd /d/icu/android

09. /d/android-ndk-r9b/build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=/d/androidgcc/ -- toolchain=arm-linux-androideabi-4.8

if a 7/8 64 bit usage window adds additional options: - system=windowx86_64

10. export PATH again; export PATH=/d/msys/1.0/bin/:/d/androidgcc/bin/:/d/androidgcc/arm-linux-androideabi/bin/

The path must include running ar.exe to create the library.

11. Create a shared library.

 sh ../source/configure --host=armv6-google-linux --enable-shared=yes --disable-static -with-cross-build=/d/icu/mingw CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ AR=arm-linux-androideabi-ar --with-data-packaging=archive 

12. make

everything is successful

+4
source

All Articles