在编译Android 4.0的HAL层时,出现下面的错误信息:
root@brantyou-ubuntu:~/workspace/android-4.0.4_r1.2# mmm hardware/libhardware/modules/hello/
============================================
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=IMM76I
============================================
make:进入目录'/home/brantyou/workspace/android-4.0.4_r1.2'
make: *** 没有规则可以创建“out/target/product/generic/obj/SHARED_LIBRARIES/hello.default_intermediates/LINKED/hello.default.so”需要的目标“out/target/product/generic/obj/lib/liblog.so”。 停止。
make:离开目录“/home/brantyou/workspace/android-4.0.4_r1.2”
root@brantyou-ubuntu:~/workspace/android-4.0.4_r1.2# ls out/target/product/generic/obj/lib/
crtbegin_dynamic.o crtend_android.o libc.so libm.so
crtbegin_so.o crtend_so.o libdl.so libstdc++.so
经查看,对应的目录下面没有liblog.so库文件。
通过查找,发现liblog位于android源码目录下的system/core/文件夹下面有个liblog的文件夹,看了下里面都是其代码。
这里我们需要通过命令来编译生成该库文件:
make liblog
如:
root@brantyou-ubuntu:~/workspace/android-4.0.4_r1.2# 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=IMM76I
============================================
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
看到最后一句,说明该库已经生成了,到此解决该问题。
刚接触Android底层开发,遇到的问题真不少。很多问题网上都找不到,最终还得靠自己来~~