Gcc Bug

Having trouble with the game? Report bugs and problems here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this subforum, you must read the following thread: [ link ]
If you have issues with the iPhone or iPad ports, please visit this thread: [ link ]

Gcc Bug

Postby Dave » April 29th, 2004, 2:52 am

It seems that we have been having alot of trouble with this gcc bug, especially in the Gentoo port of Wesnoth: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12235

The behavior this will cause in Wesnoth is that at the end of a scenario (and perhaps other times), the game will crash.

This bug is claimed to be fixed in 3.3.3, however some reports I have seen seem to indicate it might persist.

The workaround is to not use the -fomit-frame-pointer flag to gcc. Note that -O1 and above turn -fomit-frame-pointer on in gcc.

I strongly recommend all users of Wesnoth compiling with gcc make sure that they avoid the -fomit-frame-pointer switch, as it seems to have a long history of problems related to exception handling.

David
"I made this letter very long, because I did not have the time to make it shorter." -- Blaise Pascal
Dave
Lead Developer
 
Posts: 6950
Joined: August 17th, 2003, 5:07 am
Location: California

Postby Dave » April 29th, 2004, 3:44 pm

Btw the flag you can pass to gcc to disable -fomit-frame-pointer is -fno-omit-frame-pointer

Thanks to yann for the tip!

David
"I made this letter very long, because I did not have the time to make it shorter." -- Blaise Pascal
Dave
Lead Developer
 
Posts: 6950
Joined: August 17th, 2003, 5:07 am
Location: California

Postby jbmesserly » April 29th, 2004, 11:41 pm

Never had this problem with gcc 3.3.3. I run pretty normal CFLAGS:

$grep ^CFLAGS= /etc/make.conf
CFLAGS="-O2 -march=athlon-xp -pipe"

My suggestion to anyone else running Gentoo is to heed the warning found in several ebuilds (this one is from x11-base/xfree):

Recently there has been a lot of stability problem in Gentoo-land. Many
things can be the cause to this, but I believe that it is due to gcc3
still having issues with optimizations, or with it not filtering bad
combinations (protecting the user maybe from themselves) yet.

This can clearly be seen in large builds like glibc, where too aggressive
CFLAGS cause the tests to fail miserbly.

Quote from Nick Jones <carpaski@gentoo.org>, who in my opinion
knows what he is talking about:

People really shouldn't force code-specific options on... It's a
bad idea. The -march options aren't just to look pretty. They enable
options that are sensible (and include sse,mmx,3dnow when apropriate).


The next command strips CFLAGS and CXXFLAGS from nearly all flags. If
you do not like it, comment it, but do not bugreport if you run into
problems.

<azarah@gentoo.org> (13 Oct 2002)
jbmesserly
 

Postby torangan » May 1st, 2004, 9:58 am

It probably will happen mostly to Gentoo user because -fomit-frame-pointer is not implied by any -O? setting for i386 or above. It's implied in them for other architectures where it doesn't make debugging impossible.
torangan
Lord of WesCamp
 
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Postby csabimano » May 27th, 2004, 12:07 pm

I'm not sure if this is the appropriate place to post this - I'm sorry if it isn't -, but I think I have bumped into this gcc bug (but I'm not sure, hence this post!).

0.7.7 compiles just fine (with march=athlon-xp and -O2 -pipe CFLAGS), but the cvs version after a while begins to eat up all the memory (it always happens at a specific point). So I'm confused. Compiler is:
bash-2.05b$ gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106

I tried commenting out every CFLAG, I inserted -fno-omit-frame-pointer as suggested above, but still no go. So is my system incompatible (its 5.2.1 - I saw 4.9 is listed OK) or can this be related to the gcc bug?
csabimano
 

Postby Dave » May 27th, 2004, 12:48 pm

csabimano wrote:but the cvs version after a while begins to eat up all the memory (it always happens at a specific point).


This doesn't sound so much like the bug in this thread.

Can you tell us the specific point after which it begins to eat up memory? How much memory? Does the game still keep running okay?

David
"I made this letter very long, because I did not have the time to make it shorter." -- Blaise Pascal
Dave
Lead Developer
 
Posts: 6950
Joined: August 17th, 2003, 5:07 am
Location: California

Postby ziberpunk » May 27th, 2004, 3:14 pm

csabimano wrote:I tried commenting out every CFLAG, I inserted -fno-omit-frame-pointer as suggested above, but still no go. So is my system incompatible (its 5.2.1 - I saw 4.9 is listed OK) or can this be related to the gcc bug?


It's CXXFLAGS what you have to change, not CFLAGS. Anyway, -fno-omit-frame-pointer in added automatically vy Makefiles
ziberpunk
 

Postby csabimano » May 27th, 2004, 5:01 pm

I wasn't sure if it is related. So another post with compilation problem which was referred to this thread - that's why I thought I would ask.

autogen works fine. configure works fine and it detects everything correctly as far as I can tell.

Error happens after 5 minutes, when memory used by cc (I followed it with top) suddenly jumps to ~ 125-135 Mb!

Actually I'm doing this cause I want to play past Hasty Alliance :) I was also thinking of submitting a PR to wesnoth port maintainer ... maybe he would merge the fix from CVS... I'm technically challenged btw (don't know anything about programming) - tried to find the fix myself on savannah to refer the developer to it, but couldn't...

Anyway, this is where I had to press ctrl+c
Code: Select all
if g++ -DHAVE_CONFIG_H -I. -I. -I..     -I/usr/local/include/SDL11 -I/usr/local/
include -D_REENTRANT -D_THREAD_SAFE -DWESNOTH_PATH=\"/usr/local/share/wesnoth\"
-g -O2 -fno-omit-frame-pointer -MT font.o -MD -MP -MF ".deps/font.Tpo"  -c -o fo
nt.o `test -f 'font.cpp' || echo './'`font.cpp;  then mv -f ".deps/font.Tpo" ".d
eps/font.Po";  else rm -f ".deps/font.Tpo"; exit 1;  fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..     -I/usr/local/include/SDL11 -I/usr/local/
include -D_REENTRANT -D_THREAD_SAFE -DWESNOTH_PATH=\"/usr/local/share/wesnoth\"
-g -O2 -fno-omit-frame-pointer -MT game.o -MD -MP -MF ".deps/game.Tpo"  -c -o ga
me.o `test -f 'game.cpp' || echo './'`game.cpp;  then mv -f ".deps/game.Tpo" ".d
eps/game.Po";  else rm -f ".deps/game.Tpo"; exit 1;  fi
In file included from show_dialog.hpp:21,
                 from dialogs.hpp:19,
                 from game.cpp:21:
halo.hpp:48:7: warning: no newline at end of file
^C
-bash-2.05b#

bash-2.05b$


Thanks for your kind reply :) [/code]
csabimano
 

Postby csabimano » May 27th, 2004, 5:14 pm

I only thought it might be related to this bug because I sow another post with compilation error referred to this thread (I'm not a very technical person btw).

I only tried this because I wanted to play pas hasty alliance :)))

I was thinking of submitting a PR to the port maintainer of wesnoth, thinking that he could merge the fix. I first tried to find it on my own on savannah - but cvsweb was a bit confusing for me (port maintainer needs patches in a unified diff file format, whatever that means).

Anyway, autogen works fine, configure detects everything correctly (I have recent version of sdl_* stuff), but after ~5 minutes into build time memory use of the cc process suddenly jumps to ~125-135 Mb! Here is the last output before I pressed ctrl-c

Code: Select all
if g++ -DHAVE_CONFIG_H -I. -I. -I..     -I/usr/local/include/SDL11 -I/usr/local/
include -D_REENTRANT -D_THREAD_SAFE -DWESNOTH_PATH=\"/usr/local/share/wesnoth\"
-g -O2 -fno-omit-frame-pointer -MT font.o -MD -MP -MF ".deps/font.Tpo"  -c -o fo
nt.o `test -f 'font.cpp' || echo './'`font.cpp;  then mv -f ".deps/font.Tpo" ".d
eps/font.Po";  else rm -f ".deps/font.Tpo"; exit 1;  fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..     -I/usr/local/include/SDL11 -I/usr/local/
include -D_REENTRANT -D_THREAD_SAFE -DWESNOTH_PATH=\"/usr/local/share/wesnoth\"
-g -O2 -fno-omit-frame-pointer -MT game.o -MD -MP -MF ".deps/game.Tpo"  -c -o ga
me.o `test -f 'game.cpp' || echo './'`game.cpp;  then mv -f ".deps/game.Tpo" ".d
eps/game.Po";  else rm -f ".deps/game.Tpo"; exit 1;  fi
In file included from show_dialog.hpp:21,
                 from dialogs.hpp:19,
                 from game.cpp:21:
halo.hpp:48:7: warning: no newline at end of file
^C
-bash-2.05b#

I put compiler flags back, but I tried every combination with the same result.
I'm not that impatient btw - I was just curious if I can install cvs version - and thanks for your kind reply :)

ps>
@ziberpunk - yeah, that's what I meant. You only have to define CXXFLAGS if you have different settings there. Otherwise, the values for CFLAGS are passed to cc by default on fbsd... that's how it looks like in my make.conf:
CPUTYPE=athlon-xp
CFLAGS= -O2 -pipe
COPTFLAGS= -O2 -pipe

This is equivalent of having a CXXFLAGS= -O2 -pipe there as well (no need to define unless you want different flags). (COPTFLAGS is for kernel build).
csabimano
 

Postby csabimano » May 27th, 2004, 5:16 pm

ooops, sorry, I'm such an elephant :( - on my first attempt I saw a message saying something about a failure to send some email (??) so I retyped the whole damned thing - hence the double post. SORRY!!! <ducks>
csabimano
 

CVS does not compile

Postby Khiraly » July 18th, 2004, 11:05 am

Its two weeks then I have compiled the CVS(it worked fine)
Now it fails with the following error message(gcc version 3.3.3 (Debian 20040429)

Code: Select all
make[3]: Entering directory `/home/lama/wesnothCVS/src'
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT about.o -MD -MP -MF ".deps/about.Tpo" \
  -c -o about.o `test -f 'about.cpp' || echo './'`about.cpp; \
then mv -f ".deps/about.Tpo" ".deps/about.Po"; \
else rm -f ".deps/about.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT actions.o -MD -MP -MF ".deps/actions.Tpo" \
  -c -o actions.o `test -f 'actions.cpp' || echo './'`actions.cpp; \
then mv -f ".deps/actions.Tpo" ".deps/actions.Po"; \
else rm -f ".deps/actions.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT ai.o -MD -MP -MF ".deps/ai.Tpo" \
  -c -o ai.o `test -f 'ai.cpp' || echo './'`ai.cpp; \
then mv -f ".deps/ai.Tpo" ".deps/ai.Po"; \
else rm -f ".deps/ai.Tpo"; exit 1; \
fi
ai.cpp:1834:2: warning: no newline at end of file
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT ai_attack.o -MD -MP -MF ".deps/ai_attack.Tpo" \
  -c -o ai_attack.o `test -f 'ai_attack.cpp' || echo './'`ai_attack.cpp; \
then mv -f ".deps/ai_attack.Tpo" ".deps/ai_attack.Po"; \
else rm -f ".deps/ai_attack.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT ai_move.o -MD -MP -MF ".deps/ai_move.Tpo" \
  -c -o ai_move.o `test -f 'ai_move.cpp' || echo './'`ai_move.cpp; \
then mv -f ".deps/ai_move.Tpo" ".deps/ai_move.Po"; \
else rm -f ".deps/ai_move.Tpo"; exit 1; \
fi
ai_move.cpp:740:2: warning: no newline at end of file
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT builder.o -MD -MP -MF ".deps/builder.Tpo" \
  -c -o builder.o `test -f 'builder.cpp' || echo './'`builder.cpp; \
then mv -f ".deps/builder.Tpo" ".deps/builder.Po"; \
else rm -f ".deps/builder.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT cavegen.o -MD -MP -MF ".deps/cavegen.Tpo" \
  -c -o cavegen.o `test -f 'cavegen.cpp' || echo './'`cavegen.cpp; \
then mv -f ".deps/cavegen.Tpo" ".deps/cavegen.Po"; \
else rm -f ".deps/cavegen.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT clipboard.o -MD -MP -MF ".deps/clipboard.Tpo" \
  -c -o clipboard.o `test -f 'clipboard.cpp' || echo './'`clipboard.cpp; \
then mv -f ".deps/clipboard.Tpo" ".deps/clipboard.Po"; \
else rm -f ".deps/clipboard.Tpo"; exit 1; \
fi
clipboard.cpp:385:7: warning: no newline at end of file
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT config.o -MD -MP -MF ".deps/config.Tpo" \
  -c -o config.o `test -f 'config.cpp' || echo './'`config.cpp; \
then mv -f ".deps/config.Tpo" ".deps/config.Po"; \
else rm -f ".deps/config.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT cursor.o -MD -MP -MF ".deps/cursor.Tpo" \
  -c -o cursor.o `test -f 'cursor.cpp' || echo './'`cursor.cpp; \
then mv -f ".deps/cursor.Tpo" ".deps/cursor.Po"; \
else rm -f ".deps/cursor.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT dialogs.o -MD -MP -MF ".deps/dialogs.Tpo" \
  -c -o dialogs.o `test -f 'dialogs.cpp' || echo './'`dialogs.cpp; \
then mv -f ".deps/dialogs.Tpo" ".deps/dialogs.Po"; \
else rm -f ".deps/dialogs.Tpo"; exit 1; \
fi
In file included from dialogs.cpp:26:
widgets/progressbar.hpp:23:7: warning: no newline at end of file
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT display.o -MD -MP -MF ".deps/display.Tpo" \
  -c -o display.o `test -f 'display.cpp' || echo './'`display.cpp; \
then mv -f ".deps/display.Tpo" ".deps/display.Po"; \
else rm -f ".deps/display.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT events.o -MD -MP -MF ".deps/events.Tpo" \
  -c -o events.o `test -f 'events.cpp' || echo './'`events.cpp; \
then mv -f ".deps/events.Tpo" ".deps/events.Po"; \
else rm -f ".deps/events.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT filesystem.o -MD -MP -MF ".deps/filesystem.Tpo" \
  -c -o filesystem.o `test -f 'filesystem.cpp' || echo './'`filesystem.cpp; \
then mv -f ".deps/filesystem.Tpo" ".deps/filesystem.Po"; \
else rm -f ".deps/filesystem.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT font.o -MD -MP -MF ".deps/font.Tpo" \  -c -o font.o `test -f 'font.cpp' || echo './'`font.cpp; \
then mv -f ".deps/font.Tpo" ".deps/font.Po"; \
else rm -f ".deps/font.Tpo"; exit 1; \
fi
if g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/X11R6/include  -I/usr/include/SDL -D_REENTRANT -DWESNOTH_PATH=\"/usr/local/share/wesnoth\" -g -O2 -D_X11  -I/usr/X11R6/include -fno-omit-frame-pointer -MT game.o -MD -MP -MF ".deps/game.Tpo" \  -c -o game.o `test -f 'game.cpp' || echo './'`game.cpp; \
then mv -f ".deps/game.Tpo" ".deps/game.Po"; \
else rm -f ".deps/game.Tpo"; exit 1; \
fi
game.cpp: In function `int play_game(int, char**)':
game.cpp:383: `getcwd' undeclared (first use this function)
game.cpp:383: (Each undeclared identifier is reported only once for each
   function it appears in.)
make[3]: *** [game.o] Error 1
make[3]: Leaving directory `/home/lama/wesnothCVS/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/lama/wesnothCVS/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lama/wesnothCVS'
make: *** [all] Error 2
[lama@khiraly:~/wesnothCVS]


What can I do (I have a recent CVS version)

Best regards,
Khiraly
Khiraly
 
Posts: 114
Joined: October 22nd, 2003, 7:13 pm
Location: Hungary

Re: CVS does not compile

Postby Dave » July 18th, 2004, 12:59 pm

Khiraly wrote:Now it fails with the following error message(gcc version 3.3.3 (Debian 20040429)


Put #include <unistd.h> at the top of game.cpp
"I made this letter very long, because I did not have the time to make it shorter." -- Blaise Pascal
Dave
Lead Developer
 
Posts: 6950
Joined: August 17th, 2003, 5:07 am
Location: California

Postby Khiraly » July 18th, 2004, 3:56 pm

Thx Dave, it works.
Khiraly
 
Posts: 114
Joined: October 22nd, 2003, 7:13 pm
Location: Hungary


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest