android编译错误

1、/usr/bin/ld: cannot find -lz

 编译的时候出现"/usr/bin/ld: cannot find -lz"错误,需要安装zlib-dev这个包,在线安装命令为:apt-get install zlib1g-dev。或者:yum install zlib-devel。如果需要管理员权限,建议在上述命令前加sudo。

2、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

解决办法:

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

批改以下语句

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 ¥(TOOL_CFLAGS)为
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 ¥(TOOL_CFLAGS) –fpermissive

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

 

Check this error this morning,solution as following words

http://blog.sina.com.cn/s/blog_643e838601015ngx.html

                 from external/mesa3d/src/glsl/loop_analysis.h:29,


<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
 <built-in>:0:0: note: this is the location of the previous definition
 cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

解决方法:

修改源码目录下/build/core/combo/HOST_linux-x86.mk文件:

将以下语句

HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0

修改为

HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 ATTENTION: There is a SPACE between the -U_FORTIFY_SOURCE and -D_FORTIFY_SOURCE

4、在ubuntu12.04 X64位系统上编译linux内核是出现下列错误

.......

menubox.c:(.text+0x4b1): undefined reference to `wrefresh' collect2: ld returned 1 exit status make[1]: *** [scripts/kconfig/mconf] Error 1 make: *** [menuconfig] Error 2

解决办法:sudo apt-get install libncurses5 libncurses5-dev

5、found tag add-resources where item is expected

出现这种错误一般是拼写语法错误,检测你出错误的行,对单词进行拼写检测看是否有写错。

6、

<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
此处编译错误是由于ubuntu 12.04采用了GCC4.6.3导致的。
解决方法:
修改源码目录下/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、付费专栏及课程。

余额充值