"Go" Android source code compilation make error handling--good

Source: Internet
Author: User
Tags deprecated

Original URL: http://blog.csdn.net/ithomer/article/details/6977386

android Source download: official download or reference Android source download mode

Android compiled version: platform_version=4.0.1 (latest Android 4.0.1)

OS operating system platform: Linux Yanggang 2.6.35-30-generic #61-ubuntu SMP Tue Oct 15:29:15 UTC (i686 gnu/linux 32bit)

First, let's install some common tools
Curl:
sudo apt-get Install curl

git: sudo apt-get install git

g++: sudo apt-get install g++

Then, make what you need to install

/usr/bin/ld:cannot Find-lz

Host Executable:aapt (OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/AAPT_INTERMEDIATES/AAPT)
/usr/bin/ld:cannot Find-lz
Collect2:ld returned 1 exit status
Make: * * * [OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/AAPT_INTERMEDIATES/AAPT] Error 1
Workaround: sudo apt-get install zlib1g-dev sudo apt-get install Lib64z1-dev

/bin/bash:bison:command not found

Yacc:aidl <= frameworks/base/tools/aidl/aidl_language_y.y
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
Workaround: sudo apt-get install bison

/bin/bash:flex:command not found

out/host/linux-x86/obj/executables/aidl_intermediates/aidl_language_y.cpp:in function ' int yyparse () ':
out/host/linux-x86/obj/executables/aidl_intermediates/aidl_language_y.cpp:1827:warning:deprecated Conversion From string constant to ' char* '
out/host/linux-x86/obj/executables/aidl_intermediates/aidl_language_y.cpp:1970:warning:deprecated Conversion From string constant to ' char* '
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
Workaround: sudo apt-get install Flex

/usr/bin/ld:cannot find-lncurses

Host EXECUTABLE:ADB (OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/ADB_INTERMEDIATES/ADB)
/usr/bin/ld:cannot find-lncurses
Collect2:ld returned 1 exit status
Make: * * * [OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/ADB_INTERMEDIATES/ADB] Error 1

Workaround: sudo apt-get install Libncurses5-dev

Fatal error:gl/glx.h:no such file or directory

Development/tools/emulator/opengl/host/libs/translator/glcommon/gldispatch.cpp:22:fatal Error:gl/glx.h:no Such File or directory
Compilation terminated.
Make: * * * [OUT/HOST/LINUX-X86/OBJ/STATIC_LIBRARIES/LIBGLCOMMON_INTERMEDIATES/GLDISPATCH.O] Error 1

Workaround: sudo apt-get install Libgl1-mesa-dev

Sh:gperf:not found

Target Generated:libwebcore <= external/webkit/source/javascriptcore/create_regex_tables
Generating CSSPropertyNames.h <= csspropertynames.in
Sh:gperf:not found
Calling Gperf failed:32512 at./makeprop.pl Line 140.
Make: * * * [out/target/product/generic/obj/static_libraries/libwebcore_intermediates/source/webcore/css/ CSSPROPERTYNAMES.H] Error 25
Make: * * * Deleting file ' out/target/product/generic/obj/static_libraries/libwebcore_intermediates/source/webcore/ Css/csspropertynames.h '

Workaround: sudo apt-get install Gperf

The above installation can be done with one command:

sudo apt-get install git-core gnupg flex bison gperf build-essential   zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev   libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386   libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos   python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

See: Initializing a Build environment (Android)

Make compile the source error handling:

If the current Java version is higher than the specified version or is not a canonical Java JDK (such as OPENJDK), enter "Java-version" to view the JDK version:

From the discovery, it is true that the OPENJDK-6-JDK is installed by the previous key installation, there are two ways to resolve:

1) Java SDK for configuration specification

Download: Jdk-6u20-linux-i586.bin

Decompression:./jdk-6u20-linux-i586.bin

Copy: MV jdk1.6.0_20/home/homer/eclipse/

Configuration: sudo vi/etc/profile

Export JAVA_HOME=/HOME/HOMER/ECLIPSE/JDK1.6.0_20
Export JRE_HOME=/HOME/HOMER/ECLIPSE/JDK1.6.0_20/JRE
Export classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH

View validation, such as:

2) Uninstall the OPENJDK and reinstall the JDK

A) uninstalling OPENJDK

Click on the "Ubuntu" logo in the top left corner and enter "Ubuntu Software Center" to find software center management

Then, select "Installed" and enter "OpenJDK" to find the installed OPENJDK, such as:

Select "Remove" to uninstall OPENJDK

b) Reinstall the JDK

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"$ sudo apt-get update$ sudo apt-get install sun-java6-jdk

In fact, in addition to the above two solutions, if the current JDK version is the specification of JDK 1.6 or more (such as: jdk1.7.0_05, I default to the JDK version), will also be reported that the correct version of the error.

Carefully analyze the makefile file and discover its dependencies as follows:

Makefile-> build/core/main.mk-> A version of the JDK, script code such as:

From the analysis of the code, it is not difficult to see the "OpenJDK" and "jdk1.7.0_05" version of the compiler does not pass the reason for it ....

(1) If "OpenJDK" is included in "Java-version", then "$ (Shell java-version 2>&1 | Grep-i openjdk) "Filtered" openjdk "will not be empty, naturally it is not equal to the empty, that is, the IFNEQ condition is established, so the" java_version: = "is set to null

(2) If it is (1), java_version is empty, natural output error message; If "Java-version" contains "jdk1.7.0_05" instead of "xx1.6xx", the first line of filtered java_version is also empty, The result also outputs an error message.

Find out the problem, then how to solve it? Knowing the principle, the problem is simple (if you're using "jdk1.7.0_05" and the 1.7 version above)

Modify the ' ^java. *[']1\. 6 [\. "$$" is ' ^java. *[']1\. 7 [\. [$$] '

Finally, compile the Android source code:

Make-j4

Reference recommendation:

Android Source Download (google)

Android Source Building (google)

Initializing a Build environment (Google)

Add yourself:

(1)/usr/bin/ld:can ' t find LZ

/usr/bin/ld:can ' t find Ltinfo

/usr/bin/ld:can ' t find Lncurse

Native Ubuntu is 64-bit, the default installation of Zlib-dev, Libtinfo5-dev, Libncurse5-dev are 64-bit versions, Android source code needs these several libraries for 32-bit system version (very strange!!!). )

namely Lib32zl-dev, Lib32tinfo5-dev, Lib32ncurse5-dev

(2)

Target thumb C + +: Gralloc.goldfish <= development/tools/emulator/opengl/system/gralloc/gralloc.cpp
Development/tools/emulator/opengl/system/gralloc/gralloc.cpp:790:sorry, unimplemented:non-trivial designated Initializers not supported
Development/tools/emulator/opengl/system/gralloc/gralloc.cpp:790:sorry, unimplemented:non-trivial designated Initializers not supported
Development/tools/emulator/opengl/system/gralloc/gralloc.cpp:790:warning:missing initializer for member ' GRALLOC_ Module_t::reserved_proc '
Make: * * * [OUT/TARGET/PRODUCT/GENERIC/OBJ/SHARED_LIBRARIES/GRALLOC.GOLDFISH_INTERMEDIATES/GRALLOC.O] Error 1

C + + initialization chaos sequence

The initialization in the code is the same as the following description
C + + style of disorderly initialization is the same as the C style, but it is more commonly used in C + + code.
eg
struct User Oneuser = {
Name: "Lucy",
Id:10,
Home: "/home/lucy"
};

This way of disorderly ordering in gcc/g++, suffix fame. C can be supported; but the suffix named. CPP is not supported, prompting
Sorry, unimplemented:non-trivial designated initializers not supported

Workaround:
Execute the./build-android in the root directory of the Android source code, not Make-j4

"Go" Android source code compilation make error handling--good

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.