51armfpga https://passport2.21ic.com/?923073 [收藏] [复制] [RSS]

日志

Android源码编译问题及解决办法汇总

已有 1391 次阅读2014-2-25 13:57 |个人分类:Android系统|系统分类:嵌入式系统| Android

开发环境:Ubuntu11.10

Android版本:2.2


错误一:

build/core/main.mk:73: You are attempting to build on a 32-bit system.

build/core/main.mk:74: Only 64-bit build environments are supported beyond froyo/2.2.

解决办法:

这是因为froyo/2.2默认只支持64-bit

需要进行如下修改即可,将

./external/clearsilver/cgi/Android.mk

./external/clearsilver/java-jni/Android.mk

./external/clearsilver/util/Android.mk

./external/clearsilver/cs/Android.mk

四个文件中的

LOCAL_CFLAGS += -m64

LOCAL_LDFLAGS += -m64

注释掉,或者将“64”换成“32

LOCAL_CFLAGS += -m32

LOCAL_LDFLAGS += -m32

然后,将

./build/core/main.mk 中的

ifneq (64,$(findstring 64,$(build_arch)))

改为:

ifneq (i686,$(findstring i686,$(build_arch)))

错误二:

/bin/bash: flex: command not found

解决办法:

apt-get install flex

错误三:

sh: gperf: not found

解决办法:

sudo apt-get install gperf

错误四:

external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory

解决办法:

sudo apt-get install zlib1g-dev

错误五:

frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing const android::RefBase::weakref_implas thisargument of void android::RefBase::weakref_impl::trackMe(bool, bool)

解决办法:

编辑frameworks/base/libs/utils/Android.mk文件,修改
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) fpermissive

错误六:

host C++: libutils <= frameworks/base/libs/utils/Asset.cpp

g++: error: fpermissive: No such file or directory

解决办法:

$ gedit frameworks/base/libs/utils/Android.mk

将下面一行

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)

改成

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) fpermissive

注意:“-fpermissive”中的“-”为英文输入法中下的“-”,否则编译出错。

错误七:

prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55: fatal error: X11/Xlib.h: No such file or directory

解决办法:

apt-get install libx11-dev


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)