Ubuntu 14.04编译 android源码出现问题搜集(持续更新)

    之前编译源码也会出现问题,可是换到 14.04之后还是出现类似的问题,百度上的问题都是转来转去的,并不是自己遇到的问题,结果导致改过来改过去,最后即便解决了也是费了不少时间。于是结合这次编译出现的问题做点记录,同时在以后出现这样的问题更新到这个列表中,方便以后参考。问题如下:
1) [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o] Error 1 
:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
----
compilation terminated.
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Command.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/StringPool.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Package.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o] Error 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Main.o] 错误 1
make: *** 正在等待未完成的任务....
<命令行>:0:0: 警告: “_FORTIFY_SOURCE”重定义 [默认启用]
解决方法:
1、首先安装gcc4.4和g++4.4
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
2、gcc和g++的降级
gcc降级:
sudo rm -rf /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
gcc -v
g++降级
sudo rm -rf /usr/bin/g++
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++
g++ -v

2) [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] Error 1
dalvik/vm/native/dalvik_system_Zygote.cpp: In function ‘int setrlimitsFromArray(ArrayObject*)’:
dalvik/vm/native/dalvik_system_Zygote.cpp:199:19: error: aggregate ‘setrlimitsFromArray(ArrayObject*)::rlimit rlim’ has incomplete type and cannot be defined
     struct rlimit rlim;
                   ^
dalvik/vm/native/dalvik_system_Zygote.cpp:222:43: error: ‘setrlimit’ was not declared in this scope
         err = setrlimit(contents[0], &rlim);
                                           ^
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] Error 1
make: *** Waiting for unfinished jobs....
I’m not sure if it’s due to a recent Arch Linux change or what, but it seems the fix is simply to add #include to dalvik/vm/native/dalvik_system_Zygote.cpp. Here’s a diff:
diff --git a/vm/native/dalvik_system_Zygote.cpp b/vm/native/dalvik_system_Zygote.cpp
index 8224656..f4102e8 100644
--- a/vm/native/dalvik_system_Zygote.cpp
+++ b/vm/native/dalvik_system_Zygote.cpp
  */
 #include "Dalvik.h"
 #include "native/InternalNativePriv.h"
+#include
也就是在dalvik/vm/native/dalvik_system_Zygote.cpp中间增加一个头文件定义#include
3) [out/host/linux-x86/obj/STATIC_LIBRARIES/libext4_utils_intermediates/output_file.o] Error 1 
/usr/include/zlib.h:34: fatal error: zconf.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libext4_utils_intermediates/output_file.o] Error 1
make: *** Waiting for unfinished jobs....
由于系统的文件换了位置, 此时需要将 /usr/include/x86_64-linux-gnu/zconfig.h 拷贝到上级目录,此时编译才通过
将 zconfig.h 拷贝到 /usr/include/ 目录即可
4)  [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp]
以及 Can't locate Switch.pm in @INC ununtu
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.  
make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] Error 2  
make: *** Waiting for unfinished jobs....  
make: *** [out/target/product/mx3/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/platform/ColorData.cpp] Error 2  
target Generated: libwebcore <= external/webkit/Source/WebCore/html/parser/HTMLEntityNames.in  
-->>> sudo apt-get install libswitch-perl 
注意:
【1】由于这是系统文件,不要轻易修改,即便改了解决问题,但是系统更新之后还是会出现那个问题
【2】软件如果下载不要,最好是更新源 

你可能感兴趣的:(Android,系统原理)