我需要建立基于一个prebuilt静态库的共享库。 我的makefile文件的src /安卓/外部/我的code / Android.mk:
I need to build a shared library based on a prebuilt static library. My makefile src/android/external/mycode/Android.mk:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := libMyStatic
LOCAL_SRC_FILES := libStatic.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_ARM_MODE := arm
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libMyShared
LOCAL_WHOLE_STATIC_LIBRARIES := libMyStatic
include $(BUILD_SHARED_LIBRARY)
我做构建它: MMM外部/我的code
并且得到错误:
make: *** No rule to make target `out/target/product/generic/obj/STATIC_LIBRARIES/libMyStatic_intermediates/libMyStatic.a', needed by `out/target/product/generic/obj/SHARED_LIBRARIES/libMyShared_intermediates/LINKED/libMyShared.so'. Stop.
make: Leaving directory `/home/test/src/android'
如果我这样做手动以下和MMM再次运行它的工作原理:
If I do the following manually and run mmm again it works:
cp external/mycode/libStatic.a out/target/product/generic/obj/STATIC_LIBRARIES/libMyStatic_intermediates/libMyStatic.a
如果我做了NDK的项目和使用该Android.mk文件,我认为它的工作原理马上调用NDK,构建脚本时。所以,问题有事情做与该libMyStatic.a文件不创建并复制到中间文件夹时,我用的是Android编译系统。 谁能告诉我什么,我需要设置,以使构建系统的静态库复制到中间文件夹?
If I make an NDK project and use this Android.mk file I think it works right away when calling the ndk-build script. So the problem has something to do with that the libMyStatic.a file is not created and copied to the intermediate folder when I use the Android Build system. Can anyone tell me what I need to setup to make the build system copy the static library to the intermediate folder?
修改您的MK文件
"LOCAL_WHOLE_STATIC_LIBRARIES := libMyStatic"
到
"LOCAL_LDFLAGS += -lMyStatic