Segmentation fault

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
alex

Segmentation fault

Post by alex »

Hi, everybody... I used to play wesnoth a lot before 1.0... now I don't have so much time.
Besides... since 1.1.something (I don't remember exactly when it started, but I still get it in 1.1.7) I always got a segmentation fault as soon as I move an unit.

This is the backtrace (I got it by compiling wesnoth with --enable-debug and gdb):

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1214399936 (LWP 29384)]
0x09622e40 in ?? ()
(gdb) bt
#0 0x09622e40 in ?? ()
#1 0xb7fbfbe4 in __dynamic_cast () from /usr/local/lib/libSDL_mixer-1.2.so.0
#2 0x082e54a3 in unit::set_walking () at locale_facets.tcc:2442
#3 0x0831c4c4 in (anonymous namespace)::move_unit_between ()
at locale_facets.tcc:2442
#4 0x0831c971 in unit_display::move_unit () at locale_facets.tcc:2442
#5 0x0806b22d in move_unit () at ios_base.h:93
#6 0x081e1f16 in events::mouse_handler::move_unit_along_current_route ()
at locale_facets.tcc:2442
#7 0x081e1333 in events::mouse_handler::left_click ()
at locale_facets.tcc:2442
#8 0x081e061e in events::mouse_handler::mouse_press ()
at locale_facets.tcc:2442
#9 0x0824bd9e in play_controller::handle_event () at locale_facets.tcc:2442
#10 0x08107d6e in events::pump () at locale_facets.tcc:2442
#11 0x0824be6c in play_controller::play_slice () at locale_facets.tcc:2442
#12 0x0824f829 in playmp_controller::play_human_turn ()
at locale_facets.tcc:2442
#13 0x08255d0f in playsingle_controller::play_side () at locale_facets.tcc:2442
#14 0x0824f3e0 in playmp_controller::play_side () at locale_facets.tcc:2442
#15 0x08255c0b in playsingle_controller::play_turn () at locale_facets.tcc:2442
#16 0x082534d8 in playsingle_controller::play_scenario ()
at locale_facets.tcc:2442
#17 0x0824f1e9 in playmp_scenario () at locale_facets.tcc:2442
#18 0x0824202b in play_game () at locale_facets.tcc:2442
#19 0x081edeb9 in (anonymous namespace)::enter_connect_mode () at video.hpp:120
#20 0x081ee0e1 in (anonymous namespace)::enter_create_mode () at video.hpp:120
#21 0x081ee797 in mp::start_server () at video.hpp:120
#22 0x081305fc in (anonymous namespace)::game_controller::play_multiplayer (
this=0xbffff790) at game.cpp:1192
#23 0x08135905 in play_game (argc=1, argv=0xbffffb84) at game.cpp:1785
#24 0x08135e56 in main (argc=1, argv=0xbffffb84) at game.cpp:1840

Keep in mind that I use linux and I always compiled wesnoth from source.

I found the set_walking function... and I *think* that the casting in the first line somehow fails... but I'm kinda lost... unfortunately I don't have much time for debugging, and I would really appreciate some suggestion from somebody who knows the source code better than me... any ideas?

Thank you in advance...
torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Post by torangan »

A nice start would be your GCC version and flags used to compile? That's the very least information needed to judge your problem.
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!
alex

Post by alex »

Thank you for your answer.

I'm using gcc 3.4.1.
To compile i just used:

./configure --prefix=[my install folder]
make
make install

This is the output of configure (at least the first part, before it starts creating Makefiles):

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking whether NLS is requested... yes
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking for ranlib... ranlib
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for a BSD-compatible install... /usr/bin/install -c
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for XOpenDisplay in -lX11... yes
checking for sdl-config... /usr/local/bin/sdl-config
checking for fribidi-config... no
configure: WARNING: *** FRIBIDI not found.
checking for libpng-config... /usr/bin/libpng-config
checking for SDL - version >= 1.2.7... yes
checking for gnome-config... no
checking for kde-config... no
checking for libtool... /usr/bin/libtool
checking for IMG_Load in -lSDL_image... yes
checking for Mix_OpenAudio in -lSDL_mixer... yes
checking for SDLNet_Init in -lSDL_net... yes
checking for freetype-config... /usr/bin/freetype-config
checking for libzipios++... no
configure: WARNING: *** libzipios++ not found - support for ZIP files is disabled
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking how to run the C++ preprocessor... g++ -E
checking for ANSI C header files... no
checking SDL.h usability... yes
checking SDL.h presence... yes
checking for SDL.h... yes
checking SDL_image.h usability... yes
checking SDL_image.h presence... yes
checking for SDL_image.h... yes
checking SDL_mixer.h usability... yes
checking SDL_mixer.h presence... yes
checking for SDL_mixer.h... yes
checking SDL_net.h usability... yes
checking SDL_net.h presence... yes
checking for SDL_net.h... yes
checking stdlib.h usability... yes
checking stdlib.h presence... yes
checking for stdlib.h... yes
checking unistd.h usability... yes
checking unistd.h presence... yes
checking for unistd.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for mode_t... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for error_at_line... no
checking whether lstat dereferences a symlink specified with a trailing slash... no
checking whether stat accepts an empty string... yes
checking for strftime... yes
checking for floor... yes
checking for socket... yes
checking for strtoul... yes
checking for PNG support in SDL_image... yes
checking for OGG support in SDL_mixer... yes

As it compiles it uses g++ with those flags:

-DHAVE_CONFIG_H -D_REENTRANT -DWESNOTH_PATH=\"[my install folder]/share/wesnoth\" -DLOCALEDIR=\"translations\" -DHAS_RELATIVE_LOCALEDIR=1 -DFIFODIR=\"[my install folder]/var/run/wesnothd\" -W -Wall -ansi -D_X11

(If you need the whole command line just ask... i took off just the -I and -M* flags)
torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Post by torangan »

Well, I for one can't think of a reason why that's happening. Let's hope that someone else has an idea.
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!
alex

Post by alex »

Yeah that's really weird... I have no clues too... but I appreciate your answer, torangan, thank you anyway :)
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

Isn't this error coming from your SDL_mixer dll ?
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

Are you sure you have RTTI enabled?
"It is time people learned about their failures and my successes."
alex

Post by alex »

Sapient wrote:Isn't this error coming from your SDL_mixer dll ?
Yes, but looking at wesnoth code I can't explain why the SDL_mixer should be invoked by requesting a dynamic cast of an animation object (I don't have the source code here with me right now) which I *think* is a wesnoth specific type and has nothing to do with the SDL_mixer.

Anyway, I think that I'm going to get a newer version of all SDL libraries before trying anything else... so for now stop helping me... I don't want you to lose your time for an SDL problem. (well, maybe just cross your fingers :) )

I will let you know if updating SDL solves the problem...
Xan wrote:Are you sure you have RTTI enabled?
:? No. How can I tell that? Shouldn't the compile fail?
Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

Well, I know that Wesnoth compiles without RTTI enabled, and I know that without it, Wesnoth does crash where you said.
You could trying adding -frtti to your CPPFLAGS before compiling.
"It is time people learned about their failures and my successes."
alex

Post by alex »

Xan wrote:Well, I know that Wesnoth compiles without RTTI enabled, and I know that without it, Wesnoth does crash where you said.
You could trying adding -frtti to your CPPFLAGS before compiling.
Ok, I just tried that and it still crashes.
But you gave me an important hint... I will try to solve my problem on my own (I still have to try the latest SDL).

Thanks a lot to those who helped me. If I will be able to play wesnoth again I will let you know. :)
alex

Post by alex »

Just to let you know... I managed to make wesnoth work again.
The problem was I had an old version of ld and libtool in my /usr/local/bin... damn, I downloaded those a lot of time ago and I completely forgot about that... when I removed those it used the correct tools /usr/bin and everything went fine.

Thanks to all the people who helped me.


...by the way, the 1.1.10 is awesome... the graphic improvement from the 1.0.0 is amazing. Good work! :)
Post Reply