No rule to make target

3,935 views
Skip to first unread message

Linux V

unread,
Oct 22, 2010, 6:08:35 AM10/22/10
to android-ndk
I am trying to create 2 shared libraries using NDK.

Here is my Android.mk file

LOCAL_PATH:= $(call my-dir)/libmms/src
include $(CLEAR_VARS)
LOCAL_MODULE := libmms
LOCAL_CFLAGS = -DLIBMMS_HAVE_64BIT_OFF_T
LOCAL_SRC_FILES := mms.c mmsh.c mmsx.c uri.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)
include $(BUILD_SHARED_LIBRARY)


LOCAL_PATH:= $(call my-dir)/libhellojni
include $(CLEAR_VARS)
LOCAL_MODULE := libhellojni
LOCAL_SRC_FILES := hellojni.c
include $(BUILD_SHARED_LIBRARY)

Here is Application.mk file

APP_MODULES := libmms libhellojni

When i run ndk-build it successfully creates libmms.so but not the
second one, it fails with below error

make: *** No rule to make target `/cygdrive/k/J2ME/Android/android-ndk-
r4b-windows/android-ndk-r4b/build/core/libhellojni/hellojni.c', needed
by `/cygdrive/k/J2ME/Android/workspace/mmstest/obj/local/armeabi/objs/
hellojni/hellojni.o'. Stop.


I am a bit new to this, can anyone guide me on what i am missing here?

Tim Mensch

unread,
Oct 22, 2010, 11:57:37 AM10/22/10
to andro...@googlegroups.com
On 10/22/2010 4:08 AM, Linux V wrote:
> `/cygdrive/k/J2ME/Android/android-ndk-r4b-windows/android-ndk-r4b/build/core/libhellojni/hellojni.c'
Does this file exist? The error is claiming it doesn't. Does it exist
but at a different path?

Tim

Linux V

unread,
Oct 22, 2010, 12:45:48 PM10/22/10
to andro...@googlegroups.com
I am able to fix the problem by fixing Android.mk file.

For some reason it works only if you have "call my-dir" only once in file.

Tim

--
You received this message because you are subscribed to the Google Groups
"android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to
android-ndk...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/android-ndk?hl=en.

David Turner

unread,
Oct 23, 2010, 5:04:58 PM10/23/10
to andro...@googlegroups.com
You can only call 'my-dir' once, and at the start of your Android.mk. This is a limitation of the way GNU Make works, unfortunately. Essentially, my-dir can only report the path of the last included Makefile, which in your case will be $NDK/build/core, where the BUILD_SHARED_LIBRARY script lives :-(

Fortunately, there is a simple work-around:

MYTOP_DIR := $(call my-dir)

LOCAL_PATH := $(MYTOP_DIR)/libmms/src
....

LOCAL_PATH := $(MYTOP_DIR)/libhellojni
...

NOTE: The next NDK release will have updated documentation to explain the problem and explain this work-around.


ggomeze

unread,
Oct 23, 2010, 5:02:36 PM10/23/10
to android-ndk
Hi Linux V,

i think i'm doing same thing as you. I was able to build it as well,
and have my libraries ready. However i'm still figuring out how to use
the libmms library from the Android app. Probably i should open a new
thread for that, but let me know if you make some progress with that,
and i will try to let you know as well. If you have any reference,
that would help as well

Thanks!

Ger
Reply all
Reply to author
Forward
0 new messages