#514 gcc-4.6.2 crashes while compiling EffectParser.cpp

Latest Subversion
Sven Eden

gcc-4.6.2 crashes with a segfault when compiling EffectParser.cpp. The file expands to 275,320 lines after preprocessing. The include files do not seem to be a problem, as both GiGi and Boost (the ones that expand the file most) compile with gcc-4.6.2 and the very same FLAGS.

However, I found out that two includes are no necessary, and created a patch to remove them. Without those the file expands to 193,246 lines and compiles fine.

Note: If Boost really "boosts" and not "snails" your build, use it, it is a very great project. But please keep in mind that it is a monster bloating everything into oblivion if its include files are used too much. Whenever possible one should write a couple of lines of own code instead of including dozens of thousands of othe lines.


  • Sven Eden

    Sven Eden - 2012-04-27
    • milestone: --> Latest Subversion
  • Sven Eden

    Sven Eden - 2012-04-27

    Added proper Group, sorry, I didn't see this until the "click" was done. :(

  • Geoff Topping

    Geoff Topping - 2012-04-27

    If you have any specific suggestions for things from boost that should be replaced, please provide them. In this case - a quite complicated text parsing system - it would take more than "a couple of lines of own code" to replace the functionality from boost::spirit.

  • Sven Eden

    Sven Eden - 2012-04-27

    Sorry, off topic. I did not meant to suggest to replace boost in general, but to hint to only use its includes when they are really needed. Obviously, in EffectParser.cpp, they are. But neither "../universe/ValueRef.h" nor <GG/ReportParseError.h>, and those two add over 80,000 lines. Includes from Includes matter as well.

    On topic: I just wanted to let you know that EffectParser.cpp does not compile with gcc-4.6.2 unless the provided patch is applied. That's it. Feel free to change it, apply it, ignore it or do whatever you please. ;-)

    Here is the error, but it doesn't say much: (Just for reference)

    [ 50%] Building CXX object CMakeFiles/parse_static.dir/parse/EffectParser.cpp.o
    x86_64-pc-linux-gnu-g++: internal compiler error: Segmentation fault (program cc1plus)
    make[2]: *** [CMakeFiles/parse_static.dir/parse/EffectParser.cpp.o] Error 4
    make[1]: *** [CMakeFiles/parse_static.dir/all] Error 2
    make: *** [all] Error 2

    This is the line count of the file:
    ~/tmp/FreeOrion $ LC_ALL=C wc -l EffectParser*.cpp
    544 EffectParser.cpp
    275320 EffectParser_preprocessed.cpp
    193246 EffectParser_preprocessed_after.cpp

    Compilation was done with this command:

    g++ -DFREEORION_LINUX -DENABLE_BINRELOC -DADOBE_STD_SERIALIZATION -DNDEBUG -march=native -pipe -ggdb -O2 -O2 -fno-strict-aliasing -Wno-deprecated -I/usr/include/boost-1_48 -IFreeOrion -IFreeOrion/log4cpp -IFreeOrion/UI/ogdf -Wall -Wno-parentheses -O3 -DNDEBUG -pthread -D_REENTRANT -o EffectParser.cpp.o -c EffectParser.cpp

  • Geoff Topping

    Geoff Topping - 2012-07-09
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks