android-4.0.1_r1 源码编译



jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ source build/envsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/samsung/tuna/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$  lunch 
full-eng               full_maguro-userdebug  full_panda-eng         full_tuna-userdebug    full_x86-eng           vbox_x86-eng
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$  lunch 
full-eng               full_maguro-userdebug  full_panda-eng         full_tuna-userdebug    full_x86-eng           vbox_x86-eng
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$  lunch full-eng 

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================

jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ make -
-                           --environment-overrides     -k                          --no-print-directory        -S
--always-make               -f                          --keep-going                -o                          --silent
--assume-new                --file                      -l                          --old-file                  --stop
--assume-old                -h                          --load-average              -p                          -t
-b                          --help                      -m                          --print-data-base           --touch
-B                          -i                          --makefile                  --print-directory           -v
-C                          -I                          --max-load                  -q                          --version
-d                          --ignore-errors             -n                          --question                  -w
--debug                     --include-dir               --new-file                  --quiet                     -W
--directory                 -j                          --no-builtin-rules          -r                          --warn-undefined-variables
--dry-run                   --jobs                      --no-builtin-variables      -R                          --what-if
-e                          --just-print                --no-keep-goind             --recon                     

jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ cd /usr/bin/
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ ls -al gcc*
lrwxrwxrwx 1 root root      7  8月  5 12:48 gcc -> gcc-4.6
-rwxr-xr-x 1 root root 306200  4月 16  2012 gcc-4.6
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$  ls -l g++*
lrwxrwxrwx 1 root root      7  3月 14  2012 g++ -> g++-4.6
-rwxr-xr-x 1 root root 310296  4月 16  2012 g++-4.6
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo apt-get install gcc-4.4
[sudo] password for jianguoliao: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic-pae
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  cpp-4.4 gcc-4.4-base
Suggested packages:
  gcc-4.4-locales gcc-4.4-multilib libmudflap0-4.4-dev gcc-4.4-doc libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2 libppl7
The following NEW packages will be installed:
  cpp-4.4 gcc-4.4 gcc-4.4-base
0 upgraded, 3 newly installed, 0 to remove and 21 not upgraded.
Need to get 6,697 kB of archives.
After this operation, 13.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main gcc-4.4-base i386 4.4.7-1ubuntu2 [12.0 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ precise/main cpp-4.4 i386 4.4.7-1ubuntu2 [3,606 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu/ precise/main gcc-4.4 i386 4.4.7-1ubuntu2 [3,079 kB]                                                
Fetched 6,697 kB in 24s (276 kB/s)                                                                                                            
Selecting previously unselected package gcc-4.4-base.
(Reading database ... 180229 files and directories currently installed.)
Unpacking gcc-4.4-base (from .../gcc-4.4-base_4.4.7-1ubuntu2_i386.deb) ...
Selecting previously unselected package cpp-4.4.
Unpacking cpp-4.4 (from .../cpp-4.4_4.4.7-1ubuntu2_i386.deb) ...
Selecting previously unselected package gcc-4.4.
Unpacking gcc-4.4 (from .../gcc-4.4_4.4.7-1ubuntu2_i386.deb) ...
Processing triggers for man-db ...
Setting up gcc-4.4-base (4.4.7-1ubuntu2) ...
Setting up cpp-4.4 (4.4.7-1ubuntu2) ...
Setting up gcc-4.4 (4.4.7-1ubuntu2) ...
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo apt-get install g++-
g++-4.4                               g++-4.5-multilib                      g++-arm-linux-gnueabi
g++-4.4-arm-linux-gnueabi             g++-4.6                               g++-arm-linux-gnueabihf
g++-4.4-arm-linux-gnueabihf           g++-4.6-arm-linux-gnueabi             g++-mingw-w64
g++-4.4-multilib                      g++-4.6-arm-linux-gnueabihf           g++-mingw-w64-i686
g++-4.5                               g++-4.6-multilib                      g++-mingw-w64-x86-64
g++-4.5-arm-linux-gnueabi             g++-4.6-multilib-arm-linux-gnueabi    g++-multilib
g++-4.5-arm-linux-gnueabihf           g++-4.6-multilib-arm-linux-gnueabihf  
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo apt-get install g++-4.4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-29 linux-headers-3.2.0-29-generic-pae
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libstdc++6-4.4-dev
Suggested packages:
  g++-4.4-multilib gcc-4.4-doc libstdc++6-4.4-dbg libstdc++6-4.4-doc
The following NEW packages will be installed:
  g++-4.4 libstdc++6-4.4-dev
0 upgraded, 2 newly installed, 0 to remove and 21 not upgraded.
Need to get 6,274 kB of archives.
After this operation, 19.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main libstdc++6-4.4-dev i386 4.4.7-1ubuntu2 [1,494 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ precise/main g++-4.4 i386 4.4.7-1ubuntu2 [4,780 kB]
Fetched 6,274 kB in 23s (271 kB/s)                                                                                                            
Selecting previously unselected package libstdc++6-4.4-dev.
(Reading database ... 180316 files and directories currently installed.)
Unpacking libstdc++6-4.4-dev (from .../libstdc++6-4.4-dev_4.4.7-1ubuntu2_i386.deb) ...
Selecting previously unselected package g++-4.4.
Unpacking g++-4.4 (from .../g++-4.4_4.4.7-1ubuntu2_i386.deb) ...
Processing triggers for man-db ...
Setting up g++-4.4 (4.4.7-1ubuntu2) ...
Setting up libstdc++6-4.4-dev (4.4.7-1ubuntu2) ...
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ 

jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$  ls -l gcc*
lrwxrwxrwx 1 root root      7  8月  5 12:48 gcc -> gcc-4.6
-rwxr-xr-x 1 root root 224544  4月 16  2012 gcc-4.4
-rwxr-xr-x 1 root root 306200  4月 16  2012 gcc-4.6
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo mv gcc gcc.bak
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo ln -s gcc-4.4 gcc
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ ls -l g++*
lrwxrwxrwx 1 root root      7  3月 14  2012 g++ -> g++-4.6
-rwxr-xr-x 1 root root 228640  4月 16  2012 g++-4.4
-rwxr-xr-x 1 root root 310296  4月 16  2012 g++-4.6
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo mv g++ g++.bak
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ sudo ln -s g++-4.4 g++

jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ g++ --version
g++ (Ubuntu/Linaro 4.4.7-1ubuntu2) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ gcc --version
gcc (Ubuntu/Linaro 4.4.7-1ubuntu2) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:/usr/bin$ 

为什么要更改位低版本的g++和gcc因为android编译环境需要,不然会在编译过程中出现如下错误:

<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


jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ make


Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
Install system fs image: out/target/product/generic/system.img
Target ram disk: out/target/product/generic/ramdisk.img
Target userdata fs image: out/target/product/generic/userdata.img
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ 
jianguoliao@jianguoliao-Lenovo-IdeaPad-Y470:~/WORKING_DIRECTORY$ 

android-4.0.1_r1 源码编译_第1张图片



上面是4.0的分支代码

如果是4.3的最新源码,编译则会出现如下错误,建议您安装64位的ubuntu系统,下次我将教你怎么安装,我现在的是32的


ERROR: prebuilts/tools/gcc-sdk/../../gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin/x86_64-linux-ar only run on 64-bit linux
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a] Error 1









你可能感兴趣的:(android-4.0.1_r1 源码编译)