Build the android Source Code compiling environment and compile Common Errors

Source: Internet
Author: User

1. Install Ubuntu 12.04
You can choose to use wubi for installation.

2. Install Python

3. Install JDK
Update the software library:
Sudo add-Apt-repository "Deb http://archive.canonical.com/lucid partner"
Sudo apt-Get update
Download JDK:
Download the sun-java6-jdk or execute the command: sudo apt-Get install sun-java6-jdk using the new software package manager
Modify the current JDK version: sudo Update-alternatives -- config Java

4. install required components
To set up your development environment, install the following required packages:
Run the command: sudo apt-Get install Git-core GnuPG flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

For building froyo or an older release on a 64-bit system, several other packages are necessary to establish a 32-bit Build Environment:
Run the command: sudo apt-Get install gcc-multilib g ++-multilib libc6-i386 libc6-dev-i386

5. install required Libraries
Go to the new software package manager, check the lib32z1-dev, zlib-bin, and install.

6. Android compilation requires installation of MTD-utils (the program cannot be upgraded, using the specified version of The mtd-utils_20090606-1_amd64.deb)
Force installation: sudo dpkg-I file name
This component is used to create an ubi file system.

7. Install the GCC compiler
Version 4.4.5 has been installed by default.

8. Install the cross-compilation tool arm-Linux-GCC (the default Pao configuration is that the source code is placed under the project in the main folder, and the arm-Linux-GCC is placed under the tools of the project)
A. Extract the arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz and execute the command:
Tar xvzf arm-linux-gcc-4.5.1-v6-vfp-20101103.tgz-C home/Administrator/project/tools/
CP-r home/Administrator/project/tools/opt/friendlyarm/toolschain/4.5.1/home/Administrator/project/tools/arm-linux-4.5.1/
Rm-RF home/Administrator/project/tools/OPT
B. Set environment variables (use ":" To separate multiple variables ):
Sudo gedit/etc/profile
Add: Path = $ path:/home/Administrator/project/tools/arm-linux-4.5.1/bin at the end
C. Log On again and run: Arm-Linux-GCC -- V to test whether the installation is successful.

9. handle errors
When ubuntu12.04 (64-bit) compiles the android2.3 source code, various problems are encountered. Either missing or missing. These problems and solutions are listed for your reference.

Error:
/Usr/include/GNU/stubs. h: 7: 27: Error: GNU/stubs-32.h: no such file or directory
Make: *** [out/host/linux-x86/obj/executables/acp_intermediates/ACP. O] Error 1

Solution:
Sudo apt-Get install libc6-dev-i386

Error:
Make: *** [out/host/linux-x86/obj/executables/acp_intermediates/ACP] Error 1

Solution:
Sudo apt-Get install g ++-multilib

Error:
External/clearsilver/cgi. C: 22: Fatal error: zlib. h: no such file or directory
Compilation terminated.
Make: *** [out/host/linux-x86/obj/shared_libraries/libneo_cgi_intermediates/cgi. O] Error 1

Solution:
Sudo apt-Get install zlib1g-dev

Error:
/Usr/bin/ld: cannot find-LZ
Collect2: LD returned 1 exit status
Make: *** [out/host/linux-x86/obj/executables/aapt_intermediates/aapt] Error 1

Solution:
Sudo apt-Get install lib32z1-dev

Error:
Bison-D-O out/host/linux-x86/obj/executables/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
/Bin/Bash: bison: Command not found
Make: *** [out/host/linux-x86/obj/executables/aidl_intermediates/aidl_language_y.cpp] Error 127

Solution:
Sudo apt-Get install bison

Error:
LEX: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/Bin/Bash: Flex: Command not found
Make: *** [out/host/linux-x86/obj/executables/aidl_intermediates/aidl_language_l.cpp] Error 127

Solution:
Sudo apt-Get install flex

Error:
/Usr/bin/ld: cannot find-lncurses
Collect2: LD returned 1 exit status
Make: *** [out/host/linux-x86/obj/executables/adb_intermediates/ADB] Error 1

Solution:
Sudo apt-Get install lib32ncurses5-dev

Error:
Prebuilt/linux-x86/SDL/include/SDL/sdl_syswm.h: 55: Fatal error: X11/xlib. h: no such file or directory
Compilation terminated.
Make: *** [out/host/linux-x86/obj/executables/emulator_intermediates/Android/main-common.o] Error 1

Solution:
Sudo apt-Get install libx11-dev

Error:
SH: gperf: not found
Calling gperf failed: 32512 at./makeprop. pl line 96.
Make: *** [out/target/product/generic/obj/static_libraries/libwebcore_intermediates/WebCore/CSS/csspropertynames. H] Error 25
Make: *** deleting file 'out/target/product/generic/obj/static_libraries/libwebcore_intermediates/WebCore/CSS/csspropertynames. H'

Solution:
Sudo apt-Get install gperf

Error:
Build/CORE/Java. mk: 9: *** bin: Target Java module does not define any source or resource files. Stop.

Solution:

Delete the bin folder under the root directory of the source code. This folder is created when eclipse is imported.

Problem

Host sharedlib: libgles_cm_translator (Out/host/linux-x86/obj/lib/libgles_cm_translator.so)
/Usr/bin/ld: Skipping incompatible/usr/lib64/libgl. So when searching for-lgl
/Usr/bin/ld: cannot find-lglcollect2: LD returns 1
Make: *** [out/host/linux-x86/obj/lib/libgles_cm_translator.so] Error 1
Make: *** waiting for unfinished jobs ....

Solution

Sudo Yum install Mesa-libgl-devel

Problem

/Usr/bin/ld: Skipping incompatible/usr/lib64/libx11.so when searching for-lx11
/Usr/bin/ld: cannot find-lx11
Collect2: LD returns 1
Make: *** [out/host/linux-x86/obj/lib/libopenglrender. So] Error 1
Make: *** waiting for unfinished jobs ....

Solution

Yum install libX11-devel.i686

Problem

// Usrusr // Binbin // ldld: skippingskipping incompatibleincompatible // usrusr // lib64lib64 // libgl. solibgl. So Whenwhen searchingsearching forfor-lgllgl

// Usrusr // Binbin // ldld: cannotcannot findfind-lgllgl

Collect2: collect2: LD returns 1ld and returns 1

Make: *** [out/host/linux-x86/obj/lib/libgles_cm_translator.so] Error 1
Make: *** waiting for unfinished jobs ....
Make: *** [out/host/linux-x86/obj/lib/libegl_translator.so] Error 1
Solution

Sudo Yum install libgle. i686 libgle. x86_64 libgle-devel.i686 libgle-devel.x86_64 Yum install mesa-libGL-devel.i686

Compiling 32-bit app on 64-bit, cannot find-lx11

You need the header files, which are provided-devPackages, and not in the library packages themselves. So, try installing
libx11-dev. That shoshould fix this particle build error, though you may get similar errors about other libraries (and then you can install their
-devPackages .)

Even though these packages provide header files rather than binaries, and in general header files account for all supported ubuntures through the use of Preprocessor macros, nonetheless
-devPackages in Ubuntu tend to be architecture-specific, and this is the case
libx11-dev(As can be seen
Here by expanding a release and finding.debPackages listed
libx11-devIn that release ). since your Ubuntu system is 64-bit and you're compiling a 32-bit program which must link against the 32-bit version of the library, you'll probably need to install the 32-bit version
libx11-dev. If you're installingapt-getOr
aptitude
, You can specify that by indicatinglibx11-dev:i386As the package to install (since
Multarch is supported and being used ).

Http://packages.ubuntu.com/is a good resource for finding the name of
-devPackage corresponding to a library package. It's not always the library package's name immediately followed
-dev; Sometimes version numbers present in the library package name, especially after
-, AreAbsentIn the name of the corresponding-devPackage.

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.