The debugging code I used is the code you suggested that toadicus apply in th 2nd, 4th, and 6th posts of this thread. You can see the exact code I applied from the patch I attached in my last post, debug_serialization.patch.
I just did about 30 - 40 freeorion compiles to see what breaks it compiling, here are my results:
I got freeorion to continue past serialization and into the game with the bare minimum cmake options of:
The following cmake adjustments will make freeorion crash with the 'unregistered class' error with respect to the base, above:
1. using -DBUILD_DEBUG=0 instead. I notice that all this effectively does is add -DNDEBUG to the compiler
2. remove the boost hack code from SerializeUniverseExports.ipp [and put BOOST_CLASS_EXPORT(System)] in its place
3. refactoring System to StarSystem and removing the boost hack code in SerializeUniverseExports.ipp
4. gcc optimize flags (-O1, -O2, -O3, -Os) added with -DCMAKE_CXX_FLAGS:STRING="<someflagshere>"
More information on my optimization tests. Might be useful. Might not be.
Most of my time compiling was spent narrowing down the gcc flags. I started with a base set, set by my distribution for RPM packaging:
Code: Select all
-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing
I narrowed it down to -O2. and then found the other optimizations would fail. -O0 worked just fine.
I decided to do a bisect test of all the -O1 optimizations returned by:
Code: Select all
c++ -Q -O1 --help=optimizers |grep enabled
The following flags were returned:
Code: Select all
-falign-loops -fargument-alias -fasynchronous-unwind-tables -fbranch-count-reg -fcommon -fcprop-registers -fdce -fdefer-pop -fdse -fearly-inlining -fgcse-lm -fguess-branch-probability -fif-conversion -fif-conversion2 -finline-functions-called-once -fipa-pure-const -fipa-reference -fivopts -fjump-tables -fmath-errno -fmerge-constants -fmove-loop-invariants -fomit-frame-pointer -fpeephole -frename-registers -fsched-interblock -fsched-spec -fsched-stalled-insns-dep -fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types -ftoplevel-reorder -ftrapping-math -ftree-ccp -ftree-ch -ftree-copy-prop -ftree-copyrename -ftree-cselim -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-sra -ftree-switch-conversion -ftree-ter -ftree-vect-loop-version -funit-at-a-time -fvar-tracking -fvect-cost-model -fweb
I then added all of these to cmake with -DCMAKE_CXX_FLAGS:STRING= and compiled. The funny thing is: freeorion ran without crashing. Which I don't understand. Is there some difference between the addition of these flags and "-O1".
These are my findings so far. I was hoping to narrow it down to a few flags, but my last test left me confused.
I hope some of this is useful.
q