Error: expecting string instruction after `rep'问题解决

问题:

CentOS 7上编译Fastdfs libfastcommon,出现Error: expecting string instruction after `rep'错误。

[root@localhost libfastcommon-1.0.35]#./make.sh

cc -Wall -D_FILE_OFFSET_BITS=64-D_GNU_SOURCE -g -O3 -c -o hash.o hash.c 

/tmp/ccG7CWvO.s: Assembler messages:

/tmp/ccG7CWvO.s:272: Error: expectingstring instruction after `rep'

/tmp/ccG7CWvO.s:3637: Error: expectingstring instruction after `rep'

/tmp/ccG7CWvO.s:3641: Error: expectingstring instruction after `rep'

/tmp/ccG7CWvO.s:3678: Error: expectingstring instruction after `rep'

/tmp/ccG7CWvO.s:3682: Error: expectingstring instruction after `rep'

/tmp/ccG7CWvO.s:3719: Error: expectingstring instruction after `rep'

 ...

解决:

解决的思路如下,根据jtlim的回答“The problem is that gcc 4.8 is generating "rep; ret" instructions to avoid a performance penalty for AMD chips. Older assemblers detect this as an error.”,该问题应该和GCC编译器有关,又根据Tim Croydon 的提示“Ran yum update binutils which took it to 2.23.52.0.1 and my problem went away. Not sure which version it was before unfortunately. ”,问题可能出在binutils包上。

于是,决定恢复binutils包,CentOS7 本身自带的为binutils-2.23版本,但发现了2.20的老版本。于是,决定删除老版本,恢复自身版本。

使用rpm -e binutils...删除老版本时,会因为被其他包依赖,不能被删除,采取rpm -ivh --force binutils...的方法强制安装2.23版本,然后再删除,就可以成功了。

步骤如下:

1、  查看已经安装的binutils

[root@localhost~]# rpm -qa | grep binutils

devtoolset-3-binutils-2.24-18.el7.x86_64

binutils-2.23.52.0.1-55.el7.x86_64

devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64

binutils-2.20.51.0.2-5.42.el6.x86_64

devtoolset-6-binutils-2.27-10.el7.x86_64

2、删除旧版本的binutils:

[root@localhost~]# rpm -e binutils-2.20.51.0.2-5.42.el6.x86_64

olset-6-binutils-2.27-10.el7.x86_64

 若不能删除,强制用binutils-2.23版本覆盖:

[root@localhost~]# rpm -ivh --force/usr/hfis/Packages/binutils-2.23.52.0.1-55.el7.x86_64.rpm

警告:/usr/hfis/Packages/binutils-2.23.52.0.1-55.el7.x86_64.rpm:头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY

准备中...                         ################################# [100%]

正在升级/安装...

   1:binutils-2.23.52.0.1-55.el7      ################################# [100%]

 

其他2.23以下的版本也都删除掉,删除掉后的样子:

[root@localhost~]# rpm -qa | grep binutils

devtoolset-3-binutils-2.24-18.el7.x86_64

binutils-2.23.52.0.1-55.el7.x86_64

devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64

3、再次编译libfastcommon,OK。

 

参考:

1、thedarkside ofthemoon. Casablanca: Assembly error gcc 4.8.1 on linux centos.https://stackoverflow.com/questions/23561136/casablanca-assembly-error-gcc-4-8-1-on-linux-centos

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值