Stockfish gcc-4.8 -flto problem

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Stockfish gcc-4.8 -flto problem

Post by zullil »

My attempt to compile the latest Stockfish code using gcc-4.8.1 on OS X failed as follows:

Code: Select all

g++-mp-4.8 -o stockfish-0702 benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o material.o misc.o movegen.o movepick.o notation.o pawns.o position.o search.o thread.o timeman.o tt.o uci.o ucioption.o  -lpthread  -g -Wall -Wcast-qual -fno-exceptions -fno-rtti  -ansi -pedantic -Wno-long-long -Wextra -Wshadow  -DNDEBUG -O3  -DIS_64BIT -msse -DUSE_BSFQ -flto
evaluate.cpp: In function '_ZN12_GLOBAL__N_114evaluate_spaceIL5Color1EEEiRK8PositionRNS_8EvalInfoE.isra.19':
evaluate.cpp:1070:3: internal compiler error: in lhd_decl_printable_name, at langhooks.c:221
   }
   ^

evaluate.cpp:1070:3: internal compiler error: Abort trap: 6
g++-mp-4.8: internal compiler error: Abort trap: 6 (program lto1)
lto-wrapper: g++-mp-4.8 terminated with signal 6 [Abort trap: 6]
collect2: error: lto-wrapper returned 1 exit status
make[1]: *** [stockfish-0702] Error 1
make: *** [build] Error 2
The "fix" was to remove the -g flag from CXXFLAGS.

Note that both -g and -flto are included by default when building with the gcc and the supplied makefile.

Afterwards, I found this in the online documentation for gcc-4.8.1:
Link-time optimization does not work well with generation of debugging information. Combining -flto with -g is currently experimental and expected to produce wrong results.
Just a heads-up to anyone who might care.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish gcc-4.8 -flto problem

Post by mcostalba »

Thanks. I have pushed a fix.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Stockfish gcc-4.8 -flto problem

Post by zullil »

mcostalba wrote:Thanks. I have pushed a fix.
You're welcome.

By the way, was a mistake made with the most recent commit?

https://github.com/mcostalba/Stockfish/ ... 2e33baad98

The code changes don't seem (to me) related to the summary description.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Stockfish gcc-4.8 -flto problem

Post by mcostalba »

zullil wrote:
mcostalba wrote:Thanks. I have pushed a fix.
You're welcome.

By the way, was a mistake made with the most recent commit?

https://github.com/mcostalba/Stockfish/ ... 2e33baad98

The code changes don't seem (to me) related to the summary description.
Yes, it seem an issue with github. The code is actually already in.

I have hacked a bit a dummy patch to allow people to see it. Should be clear now.