android源码编译常见错误
错误1:You are attempting to build on a 32-bit system.
Only 64-bit build environments are supported beyond froyo/2.2.
解决:
./external/clearsilver/cgi/Android.mk
./external/clearsilver/java-jni/Android.mk
./external/clearsilver/util/Android.mk
./external/clearsilver/cs/Android.mk
四个文件中的
LOCAL_CFLAGS += -m64
LOCAL_LDFLAGS += -m64
将“64”换成“32”
LOCAL_CFLAGS += -m32
LOCAL_LDFLAGS += -m32
然后,将./build/core/main.mk 中的
ifneq (64,$(findstring 64,$(build_arch)))
改为:
ifneq (i686,$(findstring i686,$(build_arch)))
错误2:make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o]
解决:
gedit frameworks/base/libs/utils/Android.mk
找到
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
改成
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive
错误3: make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt]
解决:
frameworks/base/tools/aapt/Android.mk
打开文件Android.mk,
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
改成
LOCAL_LDLIBS += -lrt -lpthread
错误4:make: *** [out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.dex]
解决:
虚拟机内存512太小,给个1G
错误 5:make: *** [out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize]
解决:
修改./framework/base/tools/localize/Android.mk文件
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
改成
LOCAL_LDLIBS += -lrt -lpthread
Endif
错误6
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o]
解决
/build/core/combo/HOST_linux-x86.mk文件:
将以下语句
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
改成
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0