ubuntu11.10 编译android错误 host C++: libutils

本文探讨了在使用Ubuntu 11.10系统时,遇到的Android编译过程中因GCC版本过高导致的问题。通过分析编译命令中的错误提示,最终确定问题源于GCC版本不兼容。文章详细解释了如何解决此问题,即降级GCC版本至4.4,以便顺利完成Android项目的编译。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

看编译命令make showcommands:

 

host C++: libutils <= frameworks/base/libs/utils/RefBase.cpp
g++  -I external/zlib   -I frameworks/base/libs/utils   -I out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates   -I dalvik/libnativehelper/include/nativehelper   -I system/core/include   -I hardware/libhardware/include   -I hardware/libhardware_legacy/include   -I hardware/ril/include   -I dalvik/libnativehelper/include   -I frameworks/base/include   -I frameworks/base/opengl/include   -I frameworks/base/native/include   -I external/skia/include   -I tools/include   -I out/host/linux-x86/obj/include  -c  -fno-exceptions -Wno-multichar -m32 -fPIC -include system/core/include/arch/linux-x86/AndroidConfig.h -D_FORTIFY_SOURCE=0 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -O2 -g -fno-strict-aliasing -DNDEBUG -UDEBUG -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -Wsign-promo -DNDEBUG -UDEBUG   -DLIBUTILS_NATIVE=1      -MD -o out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o frameworks/base/libs/utils/RefBase.cpp

<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]

<built-in>:0:0: note: this is the location of the previous definition

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] Error 1

 

不知到什么错误引起的,折腾了一晚上,最后才明白原来是ubuntu 11.10的gcc 4.6版本太高了,android编译需要gcc 4.4 。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值