看编译命令make showcommands:
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
g++ -I external/zlib -I frameworks/base/libs/utils -I out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates -I dalvik/libnativehelper/include/nativehelper -I system/core/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I dalvik/libnativehelper/include -I frameworks/base/include -I frameworks/base/opengl/include -I frameworks/base/native/include -I external/skia/include -I tools/include -I out/host/linux-x86/obj/include -c -fno-exceptions -Wno-multichar -m32 -fPIC -include system/core/include/arch/linux-x86/AndroidConfig.h -D_FORTIFY_SOURCE=0 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -O2 -g -fno-strict-aliasing -DNDEBUG -UDEBUG -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wsign-promo -DNDEBUG -UDEBUG -DLIBUTILS_NATIVE=1 -MD -o out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o frameworks/base/libs/utils/RefBase.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1
不知到什么错误引起的,折腾了一晚上,最后才明白原来是ubuntu 11.10的gcc 4.6版本太高了,android编译需要gcc 4.4 。