1

我正在尝试使用 android NDK 构建 sqlite 以使用 sqlite3_create_function 但我得到 No rule to make target 错误。make: *** No rule to make target '/fts3-rank.c', needed by '.../obj/local/armeabi/objs/fts3-rank//fts3-rank.o'. Stop.此 Android.mk 文件基于此网站上的文件:http ://www.roman10.net/how-to-compile-sqlite-for-android-using-ndk/

    #LOCAL_PATH is used to locate source files in the development tree.

    #the macro my-dir provided by the build system, indicates the path of the current   directory

    LOCAL_PATH := $(call my_dir)




    #####################################################################

    #            build sqlite3                                            #

    #####################################################################

    include $(CLEAR_VARS)

    LOCAL_C_INCLUDES := $(LOCAL_PATH)/sqlite-amalgamation-3071700

    LOCAL_MODULE := sqlite3

    LOCAL_SRC_FILES := $(LOCAL_PATH)/sqlite-amalgamation-3071700/sqlite3.c

    include $(BUILD_STATIC_LIBRARY)

    #include $(BUILD_SHARED_LIBRARY)





    #####################################################################

    #            build our code                    #

    #####################################################################

    include $(CLEAR_VARS)

    LOCAL_C_INCLUDES := $(LOCAL_PATH)/sqlite-amalgamation-3071700

    LOCAL_MODULE := fts3-rank

    LOCAL_SRC_FILES := fts3-rank.c

    LOCAL_STATIC_LIBRARIES := libsqlite3

    #LOCAL_SHARED_LIBRARIES:=libsqlite3

    LOCAL_LDLIBS := -llog -lm

    #include $(BUILD_SHARED_LIBRARY)

    include $(BUILD_EXECUTABLE)
4

2 回答 2

1

我通过反复试验以某种方式修复了它。这很奇怪。我想这是因为我使用了 LOCAL_PATH 两次?

我终于用这个 Android.mk 来构建它

#LOCAL_PATH is used to locate source files in the development tree.

#the macro my-dir provided by the build system, indicates the path of the current directory

LOCAL_PATH := $(call my-dir)




#####################################################################

#            build sqlite3                                          #

#####################################################################

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := sqlite-amalgamation-3071700

LOCAL_MODULE := sqlite3

LOCAL_SRC_FILES := sqlite-amalgamation-3071700/sqlite3.c

include $(BUILD_STATIC_LIBRARY)

#include $(BUILD_SHARED_LIBRARY)





#####################################################################

#            build our code                    #

#####################################################################

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/sqlite-amalgamation-3071700

LOCAL_MODULE := fts3-rank

LOCAL_SRC_FILES := fts3-rank.c

LOCAL_STATIC_LIBRARIES := libsqlite3

#LOCAL_SHARED_LIBRARIES:=libsqlite3

LOCAL_LDLIBS := -llog -lm

include $(BUILD_SHARED_LIBRARY)

#need main function to have executable

#include $(BUILD_EXECUTABLE)
于 2013-07-24T23:17:36.320 回答
1

这个错误可能有一些不同的原因。

  1. 它可能LOCAL_PATH值不正确,因此请检查 LOCAL_PATH 初始化。删除其中的任何多余空格。 LOCAL_PATH := $(call my-dir)__

  2. 您的 jni 库应该在调用任何 jni 函数之前加载到内存中。如下加载 jni 库。

    静止的 {

    System.loadLibrary("libmy-jni-module");
    

    }

你可以参考这个讨论所以

于 2013-07-23T13:35:54.967 回答