先看一个Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_SRC_FILES := hello.c
LOCAL_MODULE := hello.default
include $(BUILD_SHARED_LIBRARY)
make: Entering directory `/media/workspace/vincent/source/Mirage/mydroid'
make: *** No rule to make target `out/target/product/generic/obj/lib/liblog.so', needed by `out/target/product/generic/obj/SHARED_LIBRARIES/hello.default_intermediates/LINKED/hello.default.so'. Stop.
原因就是缺少liblog.so库文件。
重新编译生产liblog.so :
在Android根目录下运行:
make liblog
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76D
============================================
cp: target `out/target/product/generic/system/vendor/lib' is not a directory
target thumb C: liblog <= system/core/liblog/logd_write.c
target thumb C: liblog <= system/core/liblog/logprint.c
target thumb C: liblog <= system/core/liblog/event_tag_map.c
target StaticLib: liblog (out/target/product/generic/obj/STATIC_LIBRARIES/liblog_intermediates/liblog.a)
target SharedLib: liblog (out/target/product/generic/obj/SHARED_LIBRARIES/liblog_intermediates/LINKED/liblog.so)
target Symbolic: liblog (out/target/product/generic/symbols/system/lib/liblog.so)
target Strip: liblog (out/target/product/generic/obj/lib/liblog.so)
Notice file: system/core/liblog/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/liblog.so.txt
Notice file: system/core/liblog/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/liblog.a.txt
Install: out/target/product/generic/system/lib/liblog.so
好明显liblog.so已经生成,在out/target/product/generic/system/lib中。