No rule to make target NDK

后端 未结 2 1967
慢半拍i
慢半拍i 2020-12-29 06:40

I\'m compiling native sources and adding the dependencies with .a libs and those relative header files with the following structure.

/jni/

And

相关标签:
2条回答
  • 2020-12-29 07:10

    From the Docs in NDK 5, the solution is to create a local variable..

    my-dir Returns the path of the last included Makefile, which typically is the current Android.mk's directory. This is useful to define LOCAL_PATH at the start of your Android.mk as with:

        LOCAL_PATH := $(call my-dir)
    
    IMPORTANT NOTE: Due to the way GNU Make works, this really returns
    the path of the *last* *included* *Makefile* during the parsing of
    build scripts. Do not call my-dir after including another file.
    

    So.. to solve this problem I change my Android.mk to the following.

     LOCAL_PATH := $(call my-dir)
     MY_PATH := $(LOCAL_PATH)
     include $(call all-subdir-makefiles)
    
     include $(CLEAR_VARS)
    
     LOCAL_PATH := $(MY_PATH)
    
     LOCAL_LDLIBS := -llog -ldl
     LOCAL_MODULE    := rmsdk
     LOCAL_SRC_FILES := native.c
    
     include $(BUILD_SHARED_LIBRARY)
    

    And its works.

    0 讨论(0)
  • 2020-12-29 07:34

    I think it is true to def local path after including sub makefiles.

    LOCAL_PATH := $(call my-dir)
     MY_PATH := $(LOCAL_PATH)
     include $(call all-subdir-makefiles)
    
     include $(CLEAR_VARS)
    
     LOCAL_PATH := $(MY_PATH)
    
     LOCAL_LDLIBS := -llog -ldl
     LOCAL_MODULE    := rmsdk
     LOCAL_SRC_FILES := native.c
    
     include $(BUILD_SHARED_LIBRARY)
    

    It looks wrong. I think you can just try this:

     include $(call all-subdir-makefiles)
    
     include $(CLEAR_VARS)
    
     LOCAL_PATH := $(call my-dir)
    
     LOCAL_LDLIBS := -llog -ldl
     LOCAL_MODULE    := rmsdk
     LOCAL_SRC_FILES := native.c
    
     include $(BUILD_SHARED_LIBRARY)
    

    Hope it helps.

    0 讨论(0)
提交回复
热议问题