Hello,
I have libtestserver.so in /system/lib in my phone.
I need to use this shared library in my project so...something like...
#include "libtestserver_header.h"
here is libjnitest.c
.....jint Java_blah_blah...(...)
.......//in this method..I called a function from libtestserver
libtestserver_functionA();
}
Here is my Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -ltestserver
LOCAL_MODULE := libjnitest
LOCAL_SRC_FILES := libjnitest.c
include $(BUILD_SHARED_LIBRARY)
from ndk-build, it complains about "ld: error :cannot find -ltestserver"...
Well..it kinda makes sense....I have that libtestserver.so in the phone, but in my development env, I don't have it..
So...
I changed the Android.mk like this to include that shared object file like..
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := testserver
LOCAL_SRC_FILES := $(LOCAL_PATH)/../libs/libtestserver.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -L$(LOCAL_PATH)/../libs/armeabi -ltestserver
LOCAL_MODULE := libjnitest
LOCAL_SRC_FILES := libjnitest.c
include $(BUILD_SHARED_LIBRARY)
No "ld cannot find error" any more but...still got an error "undefined reference to libtestserver_functionA()"...
Here is some error message..
Install : libtestserver.so => libs/armeabi/libtestserver.so
BFD: ...../libs/armeabi/sthU0Jm9: warning: sh_link not set for section `.ARM.exidx'
...
SharedLibrary : libjnitest.so
....................
.........................error: undefined reference to 'libtestserver_functionA()'
collect2: ld returned 1 exit status
Any idea?
Thanks,
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.