1、编译种错误提示:

arm-none-linux-gnueabi-gcc: directory: No such file or directory
arm-none-linux-gnueabi-gcc: directory": No such file or directory
<command-line>:0:16: warning: missing terminating " character

解决方案:

https://github.com/Pivosgroup/buildroot-linux-kernel/commit/1524a2dc8bfbee683384996f434a2a991416c1df

修改drivers/amlogic/mali/Makefile.common 和 Makefile
将:-qv exported 改为:-Eqv "exported|Unversioned directory"

2、编译中错误提示:

build/core/prebuilt.mk:143: *** recipe commences before first target, stop

原因可能是 linux make (可执行程序) 的版本不对, make -version 可查版本,尽量安装开发者要求的make 版本。比较老的如itop的板子就需要3.81版本的make。

make的安装方法:

直接下载源码,安装上即可。

3、 有可能gcc版本太高导致不能编译android源码:

如itop的班子就需要gcc 4.4的版本,高版本的gcc可能会出现编译问题,替换方法:

sudo apt-get install gcc-4.4 g++-4.4
cd /usr/bin
sudo ln -s gcc-4.4 gcc
sudo ln -s g++-4.4 g++

以下是编译Android 4.0.3的常见错误,这些错误的解决办法收录自互联网。

Google group有个专门的Android Building组,有兴趣的可以加入。

有转载这里的也有添加的。

################# Fix 1 ##########################

Error:

frameworks/base/include/utils/KeyedVector.h:193:31:
note: declarations in dependent base
‘android::KeyedVector<android::String8, android::sp<AaptDir>
>’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead

make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1

Fix:
vi frameworks/base/tools/aapt/Android.mk

Add '-fpermissive' to line 31:
LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

################## Fix 2 ##########################

Error:

frameworks/base/include/utils/KeyedVector.h:193:31:
error: ‘indexOfKey’ was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]

frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations
in dependent base ‘android::KeyedVector<android::String8,
android::wp<android::AssetManager::SharedZip> >’ are not found
by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/AssetManager.o] Error 1

Fix:
vi frameworks/base/libs/utils/Android.mk

Add '-fpermissive' to line 64:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

################## Fix 3 ##########################

Error:
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11: note: use ‘this->SetState’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1

Fix:
cd external/srec
wget "https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff"
patch -p1 < 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
rm -f 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
cd ../..

################## Fix 3.1 ##########################

Error:
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
host C: parseStringTest <= external/srec/tools/parseStringTest/parseStringTest.c
<命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror]
frameworks/base/tools/obbtool/Main.cpp:1:0: 附注: 这是先前定义的位置


make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1

Fix:

vi build/core/combo/HOST_linux-x86.mk  line56
Add  -U_FORTIFY_SOURCE
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
########################ADD ERROR##################################

I started getting this error while compiling CyanogenMod 9 (Android 4.0.x) last week:

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 <sys/resource.h>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
@@ -19,6 +19,7 @@
*/
#include "Dalvik.h"
#include "native/InternalNativePriv.h"
+#include <sys/resource.h> #include
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 7)


################## Fix 4 ##########################

Error:
development/tools/emulator/opengl/host/tools/emugen/main.cpp:79:9: error: ‘optind’ was not declared in this scope
development/tools/emulator/opengl/host/tools/emugen/main.cpp:92:45: error: ‘optind’ was not declared in this scope
make: *** [out/host/linux-x86/obj/EXECUTABLES/emugen_intermediates/main.o] Error 1

Fix:
vi development/tools/emulator/opengl/host/tools/emugen/main.cpp

Add '#include <getopt.h>' to list of includes:
#include <getopt.h>

################## Fix 5 ##########################

Error:
host C++: liboprofile_pp <= external/oprofile/libpp/arrange_profiles.cpp
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] Error 1

Fix:
vi external/oprofile/libpp/format_output.h

Remove 'mutable' from 'mutable counts_t & counts;' on line 94:
counts_t & counts;

################## Fix 6 ##########################

Error:
development/tools/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp:345:65:   required from here

frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’
was not declared in this scope, and no declarations were found by
argument-dependent lookup at the point of instantiation [-fpermissive]

frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations
in dependent base ‘android::KeyedVector<unsigned int,
ShaderData*>’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libOpenglCodecCommon_intermediates/GLSharedGroup.o] Error 1

Fix:
vi development/tools/emulator/opengl/Android.mk

Add '-fpermissive' to line 25:
EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive

################## Fix 7 ##########################

Error:
/usr/bin/ld: note: 'XInitThreads' is defined in DSO /lib/libX11.so.6 so try adding it to the linker command line
/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1

Fix:
vi development/tools/emulator/opengl/host/renderer/Android.mk

Add new entry 'LOCAL_LDLIBS += -lX11' after line 6 as shown:
LOCAL_SRC_FILES := main.cpp
LOCAL_CFLAGS    += -O0 -g
LOCAL_LDLIBS += -lX11

#ifeq ($(HOST_OS),windows)
#LOCAL_LDLIBS += -lws2_32

################## Fix 8 ##########################

Error:
external/llvm/include/llvm/ADT/PointerUnion.h:56:10: error: enumeral
mismatch in conditional expression:
‘llvm::PointerLikeTypeTraits<llvm::PointerUnion<clang::Stmt*,
const clang::Type*> >::<anonymous enum>’ vs
‘llvm::PointerLikeTypeTraits<clang::ObjCInterfaceDecl*>::<anonymous

enum>’ [-Werror]
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs.o] Error 1

Fix:
vi frameworks/compile/slang/Android.mk

Remove '-Werror' from line 22:
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter

################## Fix 9 ##########################

Error:
frameworks/base/libs/rs/rsFont.cpp:224:76:   required from here

frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’
was not declared in this scope, and no declarations were found by
argument-dependent lookup at the point of instantiation [-fpermissive]

frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations
in dependent base ‘android::KeyedVector<unsigned int,
android::renderscript::Font::CachedGlyphInfo*>’ are not found by
unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libRS_intermediates/rsFont.o] Error 1

Fix:
vi frameworks/base/libs/rs/Android.mk

Add '-fpermissive' to line 183
LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable -fpermissive

################## Fix 10 #########################

Error:
external/mesa3d/src/glsl/linker.cpp:1394:49: error: expected primary-expression before ‘,’ token
......
external/mesa3d/src/glsl/linker.cpp:1734:59: error: ‘offsetof’ was not declared in this scope
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1

Fix:
vi external/mesa3d/src/glsl/linker.cpp

Add '#include <stddef.h>' to list of includes as shown: 
#include <climits>
#include <stddef.h>
#include <pixelflinger2/pixelflinger2_interface.h>

################## Fix 11 #########################

Error:
external/gtest/src/../include/gtest/gtest-param-test.h:287:58: note:
‘template<class Container>
testing::internal::ParamGenerator<typename Container::value_type>
testing::ValuesIn(const Container&)’ declared here, later in the
translation unit
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] Error 1

Two fixes required:
1)
vi external/gtest/src/Android.mk

Add '-fpermissive' to lines 52 and 70 (both lines contain same info)
LOCAL_CFLAGS += -O0 -fpermissive

2)
vi external/gtest/include/gtest/internal/gtest-param-util.h

Add '#include <stddef.h>' to list of includes as shown:
#include <vector>
#include <cstddef>
#include <gtest/internal/gtest-port.h>

################## Fix 12 #########################
Error:

host Executable: test-librsloader (out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader)
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o):在函数‘PrintStackTrace’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:219:对‘dladdr’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Unix/Signals.inc:231:对‘dladdr’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates
/libLLVMSupport.a(Threading.o):在函数‘llvm::llvm_execute_on_thread(void
(*)(void*), void*, unsigned int)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:96:对‘pthread_create’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:100:对‘pthread_join’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Threading.cpp:91:对‘pthread_attr_setstacksize’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates
/libLLVMSupport.a(Mutex.o):在函数‘llvm::sys::MutexImpl::MutexImpl(bool)’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:69:对‘pthread_mutexattr_init’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:75:对‘pthread_mutexattr_settype’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:80:对‘pthread_mutexattr_setpshared’未定义的引用
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:89:对‘pthread_mutexattr_destroy’未定义的引用
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates
/libLLVMSupport.a(Mutex.o):在函数‘llvm::sys::MutexImpl::tryacquire()’中:
/home/crow/works/Android_src/external/llvm/lib/Support/Mutex.cpp:143:对‘pthread_mutex_trylock’未定义的引用
collect2: 错误: ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 错误 1

Fix:

$vi external/llvm/llvm-host-build.mk +
LOCAL_LDLIBS := -lpthread -ldl

################## Fix 13 #########################

error:

g++ selected multilib '32' not installed

安装相应的工具:sudo apt-get install g++-4.4-multilib

################## Fix 14 #########################

error 提示:  mkimage command not found:

安装 uboot 工具:     sudo apt-get install uboot-mkimage,如提示uboot-mkimage被废弃而找不到, 可以用:sudo apt-get install u-boot-tools

android 源码编译中的错误 解决的更多相关文章

  1. jdk/java版本与Android源码编译中的错误

    错误一:javap未指向有效的java版本 Traceback (most recent call last): File "../../base/android/jni_generator ...

  2. 【转】Android 源码编译make的错误处理--不错

    原文网址:http://blog.csdn.net/ithomer/article/details/6977386 Android源码下载:官方下载 或参考android源码下载方式 Android编 ...

  3. Android源码编译make的错误处理

    android源码下载:官方下载 或参考android源码下载方式 Android编译版本: PLATFORM_VERSION=4.0.1(最新Android 4.0.1) OS 操作系统平台: Li ...

  4. Android 源码编译及常见错误及解决方法

    最近要往arm开发板上移植android系统,大大小小的问题遇到了太多太多,都是泪啊.本人初接触嵌入式开发,对问题的根源不是太了解,不过好在每解决一个问题,便记录一下.话不多说,正式罗列问题: hos ...

  5. chrome源码编译常见的错误解决

    最近编译chrome浏览器源码时,下载源码和一般的设置,网络中都有说明,而且一般的说明都是类似的,然后都说编译成功了,但本人没有试成功,碰到常见的2个错误,记录下,不知道大家碰到没有. 1.pytho ...

  6. [Android Pro] Android源码编译之Nexus5真机编译

    reference to : http://blog.csdn.net/liu1075538266/article/details/51272398 1.   前言 在Android安全的研究工作中, ...

  7. 有关android源码编译的几个问题

    项目用到编译环境,与源码有些差异不能照搬,关键是连源码都没编译过,下面基本上是行网上照的各种自学成才的分享,病急乱投医了,都记在下面作为参照吧. 1.验证是否编译正确,在终端执行 emulator & ...

  8. (转)获取android源码时repo的错误

    获取android源码时repo的错误 今天用repo获取android源码:../bin/repo init -u git://android.git.kernel.org/platform/man ...

  9. Android源码编译jar包BUILD_JAVA_LIBRARY 与BUILD_STATIC_JAVA_LIBRARY的区别(二)

    上文简单介绍了BUILD_JAVA_LIBRARY 与BUILD_STATIC_JAVA_LIBRARY编译出来jar包的区别, 那么你如果拿到了一个内容是dex格式的jar包,而你又偏偏需要这个ja ...

随机推荐

  1. C++中变量自动初始化的问题

    C++中有一些变量在如果没有赋初值会被编译器自动赋值为0,但有的变量又不会这样,而得到一个随机数,下面具体讨论一下: 首先看一下C++中的几个存储区:1.栈区:由编译器自动分配释放 ,存放函数的参数值 ...

  2. BZOJ 1000: A+B Problem

    问题:A + B问题 描述:http://acm.wust.edu.cn/problem.php?id=1000&soj=0 代码示例: import java.util.Scanner; p ...

  3. tranform-scale 缩小元素,移上去文字抖动

    元素缩小后,鼠标移上去之后文字会出现抖动, -webkit-transform:scale(0.5); 修复代码如下: *{ -webkit-backface-visibility: hidden; ...

  4. Codeforces Beta Round #9 (Div. 2 Only)D

    短小精悍的代码 dp[i][j] +=dp[k][j-1]*[i-k-1][j-1] i个结点 J层 #include <iostream> #include<cstdio> ...

  5. 查看Linux服务器网络状态

    ifconfig 用来显示所有网络接口的详细情况的,如:ip地址,子网掩码等. ethx是以太网网卡的名称. 配置文件在/etc/sysconfig/network-scripts/ifcfg-eth ...

  6. Oracle的rownum原理和使用(整理几个达人的帖子)

    整理和学习了一下网上高手关于rownum的帖子: 参考资料:  http://tech.ddvip.com/2008-10/122490439383296.html 和 http://tenn.jav ...

  7. bzoj2800

    这题好难,翻了一下波兰文的题解……这好像是当年唯一没人A的题目 首先区间修改不难想到差分,我们令d1=x1,dn+1=-xn,di=xi-xi-1 注意Σdi=0,这样对于[l,r]的修改(比如+a) ...

  8. Android异常之 unable to write jarlist cache file

    异常: android开发调试时候不能运行,出现  unable to write jarlist cache file  错误. 解决方法: 1.找到appcompt文件夹如下的位置.

  9. [反汇编练习] 160个CrackMe之011

    [反汇编练习] 160个CrackMe之011. 本系列文章的目的是从一个没有任何经验的新手的角度(其实就是我自己),一步步尝试将160个CrackMe全部破解,如果可以,通过任何方式写出一个类似于注 ...

  10. 实时通讯库 libre/librem/restund/baresip

    http://www.creytiv.com/ 源码下载 libre Toolkit library for asynchronous network IO with protocol stacks ...