我正在尝试使用android NDK构建sqlite以使用sqlite3_create_function但是我没有获得规则来制作目标错误。 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)
答案 0 :(得分:1)
可能存在这种错误的一些不同原因。
可能LOCAL_PATH
值不正确,请检查LOCAL_PATH初始化。删除其中的任何额外空格。
LOCAL_PATH := $(call my-dir)__
在调用任何jni函数之前,应将jni库加载到内存中。加载jni库如下。
静态{
System.loadLibrary("libmy-jni-module");
}
您可以参考this讨论
答案 1 :(得分: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)