1

I am trying to build sqlite using the android NDK to use a sqlite3_create_function but am getting No rule to make target error. make: *** No rule to make target '/fts3-rank.c', needed by '.../obj/local/armeabi/objs/fts3-rank//fts3-rank.o'. Stop. This Android.mk file is based off of the one on this website: 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)
John61590
  • 1,106
  • 1
  • 13
  • 29
  • This is likely caused by a combination of a pattern matching make rule and the presence of a double slash (`...//fts3-rank.o`); alternatively, `/fts3-rank.c` may be missing a prefix (something like `$(SRC)/fts3-rank.c` will turn into `/fts3-rank.c` if `SRC` is not defined). – technomage Jul 23 '13 at 14:45
  • I'm just getting `make: *** No rule to make target '/fts3-rank.c', needed by 'obj/local/armeabi/objs/fts3-rank/fts3-rank.o'. Stop.` now and still can't figure it out... I've tried adding $(LOCAL_PATH) and adding fts3-rank.c to sqlite amalgamation and still nothing. – John61590 Jul 24 '13 at 21:38
  • Run '`make`' with '`-d`', then look for lines containing '`/fts3-rank.c`'. When you find the rule, look at the previous lines of output to determine where the rule is defined; then look in that makefile to see the original rule which should make obvious what macro is missing a definition. – technomage Jul 25 '13 at 13:36

2 Answers2

1

May be There some different reason of this error.

  1. It may be LOCAL_PATH value incorrect so check LOCAL_PATH initialization. Remove any extra spaces in that. LOCAL_PATH := $(call my-dir)__

  2. Your jni library should be loaded in memory before calling any jni function. Load jni library as follow.

    static {

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

    }

You may refer this discussion on so

Community
  • 1
  • 1
Mukesh Kumar Singh
  • 4,512
  • 2
  • 22
  • 30
  • I tried the System.loadLibrary and it didn't fix it. Here is how I have my file system set up: project/jni is where all of my files are (Android.mk, sqlite-amalgamation folder, and fts3-rank.c). I am tried running from both project folder and jni but no go. I have no extra spaces after LOCAL_PATH either. – John61590 Jul 23 '13 at 13:53
1

I fixed it somehow by trial and error. It was very strange. I guess it's because I was using LOCAL_PATH twice?

I finally got it to build using this 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)
John61590
  • 1,106
  • 1
  • 13
  • 29