2012年8月13日 星期一

Android - build error and solution

Error 1 :

host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp

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] 错误 1

Solution :

$ gedit frameworks/base/libs/utils/Android.mk
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)

Modify to ...

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

Reference link : http://goo.gl/gb2XC

Error 2 :
host Prebuilt: monkeyrunner (out/host/linux-x86/obj/EXECUTABLES/monkeyrunner_intermediates/monkeyrunner) host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp <命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror] :0:0: 附注: 这是先前定义的位置 cc1plus:所有的警告都被当作是错误

Solution :

build/core/combo/HOST_linux-x86.mk line 61: 

find this line ...

-HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0

modify to ...

+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

Reference link : http://goo.gl/kUEpI

沒有留言: