HOW TO compile android 2.3.5 on Ubuntu 12.04 64bit
====================================================
Last modified by Geunsik Lim (Nick:invain) on
Mar-19-2012
This is simple note to compile Android 2.3.5 on Ubuntu 12.04 beta1
(64bit) successfully.
First of all, refer to
http://source.android.com/source/initializing.html
official website.
And,
http://www.kandroid.org/board/board.php?board=androidsource&command=body&no=81
geunsik@u1204$>
geunsik@u1204$>
sudo apt-get install git-core gnupg flex bison gperf build-essential
\
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \
g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \
libxml2-utils xsltproc zlib1g-dev:i386
I summarized troubleshooting to run "#>repo sync" command successfully
as following contents.
Refer to the below my experience if you have some issues on Ubuntu
12.04 64bit.
geunsik@u1204$>
geunsik@u1204$> cat /etc/profile
# To build android ICS(4.0.X)
#
http://java.sun.com/javase/downloads/previous.jsp
#export JAVA_HOME=/usr/local/jdk1.6.0_29
#export PATH=.:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/account/invain/bin:
$PATH
#export ANDROID_JAVA_HOME=$JAVA_HOME
export NDK_ROOT=/opt/android/android-ndk-r7
export ANDROID_NDK_ROOT=/opt/android/android-ndk-r7
export NDK_PROJECT_PATH=/opt/android/android-ndk-r7/samples/hello-jni
geunsik@u1204$>
geunsik@u1204$>
geunsik@u1204$>
invain@u120464-invain:~$
invain@u120464-invain:~$ cat /proc/cpuinfo | grep CPU
model name : Intel(R) Core(TM) i3-2357M CPU @ 1.30GHz
model name : Intel(R) Core(TM) i3-2357M CPU @ 1.30GHz
model name : Intel(R) Core(TM) i3-2357M CPU @ 1.30GHz
model name : Intel(R) Core(TM) i3-2357M CPU @ 1.30GHz
invain@u120464-invain:~$ free
total used free shared buffers
cached
Mem: 3961564 818924 3142640 0 88412
333816
-/+ buffers/cache: 396696 3564868
Swap: 0 0 0
invain@u120464-invain:~$
invain@u120464-invain:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu precise (development branch)"
invain@u120464-invain:~$
===== *TROUBLESHOOTING: zlib related
================================================
* ERROR :
If you installed ubuntu 12.04 64bit to your pc, run the below command
to
support compress library is called zlib. You need zlib to compile
android
full source successfully.
* HOWTO
geunsik@u1204$> apt-get install lib32z1-dev
===== *TROUBLESHOOTING: -fpermissive related
=========================================
* ERROR :
<built-in>:0:0: note: this is the location of the previous definition
host C++: libutils <= frameworks/base/libs/utils/ZipFileRO.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function 'void
android::RefBase::weakref_type::trackMe(bool, bool)':
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: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/
libutils_intermediates/RefBase.o] Error 1
make: *** Waiting for unfinished jobs....
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by
default]
<built-in>:0:0: note: this is the location of the previous definition
* HOWTO
If you installed ubuntu 12.04 64bit to your pc, you will meet
"-fermissive" error because of incompatibility between gcc 4.6 and
android 2.3.x
run the below command.
geunsik@u1204$> gedit frameworks/base/libs/utils/Android.mk
BEFORE:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
AFTER:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
======== *TROUBLESHOOTING: _FORTIFY_SOURCE related
=====================================
* ERROR :
host C++: post_trace <= sdk/emulator/qtools/trace_reader.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
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/
Main.o] Error 1
make: *** Waiting for unfinished jobs....
true
* HOWTO
geunsik@u1204$> gedit build/core/combo/HOST_linux-x86.mk
BEFORE:
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
AFTER:
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
============================================================================
END.