android 2.3 build

|

http://source.android.com/source/initializing.html


------------------------------

Building Android: error: passing ‘const android::RefBase::weakref_impl’

If you are building android in ubuntu >10.04 you are gonna get this awesome error:

:0:0: warning: “_FORTIFY_SOURCE” redefined [enabled by default]
: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

Like the error itself tell us, the fix is to add the flag fpermissive, so let’s editframeworks/base/libs/utils/Android.mk and change:

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)

to

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

And let the compiler do its job.

----------------------------------

http://e-xiao.blogspot.kr/2011/10/resolve-build-errors-for-android-234.html


Resolve the Build Errors for Android 2.3.4 under 32-bit ubuntu 11.10

ERROR#1
Firstly need to enable to build android on a 32-bit system. Otherwise, you will see the following error message immediately when you start to build the source tree.
************************************************************
You are attempting to build on a 32-bit system.
Only 64-bit build environments are supported beyond froyo/2.2.
************************************************************
modify following files.
external/clearsilver/java-jni/Android.mk
external/clearsilver/util/Android.mk
external/clearsilver/cgi/Android.mk
external/clearsilver/cs/Android.mk
Find all lines of
LOCAL_CFLAGS += -m64
or
LOCAL_LDFLAGS += -m64
Change then with
LOCAL_CFLAGS += -m32
or
LOCAL_LDFLAGS += -m32

Need also change all lines in build/core/main.mk
ifneq (64,$(findstring 64,$(build_arch)))
to
ifneq (i686,$(findstring i686,$(build_arch)))
too.

ERROR#2
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] Error 1

With file
frameworks/base/libs/utils/Android.mk
Change the line:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
To:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

ERROR#3
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
: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

To fix this, refer to this patch.
https://github.com/CyanogenMod/android_build/commit/e9cbfa60c8dd60d04570d8bf7bd0d54a4304baf5
It will patch line 61 in /build/core/combo/HOST_linux-x86.mk as following.
-HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0


-----------------------------------



----------------------------------------



저작자 표시 비영리 변경 금지
신고

'Android 개발 > 팁 / 활용정보' 카테고리의 다른 글

android memory leak 해결  (0) 2014.03.10
JellyBean 4.2.2  (0) 2013.04.16
android 2.3 build  (0) 2012.11.20
anr 로그 /data/anr/traces.txt  (0) 2012.08.08
갤럭시 넥서스 루팅  (0) 2011.12.28
android emulator 저장소 늘리기  (0) 2011.10.30
Trackback 0 And Comment 0