ubuntu 11.10 编译android 4.0问题

1、基础环境配置
sudo apt-get install ant ant-optional bison build-essential ca-certificates-java curl flex fusesmb g++-4.4-multilib g++-multilib gcc-4.4-multilib gcc-multilib git-core git-gui gitk gnuit gnupg gperf ia32-libs lib32ncurses5-dev libreadline-gplv2-dev lib32readline-gplv2-dev lib32z1 lib32z1-dev libc6-dev-i386 libesd0-dev libmotif4 libncurses5-dev  libsasl2-modules-gssapi-mit libsdl1.2-dev libx11-dev meld menu tsocks valgrind vim x11proto-core-dev zip zlib1g-dev

2、编译错误
1)
错误日志1
host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] 错误 1
错误日志2
In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: 错误: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
错误日志3
In file included from external/oprofile/pp/opreport.cpp:32:0: external/oprofile/libpp/format_output.h:94:22: 错误: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive] In file included from external/oprofile/libpp/xml_utils.h:15:0,                  from external/oprofile/pp/opreport_options.cpp:26: external/oprofile/libpp/format_output.h:94:22: 错误: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive] 

解决方法:
修改 gedit frameworks/base/libs/utils/Android.mk
将:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
改为:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

修改文件
external/oprofile/libpp/Android.mk
external/oprofile/pp/Android.mk

LOCAL_CFLAGS := $(common_host_cflags)
改为
LOCAL_CFLAGS := $(common_host_cflags) -fpermissive

或者修改 build/core/combo/HOST_linux-x86.mk
给HOST_GLOBAL_CFLAGS加上 -fpermissive

2)链接错误
错误日志1
system/core/libcutils/threads.c:27: undefined reference to ‘pthread_getspecific'
out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_set':
system/core/libcutils/threads.c:36: undefined reference to ’pthread_key_create'
system/core/libcutils/threads.c:44: undefined reference to ‘pthread_setspecific'
collect2: ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] 错误 1
错误日志2
out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_get':
system/core/libcutils/threads.c:27: undefined reference to `pthread_getspecific'
out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): In function `thread_store_set':
system/core/libcutils/threads.c:36: undefined reference to `pthread_key_create'
system/core/libcutils/threads.c:44: undefined reference to `pthread_setspecific'
collect2: true
Generating libraries.cc
python out/host/linux-x86/obj/EXECUTABLES/mksnapshot_intermediates/js2c.py out/host/linux-x86/obj/EXECUTABLES/mksnapshot_intermediates/libraries.cc out/host/linux-x86/obj/EXECUTABLES/mksnapshot_intermediates/libraries-empty.cc CORE external/v8/src/runtime.js external/v8/src/v8natives.js external/v8/src/array.js external/v8/src/string.js external/v8/src/uri.js external/v8/src/math.js external/v8/src/messages.js external/v8/src/apinatives.js external/v8/src/date.js external/v8/src/regexp.js external/v8/src/json.js external/v8/src/mirror-debugger.js external/v8/src/debug-debugger.js external/v8/src/macros.py
ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/localize_intermediates/localize] 错误 1
make: *** 正在等待未完成的任务....
解决方法:
修改make文件
frameworks/base/tools/aapt/Android.mk
frameworks/base/tools/localize/Android.mk
将这几句
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif
改为
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt -lpthread
endif
3)
错误日志
<命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror]
解决方法
修改build/core/combo/HOST_linux-x86.mk
将
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
改为
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值