Casablanca: Assembly error gcc 4.8.1 on linux centos

thedarkside ofthemoon picture thedarkside ofthemoon · May 9, 2014 · Viewed 8.9k times · Source

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?

Answer

jtlim picture jtlim · Jul 8, 2014

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.