Wednesday, October 19, 2011

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 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

8 comments:

Unknown said...

Thanks a lot dude, u saved me!
"Need also change all lines in build/core/main.mk
ifneq (64,$(findstring 64,$(build_arch)))
to
ifneq (i686,$(findstring i686,$(build_arch)))
too." - I couldn't find this line

Anonymous said...

do the following

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

ifneq ($(filter 1.6%,$(java_version)),)
LOCAL_CFLAGS += -m64
LOCAL_LDFLAGS += -m64
endif

Aniruddh Chitre said...

This post is very helpful. However, there is a small typo. In the fix for Error # 2 the following change is required

-fpermissive

instead of

–fpermissive

in case someone copies the line directly.

xiao said...

Many thanks to Aniruddh Chitre for pointing out the typo!
I have corrected it.

Anonymous said...

Tons of thanks!!!!!!!!

ark cloth shirt said...

this mini game is terrible, break the targets wasn't much better but i would still rather have that. You did a really good job though i could never get that much lol

eu4 console commands said...

5:39-I like this version of Peach. It's not much different than what she wore in Mario Superstar Baseball, and is more practical for a battle to not be wearing a dress.

Low-carb hi-protein chicken|15 High-Protein Low-Carb Dinner Recipes said...

Failed to resolve: com.android.support:appcompat-v7:25.0.2
install Repositry and sync project
show in file
show in project structure dialog

Sir ye problem arhi hai me insall pr click kr rha hun pr kuch responce nhi horha i mean kuch changing nhi arha hai. plz make a video about this error