Here is some information about downloading android source tree and
build it in Fedora 16.  After having initial difficulties, I could
able to build them in Fedora 16, with the help of various contributors
which I found in the internet. I am summarizing the issues which I
encountered, provide solutions to the issues and add reference to the
original contributors for wherever possible.

------------
Build Environment:

Linux rev – 3.3.1-3.fc16.i686.PAE (32 bit - Fedora 16)
2 GB RAM
3 GB Swap space

Android revision - android-4.0.1_r1
Android Build:  for Simulator
$ lunch full-eng

------------
If you are working behind the proxy, don't forgot to setup the proxy
setting in yum.conf

Append the following lines to the yum config file '/etc/yum.conf'
proxy=http://<Proxy IP>:<PORT>
proxy_username=<System Name>
proxy_password=<System Passwd>

------------
Getting necessary packages for compile

yum groupinstall "Development Tools"
yum install java-1.6.0-openjdk kernel-devel git gnupg flex bison gperf
zip curl zlib-devel glibc-devel glibc-devel.i686 ncurses-devel.i686
glib-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686
libX11-devel.i686 libXrender.i686 libXrandr.i686 mesa-libGL-devel.i686
readline-devel.i686 arm-gp2x-linux-gcc-c++ python-markdown xmlto
libxslt

Ref:
http://hblok.net/blog/posts/2012/01/06/building-android-on-fedora/

------------
Installing & configuring Java 6 SDK from Sun

Download java6 sdk from sun's site
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html

$ chmod a+x jdk-6u31-linux-i586-rpm.bin
$ ./jdk-6u31-linux-i586-rpm.bin
$ alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/
java 20000
$ update-alternatives --config java

This step need to repeat for java other components

## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/
javaws 20000
update-alternatives --config javaws

## Install javac only if you installed JDK (Java Development Kit)
package ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac
20000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
update-alternatives --config javac
update-alternatives --config jar

alternatives --install /usr/bin/javadoc javadoc /usr/java/latest/bin/
javadoc 20000
update-alternatives --config javadoc

Ref:
http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

------------
The make 3.82 version has some incompatibilities with Android
building.

$ yum downgrade make --nogpgcheck --releasever=13

Ref: http://rootzwiki.com/topic/8037-compile-android-on-fedora-1516-by-xoomdev/

------------
If you are behind the proxy, use 'export' command to enable the
downloading. This is explained in the below link.
Downloading the source tree & compile: Please follow the instruction
in the following links
http://source.android.com/source/downloading.html

Also make sure that the latest SDK also
http://developer.android.com/sdk/installing.html
http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development

------------
Build errors & Fix

------------
Buld Error 1:
Java version mismatch error

Solution:
Modify main.mk to solve this error
$ vim build/core/main.mk
Commented the line 131 -- #$(error stop)
------------
Buld Error 2:
Can't locate Switch.pm in @INC (@INC contains: /usr/local/lib/perl5 /
usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/
vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at external/webkit/
Source/WebCore/make-hash-tools.pl line 23.

Solution:
yum install perl-Switch

Ref: 
http://stackoverflow.com/questions/8362944/android-build-errer-begin-failed-compilation-aborted-at-external-webkit-webcor
------------
Buld Error 3:
Compiling Android for gits stops with error:
external/oprofile/libpp/format_output.h:94:22: error: reference
‘counts’ cannot be declared ‘mutable’ [-fpermissive]

Fix/Work-around:
-               mutable counts_t & counts;
+               counts_t & counts;

Ref: http://code.google.com/p/android/issues/detail?id=22003
------------
Buld Error 4:
Compiling Android for git, it stops with error:
external/gtest/src/../include/gtest/internal/gtest-param-util.h:
122:11: error: ‘ptrdiff_t’ does not name a type

Work around:
Modify - external/gtest/include/gtest/internal/gtest-param-util.h
 #include <vector>
+#include <cstddef>
 #include <gtest/internal/gtest-port.h>
$ vim external/gtest/include/gtest/internal/gtest-param-util.h

Ref:  http://code.google.com/p/android/issues/detail?id=22005
------------
Buld Error 5:
host Executable: emulator_renderer (out/host/linux-x86/obj/EXECUTABLES/
emulator_renderer_intermediates/emulator_renderer)
/usr/bin/ld: out/host/linux-x86/obj/EXECUTABLES/
emulator_renderer_intermediates/main.o: undefined reference to symbol
'XInitThreads'
/usr/bin/ld: note: 'XInitThreads' is defined in DSO /usr/lib/libX11.so.
6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

Fix:
Add the following line at   development/tools/emulator/opengl/host/
renderer/Android.mk:
LOCAL_LDLIBS += -lX11

$ vim development/tools/emulator/opengl/host/renderer/Android.mk

Ref: 
http://groups.google.com/group/android-building/browse_thread/thread/833b0386f996f7de?pli=1
------------
Buld Error 6:
Compiling Android from git (master) stops with error:
frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error:
variable ‘ParamName’ set but not used [-Werror=unused-but-set-
variable]
cc1plus: all warnings being treated as errors

Fix/Workaround:
frameworks/compile/slang/Android.mk
-local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
-Werror
+local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-
parameter

$ vim frameworks/compile/slang/Android.mk

Ref: http://code.google.com/p/android/issues/detail?id=22006
------------
Buld Error 7:
target Dex: core-hostdex
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
make: *** [out/host/common/obj/JAVA_LIBRARIES/core-
hostdex_intermediates/classes.dex] Error 1
make: *** Waiting for unfinished jobs....

$ vim build/core/definitions.mk

Modified line number 1526 as
$(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx1024M) \
------------

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to