I am trying to import a module into my project.
Android.mk in module:
LOCAL_PATH := $(call my-dir)
include $(CEAR_VARS)
LOCAL_MODULE := fromhere1
LOCAL_MODULE_FILENAME := fromhere1
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfromhere.so
include $(PREBUILT_SHARED_LIBRARY)
libfromhere.so is built by ndk-build
Android.mk in my project:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native
LOCAL_MODULE_FILENAME := libnative
LOCAL_SRC_FILES := native.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_SHARED_LIBRARIES := fromhere1
include $(BUILD_SHARED_LIBRARY)
$(call import-module,module)
When I run ndk-build, I get error
[arm64-v8a] Compile : native <= native.c
make: Circular /home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so <- /home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so dependency dropped.
[arm64-v8a] SharedLibrary : libnative.so
aarch64-linux-android-g++: error: /home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so: No such file or directory
make: *** [/home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so] Error 1.
I don't understand why that circular dependency is arising. I followed proper syntax.
My mistake is the value of LOCAL_MODULE_FILENAME. It must be libfromhere1 instead of fromhere1. ndk just puts .so suffix to the given name but it won't put lib prefix. Always it is better to give name by yourself than letting ndk name it for you.
But I didn't understand why circular dependency arose because of that.