我无法使用icu为Android构建sqlite:太多未定义的引用

y1aodyip  于 2023-06-28  发布在  Android
关注(0)|答案(1)|浏览(103)

我正在构建自定义的Android Sqlite Binding(https://sqlite.org/android/doc/trunk/www/index.wiki),我想将它链接到一个使用此脚本构建的库ICU:https://github.com/florisboard/icu4c
这是我的Android.mk

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

LOCAL_MODULE := icuuc
LOCAL_EXPORT_C_INCLUDES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/include
LOCAL_SRC_FILES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/jniLibs/$(TARGET_ARCH_ABI)/libicuuc.a

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := icui18n
LOCAL_EXPORT_C_INCLUDES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/include
LOCAL_SRC_FILES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/jniLibs/$(TARGET_ARCH_ABI)/libicui18n.a

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := icudata
LOCAL_EXPORT_C_INCLUDES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/include
LOCAL_SRC_FILES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/jniLibs/$(TARGET_ARCH_ABI)/libicudata.a

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := icutu
LOCAL_EXPORT_C_INCLUDES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/include
LOCAL_SRC_FILES := /home/aeroxr1/Desktop/workspace/icu4c/prebuilt/jniLibs/$(TARGET_ARCH_ABI)/libicutu.a

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
# If using SEE, uncomment the following:
# LOCAL_CFLAGS += -DSQLITE_HAS_CODEC

#Define HAVE_USLEEP, otherwise ALL sleep() calls take at least 1000ms
LOCAL_CFLAGS += -DHAVE_USLEEP=1

# Enable SQLite extensions.
LOCAL_CFLAGS += -DSQLITE_ENABLE_FTS5 
LOCAL_CFLAGS += -DSQLITE_ENABLE_RTREE
LOCAL_CFLAGS += -DSQLITE_ENABLE_FTS3
LOCAL_CFLAGS += -DSQLITE_ENABLE_BATCH_ATOMIC_WRITE

# This is important - it causes SQLite to use memory for temp files. Since 
# Android has no globally writable temp directory, if this is not defined the
# application throws an exception when it tries to create a temp file.
#
LOCAL_CFLAGS += -DSQLITE_TEMP_STORE=3

LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA
LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL
LOCAL_CFLAGS += -U__APPLE__
LOCAL_CFLAGS += -DHAVE_STRCHRNUL=0
LOCAL_CFLAGS += -DSQLITE_USE_URI=1
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
LOCAL_CFLAGS += -Wno-uninitialized -Wno-parentheses
LOCAL_CPPFLAGS += -Wno-conversion-null
   
LOCAL_CFLAGS += -DSQLITE_ENABLE_ICU
LOCAL_STATIC_LIBRARIES := icuuc icui18n icutu icudata

ifeq ($(TARGET_ARCH), arm)
    LOCAL_CFLAGS += -DPACKED="__attribute__ ((packed))"
else
    LOCAL_CFLAGS += -DPACKED=""
endif

LOCAL_SRC_FILES:=                             \
    android_database_SQLiteCommon.cpp     \
    android_database_SQLiteConnection.cpp \
    android_database_SQLiteGlobal.cpp     \
    android_database_SQLiteDebug.cpp      \
    JNIHelp.cpp JniConstants.cpp

LOCAL_SRC_FILES += sqlite3.c

LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/nativehelper/

LOCAL_MODULE:= libsqliteX
LOCAL_LDLIBS += -ldl -llog 

include $(BUILD_SHARED_LIBRARY)

但当我打电话时

../gradlew assembleRelease

我得到错误:

* What went wrong:

Execution failed for task ':sqlite3:externalNativeBuildRelease'.

> Build command failed.

  Error while executing process /home/aeroxr1/Android/Sdk/ndk/21.3.6528147/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/aeroxr1/Desktop/customSql/sqlite/sqlite3/src/main/jni/Android.mk NDK_APPLICATION_MK=/home/aeroxr1/Desktop/customSql/sqlite/sqlite3/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=/home/aeroxr1/Desktop/customSql/sqlite/sqlite3/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/home/aeroxr1/Desktop/customSql/sqlite/sqlite3/build/intermediates/ndkBuild/release/lib sqliteX}

  [armeabi-v7a] Compile++ thumb: sqliteX <= android_database_SQLiteCommon.cpp

  [armeabi-v7a] Compile++ thumb: sqliteX <= android_database_SQLiteConnection.cpp

  [armeabi-v7a] Compile++ thumb: sqliteX <= android_database_SQLiteGlobal.cpp

  [armeabi-v7a] Compile++ thumb: sqliteX <= android_database_SQLiteDebug.cpp

  [armeabi-v7a] Compile++ thumb: sqliteX <= JNIHelp.cpp

  [armeabi-v7a] Compile++ thumb: sqliteX <= JniConstants.cpp

  [armeabi-v7a] Compile thumb  : sqliteX <= sqlite3.c

  [armeabi-v7a] SharedLibrary  : libsqliteX.so

  

  src/main/jni/sqlite/sqlite3.c:210225: error: undefined reference to 'u_foldCase_69'

  src/main/jni/sqlite/sqlite3.c:210240: error: undefined reference to 'ubrk_open_69'

  src/main/jni/sqlite/sqlite3.c:210247: error: undefined reference to 'ubrk_first_69'

  src/main/jni/sqlite/sqlite3.c:210257: error: undefined reference to 'ubrk_close_69'

  src/main/jni/sqlite/sqlite3.c:210283: error: undefined reference to 'ubrk_current_69'

  src/main/jni/sqlite/sqlite3.c:210284: error: undefined reference to 'ubrk_next_69'

  src/main/jni/sqlite/sqlite3.c:210292: error: undefined reference to 'u_isspace_69'

  src/main/jni/sqlite/sqlite3.c:210312: error: undefined reference to 'u_strToUTF8_69'

  src/main/jni/sqlite/sqlite3.c:210014: error: undefined reference to 'ucol_open_69'

  src/main/jni/sqlite/sqlite3.c:210025: error: undefined reference to 'ucol_close_69'

  src/main/jni/sqlite/sqlite3.c:209842: error: undefined reference to 'uregex_setText_69'

  src/main/jni/sqlite/sqlite3.c:209829: error: undefined reference to 'uregex_open_69'

  src/main/jni/sqlite/sqlite3.c:209849: error: undefined reference to 'uregex_matches_69'

  src/main/jni/sqlite/sqlite3.c:209860: error: undefined reference to 'uregex_setText_69'

  src/main/jni/sqlite/sqlite3.c:209928: error: undefined reference to 'u_strToUpper_69'

  src/main/jni/sqlite/sqlite3.c:209930: error: undefined reference to 'u_strToLower_69'

  src/main/jni/sqlite/sqlite3.c:209594: error: undefined reference to 'u_errorName_69'

  src/main/jni/sqlite/sqlite3.c:209970: error: undefined reference to 'ucol_strcoll_69'

  src/main/jni/sqlite/sqlite3.c:209954: error: undefined reference to 'ucol_close_69'

  src/main/jni/sqlite/sqlite3.c:209786: error: undefined reference to 'uregex_close_69'

  src/main/jni/sqlite/sqlite3.c:209716: error: undefined reference to 'u_foldCase_69'

  src/main/jni/sqlite/sqlite3.c:209717: error: undefined reference to 'u_foldCase_69'

  clang++: error: linker command failed with exit code 1 (use -v to see invocation)

  make: *** [/home/aeroxr1/Android/Sdk/ndk/21.3.6528147/build/core/build-binary.mk:725: /home/aeroxr1/Desktop/customSql/sqlite/sqlite3/build/intermediates/ndkBuild/release/obj/local/armeabi-v7a/libsqliteX.so] Error 1

你能帮帮我吗?似乎Android.mk问题,但有很多可能的标志:/

e5njpo68

e5njpo681#

我更新了这篇文章的标题和标签。错误似乎不是原来的一个,我使用了错误的Android.mk

相关问题