在ubuntu 14.04 编译android 2.3.1 错误解决办法

首先必须降低gcc版本:

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

?

?

################ 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

?

问题三
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: declarations in dependent base ‘fst::VectorFstBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >‘ are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: use ‘this->SetState‘ instead
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: error:?‘SetState‘ was not declared in this scope, and no declarations were found by argument-dependent?lookup at the point of instantiation [-fpermissive]
SetState(cache_first_state_id_, cache_first_state_);

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

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

此方法是我找的别人对于4.0版本源码问题的解决方法,我用在了2.3上,没有出现问题

dalvik_system_Zygote.c:191:19: error: storage size of ‘rlim‘ isn‘t known

解决办法
添加头文件#include <sys/resource.h>到以下文件
dalvik/vm/native/dalvik_system_Zygote.cpp?

?

<command-line>:0:0: error:?"_FORTIFY_SOURCE" redefined?[-Werror]

解决办法
gcc和g++版本太高了
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
sudo rm -rf /usr/bin/gcc /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

?

Can‘t locate Switch.pm in @INC (you may need to install the Switch module) (@INC

?contains: external/webkit/WebCore/bindings/scripts /etc/perl /usr/local/lib/per

l/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p

erl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Web

Core/dom/make_names.pl line 38.

BEGIN failed--compilation aborted at external/webkit/WebCore/dom/make_names.pl l

ine 38.

Can‘t locate Switch.pm in @INC (you may need to install the Switch module) (@INC

?contains: external/webkit/WebCore/bindings/scripts /etc/perl /usr/local/lib/per

l/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p

erl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Web

Core/dom/make_names.pl line 38.

BEGIN failed--compilation aborted at external/webkit/WebCore/dom/make_names.pl l

ine 38.

?

解决方法是安装perl的switch库:

[plain]?view plaincopy

  1. sudo?apt-get?install?libswitch-perl??
时间: 2024-12-25 10:21:13

在ubuntu 14.04 编译android 2.3.1 错误解决办法的相关文章

Ubuntu 14.04 编译 Android 4.2.2 for Tiny4412

. . . . . 在学校里是用 Redhat 6.4 编译的 Android 4.2.2 很顺利,把源码包拷贝到笔记本上的 Ubuntu 14.04 上再编译遭遇了各种坑,所以便有了这篇博客记录解决每一个坑的过程.所幸这些坑解决起来还不算复杂,稍微 Google 一下就找到了解决方案. 1.首先是安装 JDK 和 arm-linux-gcc 工具链,这两步只是解压缩之后配置环境变量就行了,所以这里就不再赘述了. 注意 JDK 必须采用 1.6 版本的,据说 android 4.x 都需要使用标

[原]Ubuntu 14.04编译Android Kernel

如何编译android kernel参考官方文档:https://source.android.com/source/building-kernels.html 在Ubuntu 14.04上编译android kernel也没有遇到什么很难的问题.主要分以下几个步骤: 首先查看emulator的cpu型号: adb shell [email protected]:/ # cat /proc/cpuinfo Processor : ARMv7 Processor rev 0 (v7l)BogoMI

Ubuntu(64位)编译Android源码常见错误解决办法

2013年07月10日 14:47:27 阅读数:1239 错误: /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1 解决: sudo apt-get install libc6-dev-i386 错误: make: *** [out/h

ubuntu 14.04 编译opencv-3.4.2 报错: /usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `.bss&#39; can not be used when making a shared object; recompile with -fPIC

ubuntu 14.04 编译opencv-3.4.2 报错解决: 错误信息:/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC/usr/local/lib/libavformat.a: error adding symbols:

ubuntu 14.04编译安装xen4.4总结

1. 安装环境 操作系统:ubuntu14.04 xen版本:xen4.4 2. 依赖包的安装 在安装xen之前先进行依赖包的安装,在不停得尝试之后,总结出以下需要安装的依赖包. suso apt-get install gcc make binutils zlib1g-dev python-dev sudo apt-get install libncurses5-dev libcurl4-openssl-dev libx11-dev sudo apt-get install uuid-dev

Ubuntu 14.04 设置Android开发环境

伸展树模版真的好长好长... cut a b c:把第a-1个数伸展到根节点,把第b+1个数伸展到a的右子树,然后把ch[ch[root][1][0]]拿掉,放在剩下的树的第c个节点下. flip a b:把第a-1个数伸展到根节点,把第b+1个数伸展到a的右子树,然后翻转ch[ch[root][1][0]]: 由于会出现操作两边的情况,所以加了两个-1节点. 注意: 1,输出的时候要注意空格和换行. 2,在拿掉子树的时候要注意push_up(); #include<stdio.h> #inc

【转】Ubuntu 上编译Android出现cannot find -lstdc++解决办法

[转]Ubuntu 上编译Android出现cannot find -lstdc++解决办法 在Ubuntu 12.04 x86_64机器上编译Android出现下面错误,是因为找不到32bit的libstdc++.so库. /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++ /usr/bin/ld: skipping incom

Ubuntu使用adb连接android手机失败unknown的解决办法

Ubuntu下通过USB数据线连接G11手机后,adb可能无法识别到设备.按照一下步骤可以解决此问题. 1.在terminal下面输入 lsusb [email protected]:~$ lsusb Bus 001 Device 002: ID 8087:8008 Intel Corp. Bus 002 Device 002: ID 8087:8000 Intel Corp. Bus 003 Device 048: ID 17ef:7435 Lenovo Bus 003 Device 002:

ubuntu 14.04搭建android编译环境

按照我的文章:http://blog.csdn.net/zangcf/article/details/23566999在ubuntu 14.04上搭建android编译环境,编译过程会出以下两个错误: 1,Can't locateSwitch.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