Page 1 of 1

Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 11:23 am
by o01eg
When I try to compile the freeorion I get error:
$ LANG="en_US.UTF-8" make
[ 40%] Built target core_static
Scanning dependencies of target parse_static
[ 41%] Building CXX object CMakeFiles/parse_static.dir/parse/EffectParser.cpp.o
c++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <http://bugs.gentoo.org/> for instructions.
make[2]: *** [CMakeFiles/parse_static.dir/parse/EffectParser.cpp.o] Error 1
make[1]: *** [CMakeFiles/parse_static.dir/all] Error 2
make: *** [all] Error 2
gcc 4.5.3
boost 1.48.0
GG and freeorion from trunk [rev 5153]en_US.UTF-8

Re: Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 12:39 pm
by Geoff the Medio
How much RAM do you have? The parsers use a bunch of Boost templates and tend to use quite a lot of memory to compile.

I also build (on Windows) against Boost 1.47, so there might be an issue specific to 1.48.

Re: Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 12:55 pm
by o01eg
Geoff the Medio wrote:How much RAM do you have? The parsers use a bunch of Boost templates and tend to use quite a lot of memory to compile.

I also build (on Windows) against Boost 1.47, so there might be an issue specific to 1.48.
I've 6 GB RAM and 6 GB swap but I'm not sure that compiler get all memory.

Re: Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 8:00 pm
by raptor
I can confirm GCC (in my case: 4.6.2) segfaults on compiling here for 0.4.1. I have compiled on two different Linux machines, both x86_64. One had 4GB RAM (4 threads), the other 12 GB (8 threads).

Edit: I forgot to mention that I'm using boost 1.49.0 headers.

Re: Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 10:15 pm
by Geoff the Medio
Do any of the other parser cpp files crash the compiler if compiled individually? For that matter, does EffectParser.cpp crash if compiled on its own, rather than as part of a whole-project build?

If it's just that file and it always crashes, I can try splitting it up similar to the Condition parsers.

Re: Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 10:50 pm
by raptor
All other parse compilation units completed. Only EffectParser.cpp.o slowly fills up all remaining RAM until gcc crashes..

Re: Compiler segfaults on EffectPaser.cpp

Posted: Sun Aug 19, 2012 11:00 pm
by raptor
I did some more tests...

I don't believe it is a RAM issue anymore. Swapping out optimizations:
-O3 fails
-O2 fails
-O1 compiles
-g compiles

Re: Compiler segfaults on EffectPaser.cpp

Posted: Mon Aug 20, 2012 3:18 am
by raptor
It looks like EffectsParser.cpp also caused a compiler segfault in freeorion 0.4.0 about 50% of the time. I just looked at the packaging logs when building the RPMs for openSUSE and it frequently failed on that file with a GCC segfault (OOM). It only succeeded a few times when server loads was low and it could use loads of memory.

Re: Compiler segfaults on EffectPaser.cpp

Posted: Mon Aug 20, 2012 8:02 am
by Geoff the Medio
I've split the effect parser into two source files in SVN. Let me know whether that helps the compile finish...

Re: Compiler segfaults on EffectPaser.cpp

Posted: Mon Aug 20, 2012 9:24 am
by o01eg
Thanks. Freeorion successfully compiled. But it crashes if I use rus_stringtable.txt and shows artifacts around text: viewtopic.php?f=9&t=6165

Re: Compiler segfaults on EffectPaser.cpp

Posted: Mon Aug 20, 2012 10:17 am
by Geoff the Medio
The issue with font artifacts is extensively discussed. Most recently here: viewtopic.php?f=24&t=6753 and here: viewtopic.php?f=25&t=6715

I'm not aware of any crashes specifically with a different stringtable. You should probably make a separate thread about that.

Re: Compiler segfaults on EffectPaser.cpp

Posted: Tue Aug 21, 2012 6:07 am
by raptor
I have back-ported the fix to patch against 0.4.1. See attached.

[The extension diff has been deactivated and can no longer be displayed.]