Original URL: http://blog.csdn.net/flydream0/article/details/7046612
For more information on how to download Android4.0 source, please refer to my other article:
http://blog.csdn.net/flydream0/article/details/7036156
3 Start compiling
3.1 Initializing the environment
$ source Build/envsetup.sh
3.2 Selecting a target
$ Lunch Full-eng
The following hints will probably reappear:
============================================
Platform_version_codename=rel
platform_version=2.3.3
Target_product=full
Target_build_variant=eng
Target_simulator=false
Target_build_type=release
target_build_apps=
Target_arch=arm
Host_arch=x86
Host_os=linux
Host_build_type=release
Build_id=gri40
============================================
3.3 Compiling the source code
$ make-j4
The following tips will probably appear:
============================================
Platform_version_codename=rel
platform_version=2.3.3
Target_product=full
Target_build_variant=eng
Target_simulator=false
Target_build_type=release
target_build_apps=
Target_arch=arm
Host_arch=x86
Host_os=linux
Host_build_type=release
Build_id=gri40
============================================
Checking Build Tools Versions ...
...
It will be compiled for a long time, but the compilation process will not be smooth sailing, if your OS is 32-bit Ubuntu 11.10, the following error may occur:
Question 1:
Phenomenon:
<command-line>:0:0: Error: "_fortify_source" redefined [-werror]
<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
Reason:
The compilation error here is due to Ubuntu 11.10 using GCC4.6.1.
Workaround:
Compile with the gcc4.4.6 version.
Question 2:
Phenomenon:
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
External/oprofile/libpp/format_output.h:94:22:error:reference ' counts ' c-fpermissiveannot be declared ' mutable ' [- Fpermissive]
Host C + +: liboprofile_pp <= external/oprofile/libpp/callgraph_container.cpp
Make: * * * [OUT/HOST/LINUX-X86/OBJ/STATIC_LIBRARIES/LIBOPROFILE_PP_INTERMEDIATES/ARRANGE_PROFILES.O] Error 1
Make: * * * waiting for unfinished jobs ....
Solve:
Compile with the gcc4.4.6 version.
The GCC version of Ubuntu 11.10 is 4.6.1, the version is too high, error compiling Android, to change the GCC version to 4.4.6, 4.5 The version is said to be possible, but has not tried.
The GCC-V command allows you to discover the GCC library under the/usr/lib/gcc/i686-linux-gnu directory, which has various versions of the GCC libraries currently supported by the system. There are no 4.4 directories in this directory before GCC 4.4 is installed, and after installing GCC 4.4 The directory will be 4.4 more, and there are various corresponding library files in the 4.4 directory.
The best way to install GCC 4.4 under the Ubuntu 32bit system is to use only the following two commands, no additional commands are required, or compile-time errors may occur.
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
After loading in the/usr/bin directory
$ ls-l gcc*
lrwxrwxrwx 1 root root 7 2011-10-29 09:11 gcc--gcc-4.6
-rwxr-xr-x 1 root root 224544 2011-10-06 05:47 gcc-4.4
-rwxr-xr-x 1 root root 302104 2011-09-17 05:43 gcc-4.6
To find that GCC is linked to gcc-4.6, you need to change it to link to gcc-4.4:
sudo mv gcc Gcc.bak
sudo ln-s gcc-4.4 gcc
Similarly
Ls-l g++*
lrwxrwxrwx 1 root root 7 2011-08-14 15:17 g++ g++-4.6
-rwxr-xr-x 1 root root 228640 2011-10-06 05:45 g++-4.4
-rwxr-xr-x 1 root root 306200 2011-09-17 05:39 g++-4.6
You need to change the g++ link to g++-4.4:
/usr/bin$ sudo mv g++ g++.bak
/usr/bin$sudo ln-s g++-4.4 g++
View gcc and g++ version numbers again:
Gcc-v
g++-V
Displays the GCC version 4.4.6, which indicates that the GCC 4.4 installation was successful.
Test:
Compiled Android, starting from 2011-10-29 23:58, to 2011-10-30 01:42 compile complete, no errors. This verifies that the GCC 4.4 is installed correctly and verifies that the Android file is incompatible with the higher version of GCC.
The compilation process took about an hour.
When done, as shown:
3.4 Run
$emulator
Note: Android4.0 source default download is not included in the kernel source code, about the Android kernel source download and compilation, please refer to my other blog post:
http://blog.csdn.net/flydream0/article/details/7070392
"Turn" how to compile the Ubuntu11.10 (32-bit) Android4.0 source code (graphics)