Because the current project needs to modify the Android kernel source code, so I need to start from the Android source code to learn from the compilation.
Here's a look at my compilation environment.
The version of the Ubuntu system I use is 14.04, 64 bit.
GCC version: 4.8.8
The compilation process I was looking at the Google Developer website, and the combination of other people's blog to compile. Compile the process will encounter a lot of problems, here, I would like to summarize some of the problems I encountered, in order to use later when easy to see, but also easy for others to compile Android when the same problem encountered, easy to see.
Issue One: Java version issue
The problem is that the Java version I'm currently using is "1.7" and the correct version is Java SE 1.6, so we need to replace Java.
Workaround:
1: Use the command (because I'm using OPENJDK)
sudo apt-get remove openjdk-7-jre openjdk-7-jdk openjdk-7-jre-headless
2: If you are using a JDK, in order to use it later, first speak the export statement in the global variable using ' # ' comment out.
3: Installing Java SE 1.6
4: After downloading and extracting from official website, configure environment variables to
Issue two: Compilation issues
Workaround:
1: Find Android Source code/frameworks/base/tools/aapt/android.mk file, edit
Find the Local_cflags on line 31st and add the-fpermissive later
2: Find Android Source code frameworks/base/libs/utils/android.mk file, edit
Find the Local_cflags on line 64th and add the-fpermissive later
Question three:
Workaround:
cd"https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff"4-f4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diffcd ../..
Question four:
This question simply adds a "#include" to the dalvik/vm/native/dalvik_system_zygote.cpp.
#include <getopt.h>
Question six:
Workaround:
Add-fpermissive after line 25th in file Development/tools/emulator/opengl/android.mk
Error Seven:
Workaround:
The next line of local_cflags + =-o0-g in the file/development/tools/emulator/opengl/host/renderer/android.mk file is added "LOCAL_LDLIBS + =- LX11 "
Local_path:=$(Call My-dir)# Host renderer process ###########################$(Call emugl-begin-host-executable,emulator_renderer)$(Call Emugl-import,libopenglrender)Local_src_files := Main.cppLocal_cflags+= -O0-GLocal_ldlibs+ =-lx11#ifeq ($ (host_os), Windows)#LOCAL_LDLIBS + =-lws2_32#endif$(Call emugl-End- module)
Error Eight:
Workaround:
Build/core/combo/host_linux-x86.mk the file in the
Host_global_cflags + =-d_fortify_source=0
Replaced by
Host_global_cflags + =-u_fortify_source-d_fortify_source=0
Error Eight:
Workaround:
Remove-werror from Frameworks/compile/slang/android.mk line 22nd in the file
Error Nine:
Workaround:
Add a header file to the file External/llvm/lib/executionengine/jit/intercept.cpp
#define _LARGEFILE64_SOURCE#include <stdlib.h>#include <stdio.h>#include <string.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <errno.h>
Error Ten:
Workaround:
Installing the Perl Switch Library
sudo apt-get install Libswitch-perl
Error 11:
EXTERNAL/OPROFILE/LIBPP/FORMAT_OUTPUT.H:94:22: Error: Reference ' counts ' cannot be declared ' Muta
EXTERNAL/OPROFILE/LIBPP/FORMAT_OUTPUT.H:94:22: Error: Reference ' counts ' cannot be declared ' Muta ...
For this scenario, you need to modify the external/oprofile/libpp/format_output.h:94 line
Mutable counts_t & counts for
Counts_t & Counts
Error 12:
Workaround:
Modify File External/llvm/llvm-host-build.mk
Add Local_ldlibs: =-LPTHREAD-LDL
Error 13:
external/gtest/src/. /include/gtest/gtest-param-test.h:1185:28:required from here
external/gtest/src/. /include/gtest/internal/gtest-param-util-generated.h:77:26:error: ' Valuesin ' is not declared in this scope, and no decl Arations were found by Argument-dependent lookup at the point of instantiation [-fpermissive]
return Valuesin (array);
Workaround:
Modify all the "local_cflags + =-o0" In the file/external/gtest/src/android.mk to "local_cflags + =-o0-fpermissive"
Error 14:
Make: *
[OUT/HOST/LINUX-X86/OBJ/STATIC_LIBRARIES/LIBGTEST_HOST_INTERMEDIATES/GTEST-ALL.O] Error 1
Workaround:
Gedit external/gtest/include/gtest/internal/gtest-param-util.h Add:
#include <cstddef>
Copyright NOTICE: Hello, reprint please leave my blog address, thank you
Compilation problem summary of Android source code