ubuntu 12.04(gcc降级)编译android代码遇到,ubuntu 12.04(gcc降级)编译android代码遇到"_FORTIFY_SOURCE"的解决方法...

一、编译报错

external/yaffs2/yaffs2/yaffs_tagsvalidity.h:23:6: warning: redundant redeclaration of ‘yaffs_InitialiseTags’ [-Wredundant-decls]external/yaffs2/yaffs2/yaffs_guts.h:888:6: note: previous declaration of ‘yaffs_InitialiseTags’ was herehost C: mkyaffs2image <= external/yaffs2/yaffs2/yaffs_tagsvalidity.chost C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]:0:0: note: this is the location of the previous definition:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]:0:0: note: this is the location of the previous definitionIn file included from external/yaffs2/yaffs2/yaffs_tagsvalidity.c:17:0:external/yaffs2/yaffs2/yaffs_tagsvalidity.h:23:6: warning: redundant redeclaration of ‘yaffs_InitialiseTags’ [-Wredundant-decls]external/yaffs2/yaffs2/yaffs_guts.h:888:6: note: previous declaration of ‘yaffs_InitialiseTags’ was herehost C: parseStringTest <= external/srec/tools/parseStringTest/parseStringTest.ccc1plus: all warnings being treated as errorsmake: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1make: *** Waiting for unfinished jobs....host C++: post_trace <= sdk/emulator/qtools/post_trace.cpp:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]:0:0: note: this is the location of the previous definition:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]:0:0: note: this is the location of the previous definition

二、解决方法

问题原因:ubuntu 12.04中的gcc版本为4.6版本过高,需要降级为4.4

操作方法:

1. 查看gcc版本和g++版本

xumingtao@huaserver1:/usr/bin$ ls -l gcc*lrwxrwxrwx 1 root root      7 Aug 30 19:26 gcc -> gcc-4.6-rwxr-xr-x 1 root root 353216 Apr 16 07:37 gcc-4.6

xumingtao@huaserver1:/usr/bin$ ls -l g++*lrwxrwxrwx 1 root root      7 Mar 14 04:05 g++ -> g++-4.6-rwxr-xr-x 1 root root 357312 Apr 16 07:36 g++-4.62. 安装gcc和g++ 4.4版本

sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib

3. 修改gcc链接

sudo mv gcc gcc.baksudo ln -s gcc-4.4 gcc

xumingtao@huaserver1:/usr/bin$ ls -l gcc*lrwxrwxrwx 1 root root      7 Sep  6 10:43 gcc -> gcc-4.4-rwxr-xr-x 1 root root 259232 Apr 16 14:20 gcc-4.4-rwxr-xr-x 1 root root 353216 Apr 16 07:37 gcc-4.6lrwxrwxrwx 1 root root      7 Aug 30 19:26 gcc.bak -> gcc-4.64. 修改g++链接

sudo mv g++ g++.baksudo ln -s g++-4.4 g++

xumingtao@huaserver1:/usr/bin$ ls -l g++*lrwxrwxrwx 1 root root      7 Sep  6 10:45 g++ -> g++-4.4-rwxr-xr-x 1 root root 263328 Apr 16 14:18 g++-4.4-rwxr-xr-x 1 root root 357312 Apr 16 07:36 g++-4.6lrwxrwxrwx 1 root root      7 Mar 14 04:05 g++.bak -> g++-4.6

5.查看gcc和g++版本号

gcc-v

g++-v

三、OK!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值