android,编译过程遇到的错误

<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
 <built-in>:0:0: note: this is the location of the previous definition
 cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

问题原因:由于ubuntu 11.10采用了GCC4.6.1导致的。

解决方法:修改源码目录下/build/core/combo/HOST_linux-x86.mk文件

将
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
改为
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

======================================================================================================================================

frameworks/base/libs/utils/RefBase.cpp:507:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [release/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

解决方法:修改源码目录下frameworks/base/libs/utils/Android.mk文件

将
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 ¥(TOOL_CFLAGS)
改为
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 ¥(TOOL_CFLAGS) –fpermissive





你可能感兴趣的:(android,编译过程遇到的错误)