【问题标题】:Compiling ICU for Android: __timezone' was not declared in this scope为 Android 编译 ICU:__timezone' 未在此范围内声明
【发布时间】:2012-04-04 13:13:48
【问题描述】:

在尝试使用 Android NDKv7b 编译 ICU49 时,我遇到了以下问题:

/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

使用

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

任何建议将不胜感激。

【问题讨论】:

    标签: android android-ndk icu


    【解决方案1】:

    Here is a patch 用于该特定问题(使用 ICU 4.8 制作,但应该给你这个想法)。

    另外,see the discussion here.

    【讨论】:

    • 感谢 NuSkooler。补丁有什么作用?
    • 特定补丁允许 uprv_timezone() 在 Android/NDK 上正确编译/工作。其他讨论中的其余补丁是针对整个 Android 上的 ICU 的。同样,这些来自旧版本的 ICU,但我想其中许多仍然适用于 4.9。
    【解决方案2】:

    在 CPPFLAGS 中使用 -DU_TIMEZONE=0 修复。但不清楚这是否是正确的方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-05
      • 2011-10-08
      • 2011-01-31
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      相关资源
      最近更新 更多