Compile the Android source code fatal error solutionwords 1506 read 17447 comments 0 likes 3
I'm sure you and I are studying the Android kernel's friends after a long wait for the source download, the joy of getting the source code to start compiling. However, during the compilation process, there will be the same as the download of a variety of irregularities. Here I recorded a bit of my compilation process of all the problems, if there are omissions, welcome friends to point out.
The following are the required steps and actions that are documented by the normal compilation process, and the issues that you may encounter are described later.
Step One: Initialize the compilation environment
First go to the directory where the Android source code is located, then execute the following command on the Linux terminal to complete the initialization of the compilation:
# source build/envsetup.sh
Envsetup.sh is a Linux script file that is primarily used to initialize some of the compiler commands, such as M,cgrep and so on. After executing the envsetup.sh command, you can see that the terminal outputs the following information:
including device/samsung/maguro/vendorsetup.sh including device/samsung/tuna/vendorsetup.sh including device/ti/panda/vendorsetup.sh including sdk/bash_completion/adb.bash
A write shell function is defined in the Envsetup script. After we have executed Envsetup with the souce command, we can execute these functions on the Linux terminal. You can execute the help command to view the commands defined in the envsetup.sh script.
Step Two: Select the target
This uses the lunch command to set the compilation target, which defaults to Full-eng. The command is as follows:
# lunch
You can see the terminal output as follows:
You‘re building on Linux Lunch menu... pick a combo: 1. full-eng 2. full_x86-eng 3. vbox_x86-eng 4. full_maguro-userdebug 5. full_tuna-userdebug 6. full_panda-eng Which would you like? [full-eng]
You can select a target at this time by default.
Step three: compiling Android source code
#make
Fatal error Analysis:
The 1.oracle Java Development Kit is out to 1.8, but compiling Android is still JDK1.6 .... Here friends need to be aware that your JDK version is not 1.6, and it is not possible to compile.
Some of the tools may not be installed during the period and you will need to follow the prompts to install the appropriate software:
(1) Tip:
/usr/bin/ld: cannot find zlib 1 make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] 错误 1 .make: *** 正在等待未完成的任务.... .true [email protected]virtual-machine:~/android/bin/android_source#
Workaround: This means that some of the necessary software in the system is not installed and can be installed by Apt-get install. Where the Zlib toolkit name is not zlib, but Zlib1g-dev, namely:
sudo apt-get install zlib1g-dev
You can complete the installation.
(2) Tip:
/usr/bin/ld: cannot find -lncurses 1 make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] 错误 1 make: *** 正在等待未完成的任务.... true [email protected]virtual-machine:~/android/bin/android_source
Workaround: Install the libncurses5-dev:i386 can be done ~ ~ as follows:
# apt-get install libncurses5-dev:i386
(3) Tip:
as errors make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1 make: *** 正在等待未完成的任务.... [email protected]virtual-machine:~/android/bin/android_source#
Workaround:
gedit build/core/combo/HOST_linux-x86.mk
Where the host_global_cflags variable is found. Modify its value to: host_global_cflags+=-u_forttfy_source-d_forttfy_source=0 run again.
(4) Tip:
platform_types.h:12:22: 致命错误: X11/Xlib.h:没有那个文件或目录 编译中断。 make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/main.o] 错误 1 make: *** 正在等待未完成的任务.... [email protected]virtual-machine:~/android/bin/android_source#
Workaround: From the error prompt can be clearly seen, is missing X11 file, it is a matter of course to install first, the command is as follows:
# apt-get install x11-dev
# (5) Tip:
致命错误: GL/glx.h:没有那个文件或目录
Workaround: Install the GL/GLX.HF command as follows:
sudo apt-get install libgl1-mesa-dev
(6) Tip:
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] 错误 1 make: *** 正在等待未完成的任务.... [email protected]:~/android/bin/android_source#
Workaround:
$ vim frameworks/compile/slang/Android.mk
Remove the last-werror of the Local_cflags_for_slang line:
Local_cflags_for_slang: =-wno-sign-promo-wall-wno-unused-parameter-werror becomes:
Local_cflags_for_slang: =-wno-sign-promo-wall-wno-unused-parameter
(7) Tip:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] 错误 1
Workaround:
There is a need to modify the GCC and g++ versions to version 4.4, but the default is typically 4.6. So we need to download 4.4 and link the G++/GCC instruction to version 4.4. As follows:
install gcc-4.4 sudo apt-get install g++-4.4
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.
After loading in the/usr/bin directory
-l gcc*
lrwxrwxrwx1 root root72011-10-2909:GCC-gcc-4.6.-rwxr-xr-x1 root root2245442011-10-0605:gcc-4.4-rwxr-xr-x1 root root3021042011-09-1705:gcc-4.6 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-< Span class= "Hljs-number" >09-17 05: 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
The same way to modify g++:
ls-l g++*lrwxrwxrwx 1 root root 7 2011-08-14 15:17 g++, G++-4.6-rwxr-xr-x 1 root root Span class= "Hljs-number" >228640 2011-10- 06 05:45 g++- 4.4-rwxr-xr-x 1 root root 306200 Span class= "Hljs-number" >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 GCC version 4.4.6, indicating that the GCC 4.4 installation was successful
Compile the Android source code fatal error solution