I. Introduction:
Recently
I decided to change my linux distro from ubuntu to slackware. The
installation process is nice and smooth. After I install slackware, I
decided to download the android 2.3.3 source and compile myself. I have
done it before in ubuntu 10.04, so I told to myself how hard could it
be. However I was wrong, compiling android in slackware 14 is incredibly
annoying. Most of the problems are caused by gcc and perl version
mismatch. Some people might say, just downgrade/upgrade your gcc/perl
version and it should be fine. I know that, but changing gcc/perl
version in your system might cause some problems and I don't want to
take that risk. (btw, recompile gcc is very time consuming in my
computer. Hardware sucks)
Because
the above reason, I decide to compile the android 2.3.3 without
downgrade any tools and also to write the whole process down to remind
myself how I do it.
II. Environment:
- Linux Distro : Slackware 14 x86_64( with multilib support )
- gcc version : 4.7.1
- make version : 3.82
- perl version : 5.16
- git version : 1.71
- python version : 2.73
Just a clean install of slackware 14.
As for multilib support just check out Alien BOB wiki and follow the instructions that wiki mentioned.
P.S you should at least have >2GB of RAM or the building process may failed.
III. Compiling Steps:
This
post is mostly focus on how to solve the version mismatch problems;
therefore, I will not cover how I setup the build environment in this
post. (Most libraries that required to build android are already
installed by the Slackware 14 clean install)
After
you follow the ASOP instructions and install all the necessary
packages, it is time to type make command. (I highly recommend that use
'make -j1' instead of 'make -j8' )
1. GCC version mismatch:
The
following is an example of how this kind of error message look like and
the general solutions of how to solve this kind of problems. Figure 1
shows how this kind of error message looks like. There are two ways to
solve this kind of problem.
The
first one is add "this->" in front of all the variables that appear
in the error message. However, in the entire building process, you will
be very annoying adding this pointer in front of all the errors.
The
second method is to add "-fpermissive" flag in the makefile. More
precisely add "-fpermissive" to LOCAL_CFLAGS in Android.mk. This method
is more reasonable.
During the whole building process, there are several Android.mk files that need to be modified (adding "-fpermissive" flag)
frameworks/base/tools/aapt/Android.mk
[figure 1] gcc version mismatch error message
[Figure 2] Add "-fpermissive" after the LOCAL_CFLAGS in the Android.mk
2. perl Switch module problem:
Switch.pm
is deprecated in perl 5.16, therefore the solution is simple, patch the
"external/webkit/WebCore/dom/make_names.pl". Figure 4,5,6 show some
modification of this file.
[Figure 3] Can't locate Switch.pm
[Figure 6] delete the "-P" flag from preprocessor
IV. Conclusion:
After the above steps, the building process should be fine and you can see the image file in the out directory.
Just download the file and type:
patch -p1 < patch_file_name.patch
Enjoy :)