0

In attempting to compile ICU49 using Android NDKv7b, I ran into the following:

/home/tim/icu49/icu/source/common/putil.cpp: In function 'int32_t uprv_timezone_49()':
/home/tim/icu49/icu/source/common/putil.cpp:637: error: '__timezone' was not declared in this scope
/home/tim/icu49/icu/source/common/putil.cpp: At global scope:
/home/tim/icu49/icu/source/common/putil.cpp:2253: error: expected constructor, destructor, or type conversion before '*' token

using

export ANDROIDVER=8
export AR=/usr/bin/ar
export BASE=/home/tim/icu49
export HOST_ICU=$BASE/icu
export ICU_CROSS_BUILD=$BASE/icu-linux
export NDK_ROOT=$BASE/android-ndk-r7b
export CPPFLAGS="-I$NDK_ROOT/platforms/android-$ANDROIDVER/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -DU_HAVE_NL_LANGINFO_CODESET=0 -D__STDC_INT64__"
export LDFLAGS="-lc -Wl,-rpath-link=$NDK_ROOT/platforms/android-$ANDROIDVER/arch-arm/usr/lib/ -L$NDK_ROOT/platforms/android-$ANDROIDVER/arch-arm/usr/lib/"

export OLDPATH=$PATH
export PATH=/home/tim/icu49/api$ANDROIDVER/bin:$PATH

$NDK_ROOT/build/tools/make-standalone-toolchain.sh --platform=android-$ANDROIDVER --install-dir=$BASE/api$ANDROIDVER

$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-linux-androideabi

Any advice would be much appreciated.

Charles
  • 50,943
  • 13
  • 104
  • 142
tofutim
  • 22,664
  • 20
  • 87
  • 148

2 Answers2

1

Here is a patch for that particular issue (made with ICU 4.8 but should give you the idea).

Also, see the discussion here.

Community
  • 1
  • 1
NuSkooler
  • 5,391
  • 1
  • 34
  • 58
  • Thanks NuSkooler. What does the patch do? – tofutim Mar 20 '12 at 23:01
  • The particular patch allows for uprv_timezone() to compile/work correctly on Android/NDK. The rest of the patches in the other discussion are for ICU on Android as a whole. Again these are from older versions of ICU but many of it still applies in 4.9 I imagine. – NuSkooler Mar 20 '12 at 23:10
0

Fixed using -DU_TIMEZONE=0 in CPPFLAGS. But not clear if this is the right approach.

tofutim
  • 22,664
  • 20
  • 87
  • 148