10

I am trying to build casablanca, like they say on their page. Because I have gcc-4.8.1 installed using CXX=gcc-4.8 is not ok, so I have removed it doing just:

cmake .. -DCMAKE_BUILD_TYPE=Release

It creates the files and when I do make I am getting these errors:

Scanning dependencies of target casablanca
[  1%] Building CXX object src/CMakeFiles/casablanca.dir/streams/linux/fileio_linux.cpp.o
/tmp/ccoWLl81.s: Assembler messages:
/tmp/ccoWLl81.s:97: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:188: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:298: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:310: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:322: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:334: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:371: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:494: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:508: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:522: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:536: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:550: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:2028: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:2057: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:2086: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:3975: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:6186: Error: expecting string instruction after `rep'
/tmp/ccoWLl81.s:10355: Error: expecting string instruction after `rep'
make[2]: *** [src/CMakeFiles/casablanca.dir/streams/linux/fileio_linux.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/casablanca.dir/all] Error 2
make: *** [all] Error 2

Have anyone met this problem? Is it because of gcc4.8.1? How to fix it?

thedarkside ofthemoon
  • 2,041
  • 4
  • 26
  • 44

2 Answers2

15

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.

Details are here:

https://gcc.gnu.org/ml/gcc-help/2011-03/msg00286.html

The fix is to update your binutils so that you get a newer version of an assembler which accepts this instruction.

jtlim
  • 3,001
  • 1
  • 14
  • 14
  • This answer fixed the same error on a recent Amazon EC2 CentOS box (3.4.37-40.44.amzn1.x86_64). 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. – Tim Croydon Sep 29 '15 at 19:32
  • 2
    For CentOS6, I had to do `sudo yum install devtoolset-2-binutils-devel` – MarkHu Mar 16 '17 at 20:58
4
sudo yum update binutils

---> Package binutils.x86_64 0:2.22.52.0.1-10.36.amzn1 will be updated

---> Package binutils.x86_64 0:2.23.52.0.1-30.64.amzn1 will be an update

BuffK
  • 819
  • 12
  • 15