Android2.3 compilation in Ubuntu

Source: Internet
Author: User

This is an old topic. After all, it has been a long time since 2.3 was released. Many people have done the same job, and many xdjm blog posts their compilation process, to help everyone. However, the most amazing thing in the world is that everyone's happiness is the same. Unfortunately, there are indeed different differences. Here we will show all the cool and cool ways we met during compilation, we hope to share our discussions and make progress together.

The entire compilation process can be summarized into several problems to solve:

1 ),Set up a singing scene
: Select an appropriate version of the operating system for android2.3 Compilation

2 ),Collect food
: Synchronize the 2.3 source code, install and compile required libraries, and complete necessary environment variable settings.

3 ),Compile
: The compilation process of up to an hour requires us to deal with all kinds of errors that may occur at any time and try our best to solve them. This is a long way to go.

4 ),Success
: Everyone shakes hands to celebrate

I will describe my gingerbread compilation journey from the above four aspects.

 

1,Set up a singing scene
:

I only want to talk about my platform selection trip. My system has been using ubuntu9.04 since I joined the company. Apart from the occasional failure of the USB keyboard driver, during the development process, the system has been relatively hard. Although many versions of ubuntu have been updated during this period, I only love 9.04. Time flies, and a peaceful life is finally broken by the release of Google's android2.3. The project needs to be compiled by me. I have heard that the benevolent brother in Google is unfriendly, the Ubuntu version is relatively high during development of 2.3. However, at first I tried to use 9.04 directly, but the system directly sent the following error to me:

Prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ARM-Eabi-GCC:/lib/tls/i686/cmov/libc. so.6: Version 'glibc _ 100' not found (required by prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ARM-Eabi-GCC)
Prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ARM-Eabi-GCC:/lib/tls/i686/cmov/libc. so.6: Version 'glibc _ 100' not found (required by prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ARM-Eabi-GCC)

I tried to upgrade the library a few times, but it seems that it cannot be upgraded. I heard XD say that the library needs a later version of ubuntu. It's all right. The project needs to be king, if I don't find it, I have to endure it. I have to seal up the 9.04 dust and go up to ubuntu10.10.

 

2,Collect food
:

1) download android2.3 source code

To this place: http://source.android.com/source/download.html
Take a closer look at "installing repo", "initializing a repo client", and "getting the files" in three parts. Just do it. It takes some time to start Source Code Synchronization After running: repo sync in the last step "getting the files.

2) install required Libraries

Also to this place: http://source.android.com/source/download.html
Take a closer look at the content in the "setting up your machine" section "Ubuntu Linux (64bit)" and follow it. Note the following:

(1) android2.3 is named gingerbread, so the updated Java package is java6

(2) When Java 6 is updated, execute the statement: sudo add-Apt-repository "Deb-Src http://archive.canonical.com/ubuntu lucid partner" may report an error, tell you that this thing is invalid or anything else. You don't need to worry about it, it's just a floating cloud.

(3) execute the command: sudo apt-Get install Git-core GnuPG flex bison gperf build-essential zip
Curl zlib1g-dev gcc-multilib g ++-multilib libc6-dev-i386
Lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev
Lib32readline5-dev lib32z-dev, it may be reported that some of the libraries can not be found, directly find the libraries that can not be deleted from the command can be deleted, after the compilation encountered, then the specific problem of specific treatment.

3) environment variable settings

Run the command: Export android_java_home = $ java_home to prevent compilation times.The error "Run-Java-tool" is missing.

 

3,Compile
:

First, read the "Building the code" section carefully at the previous link and follow the instructions. When you run lunch, the following options are output:

You're building on Linux
Lunch menu... pick a combo:
1. Full-Eng
2. full_x86-eng
3. Simulator
4. full_passion-userdebug
5. full_crespo-userdebug

Select 1. The following is a summary of the errors that I encountered during the execution of make and the corresponding solutions are provided:

1), checking build Tools versions...
Build/CORE/main. MK: 76: **************************************** ********************
Build/CORE/Main. mk: 77: You are attempting to build on a 32-bit system.
Build/CORE/Main. mk: 78: only 64-bit build environments are supported beyond froyo/2.2.
Build/CORE/main. MK: 79: **************************************** ********************
Build/CORE/Main. mk: 80: *** stop. Stop.

The cause of this error is that, by default, the build/CORE/main file defines android2.3 compilation on a 64bit system. The solution is to set ~ Comment out 81 lines.

2)/bin/Bash: bison: The command cannot be found.
Checking build Tools versions...
**************************************** ********************
You are attempting to build with the incorrect version
Of javac.
 
Your version is:/bin/Bash: javac: The command cannot be found.
The correct version is 1.6.

This error occurs because it is not performed.Search for grain rings
2), follow these steps.

3), host sharedlib: libneo_cgi (Out/host/linux-x86/obj/lib/libneo_cgi.so)
/Usr/bin/ld: Skipping incompatible/usr/lib/GCC/i686-linux-gnu/4.4.5/.../../libz. So when searching for-LZ
/Usr/bin/ld: Skipping incompatible/usr/lib/GCC/i686-linux-gnu/4.4.5/.../../libz. A when searching for-LZ
/Usr/bin/ld: Skipping incompatible // usr/lib/libz. So when searching for-LZ
/Usr/bin/ld: Skipping incompatible // usr/lib/libz. A when searching for-LZ
/Usr/bin/ld: cannot find-LZ
Collect2: LD returned 1 exit status

The cause of this error is that the version of libz library is incorrect. In ubuntu10.10, the 32-bit library is installed by default, while 64-bit library is required by default when libneo_cgi.so is compiled in Android, modify the following files:

External/clearsilver/cgi/Android. mk
External/clearsilver/Java-JNI/Android. mk
External/clearsilver/util/Android. mk
External/clearsilver/CS/Android. m

In these. mk files

Local_cflags + =-M64
Local_ldflags + =-M64

Change all

Local_cflags + =-M32
Local_ldflags + =-M32

4), cannot find-LXXX

All errors similar to this encountered during compilation are missing libraries such as libxxx. The solution is:

First, use the command: APT-cache search XXX for database search

Then, find the libraries such as libxxx-Dev for installation. The command is sudo apt-Get install libxxx-Dev.

Finally, execute make.

 

4,Success

Memories of the past are painful and happy. The process is tortuous and the results are very good. The compiled results are stored in the out directory of the android2.3 source code root directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.