使用NDK构建ICU

时间:2015-03-11 14:59:13

标签: android android-ndk icu

在过去的几天里,我一直在努力弄清楚如何为Android支持实施ICU库。我坚持不懈,试图用NDK编译ICU源代码。我从这里得到了它们:https://android.googlesource.com/platform/external/icu/

我把它放在我的jni位置,并在我的Android.mk文件中添加了这一行:

include $(call all-subdir-makefiles)

并添加到本地标志:

-DSQLITE_ENABLE_ICU

我在尝试构建它时遇到了很多错误(在Windows机器上)。这是我的输出:

c:/ndk/build/core/build-binary.mk:457: warning: overriding commands for target `
    "----my android project location----"//obj/local/armeabi/objs/icui1
    8n/smpdtfst.o'
    c:/ndk/build/core/build-binary.mk:457: warning: ignoring old commands for target
     `"----my android project location----"//obj/local/armeabi/objs/icu
    i18n/smpdtfst.o'
    c:/ndk/build/core/build-binary.mk:457: warning: overriding commands for target `
    "----my android project location----"//obj/local/armeabi/objs/icui1
    8n_static/smpdtfst.o'
    c:/ndk/build/core/build-binary.mk:457: warning: ignoring old commands for         target
 `"----my android project location----"//obj/local/armeabi/objs/icu
    i18n_static/smpdtfst.o'
    [armeabi] Compile thumb  : icui18n <= decContext.c
    [armeabi] Compile thumb  : icui18n <= ucln_in.c
    [armeabi] Compile thumb  : icui18n <= ulocdata.c
    [armeabi] Compile++ thumb: icui18n <= indiancal.cpp
    [armeabi] Compile++ thumb: icui18n <= dtptngen.cpp
    [armeabi] Compile thumb  : icui18n <= decNumber.c
    [armeabi] Compile thumb  : icui18n <= utmscale.c
    [armeabi] Compile++ thumb: icui18n <= dtrule.cpp
    In file included from "----my android project location----"//jni/ic
    u/icu4c/source/i18n/../common/unicode/unistr.h:31:0,
                 from "----my android project location----"//jni/ic
    u/icu4c/source/i18n/../common/unicode/locid.h:34,
                 from "----my android project location----"//jni/ic
    u/icu4c/source/i18n/unicode/calendar.h:37,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/indiancal.h:18,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/indiancal.cpp:10:
"----my android project location----"//jni/icu/icu4c/source/i18n/..
/common/unicode/std_string.h:33:18: fatal error: string: No such file or directo
ry
 #include <string>
                  ^
compilation terminated.
make.exe: *** ["----my android project location----"//obj/local/arm
eabi/objs/icui18n/indiancal.o] Error 1
make.exe: *** Waiting for unfinished jobs....
In file included from "----my android project location----"//jni/ic
u/icu4c/source/i18n/../common/unicode/unistr.h:31:0,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/../common/unicode/strenum.h:14,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/../common/unicode/uenum.h:24,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/unicode/ucal.h:12,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/unicode/udat.h:16,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/unicode/datefmt.h:26,
                 from "----my android project location----"//jni/ic
u/icu4c/source/i18n/dtptngen.cpp:15:
"----my android project location----"//jni/icu/icu4c/source/i18n/..
/common/unicode/std_string.h:33:18: fatal error: string: No such file or directo
ry
 #include <string>
                  ^
compilation terminated.
make.exe: *** ["----my android project location----"//obj/local/arm
eabi/objs/icui18n/dtptngen.o] Error 1
"----my android project location----"//jni/icu/icu4c/source/i18n/dt
rule.cpp: In member function 'UBool icu_54::DateTimeRule::operator==(const icu_5
4::DateTimeRule&) const':
"----my android project location----"//jni/icu/icu4c/source/i18n/dt
rule.cpp:85:22: error: cannot use typeid with -fno-rtti
             (typeid(*this) == typeid(that) &&
                      ^
"----my android project location----"//jni/icu/icu4c/source/i18n/dt
rule.cpp:85:38: error: cannot use typeid with -fno-rtti
             (typeid(*this) == typeid(that) &&
                                      ^
make.exe: *** ["----my android project location----"//obj/local/arm
eabi/objs/icui18n/dtrule.o] Error 1

这是我的主要Android.mk文件,位于jni目录中:

LOCAL_PATH:= $(call my-dir)
include $(call all-subdir-makefiles)
include $(CLEAR_VARS)

LOCAL_MODULE:= sqlitenative

LOCAL_SRC_FILES := sqlite3.c sqlite3_native.cpp

# NOTE the following flags,
#   SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the      behavior we want
#   SQLITE_ENABLE_FTS3   enables usage of FTS3 - NOT FTS1 or 2.
#   SQLITE_DEFAULT_AUTOVACUUM=1  causes the databases to be subject to auto-    vacuum
#   SQLITE_HAS_CODEC enables crypto support for database
LOCAL_CFLAGS += -DHAVE_USLEEP=1 \
        -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \
        -DSQLITE_THREADSAFE=1 \
        -DNDEBUG=1 \
        -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \
        -DSQLITE_DEFAULT_AUTOVACUUM=1 \
        -DSQLITE_TEMP_STORE=3 \
        -DSQLITE_ENABLE_FTS3 \
        -DSQLITE_ENABLE_FTS3_PARENTHESIS \
        -DSQLITE_ENABLE_COLUMN_METADATA \
        -DSQLITE_ENABLE_ICU \
        -DHAVE_STRCHRNUL=0

LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lc
LOCAL_C_INCLUDES += $(call include-path-for, system-core)/cutils

LOCAL_SHARED_LIBRARIES += libicuuc \
        libicui18n \
        libutils

LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host
LOCAL_STATIC_LIBRARIES := liblog libutils libcutils

include $(BUILD_SHARED_LIBRARY)
include $(BUILD_HOST_SHARED_LIBRARY)

0 个答案:

没有答案