You should post this to android-ndk instead.

Use LOCAL_STATIC_LIBRARIES instead of LOCAL_STATIC_LIBRARY
Similarly, LOCAL_SHARED_LIBRARIES instead of LOCAL_SHARED_LIBRARY

Hope this helps

2011/6/16 维江 郭 <[email protected]>

> i m trying to build shared library named "libbestv.so" by "ndk-build"
> this library uses functions from prebuilt shared library "libbcti.so"
> and "libbcti.a"
> i have tried 2 methods to build it but both are failed. call for help
>
> first. my  Android.mk file likes this:
>
> LOCAL_PATH:= $(call my-dir)
>
> ##############################################################
>
> include $(CLEAR_VARS)
> LOCAL_MODULE            := static-lib
> LOCAL_SRC_FILES         := libstaticbcti.a
> LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
> include $(PREBUILT_STATIC_LIBRARY)
>
> ##############################################################
>
> include $(CLEAR_VARS)
> LOCAL_MODULE            := shared-lib
> LOCAL_SRC_FILES         := libsharedbcti.so
> LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
> include $(PREBUILT_SHARED_LIBRARY)
>
> ##############################################################
>
> include $(CLEAR_VARS)
> LOCAL_MODULE         := libbestv
> LOCAL_SRC_FILES      := bcti_jni.c
> LOCAL_STATIC_LIBRARY := static-lib
> LOCAL_SHARED_LIBRARY := shared-lib
> include $(BUILD_SHARED_LIBRARY)
>
> ##############################################################
>
> the console displayed "undefined reference" error like this:
> /home/apt/workspace/BCTI/obj/local/armeabi/objs/bestv/bcti_jni.o: In
> function `Java_com_example_hellojni_HelloJni_bcti_open':
> /home/apt/workspace/BCTI/jni/bcti_jni.c:2066: undefined reference to
> `bcti_open'
> /home/apt/workspace/BCTI/jni/bcti_jni.c:2070: undefined reference to
> `bcti_getresult'
> /home/apt/workspace/BCTI/jni/bcti_jni.c:2181: undefined reference to
> `bcti_freeresult'
>
>
> ------------------------------------------------------------------------------------------------------------
> second. my  Android.mk file likes this:
>
> LOCAL_PATH:= $(call my-dir)
>
> ##############################################################
>
> include $(CLEAR_VARS)
> LOCAL_MODULE            := static-lib
> LOCAL_SRC_FILES         := libstaticbcti.a
> LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
> include $(PREBUILT_STATIC_LIBRARY)
>
> ##############################################################
>
> include $(CLEAR_VARS)
> LOCAL_MODULE            := shared-lib
> LOCAL_SRC_FILES         := libsharedbcti.so
> LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/
> include $(PREBUILT_SHARED_LIBRARY)
>
> ##############################################################
>
> include $(CLEAR_VARS)
> LOCAL_MODULE         := libbestv
> LOCAL_SRC_FILES      := bcti_jni.c
> LOCAL_LDFLAGS    := $(LOCAL_PATH)/libstaticbcti.a
> LOCAL_LDLIBS     := $(LOCAL_PATH)/libsharedbcti.so
> include $(BUILD_SHARED_LIBRARY)
>
> ##############################################################
>
> the console displayed "could not read symbols" error like this:
> /home/apt/CloudHost/besttv/JNI_Build/android-ndk-r5b/toolchains/arm-
> linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-
> androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: /home/apt/
> workspace/BCTI/jni/libstaticbcti.a(bcti_service.o): Relocations in
> generic ELF (EM: 3)
> /home/apt/CloudHost/besttv/JNI_Build/android-ndk-r5b/toolchains/arm-
> linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-
> androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: /home/apt/
> workspace/BCTI/jni/libstaticbcti.a(bcti_service.o): Relocations in
> generic ELF (EM: 3)
> /home/apt/workspace/BCTI/jni/libstaticbcti.a: could not read symbols:
> File in wrong format
> collect2: ld returned 1 exit status
> make: *** [/home/apt/workspace/BCTI/obj/local/armeabi/libbestv.so] 错误
> 1
>
> if i ignore "LOCAL_LDFLAGS := $(LOCAL_PATH)/libstaticbcti.a"  , the
> console displayed like this:
> /home/apt/workspace/BCTI/jni/libsharedbcti.so: could not read symbols:
> File in wrong format
> collect2: ld returned 1 exit status
> make: *** [/home/apt/workspace/BCTI/obj/local/armeabi/libbestv.so] 错误 1
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to