sxiii / violetland

Violetland is an open source cross-platform game similar to Crimsonland
0 stars 0 forks source link

Application crashes on startup #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using violetland-0.2.5, it crashes on game load. Here is some gdb output:

$ gdb violetland                              
GNU gdb 6.8                                                                     

Copyright (C) 2008 Free Software Foundation, Inc.                               

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>   

This is free software: you are free to change and redistribute it.              

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"      

and "show warranty" for details.                                                

This GDB was configured as "i486-slackware-linux"...                            

(no debugging symbols found)                                                    

(gdb) run                                                                       

Starting program: /usr/bin/violetland                                           

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

[Thread debugging using libthread_db enabled]                                   

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)                                                    

(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Path to resources is set to:
        /usr/bin/../share/violetland/
To change the path use -r <path> key
violetland v0.2.5
Assuming LINUX environment...
SDL_Init...
[New Thread 0xb6971720 (LWP 28752)]
SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER...
SDL_SetVideoMode 800x600 (w)...
glViewport...
SoundManager...
Mix_OpenAudio (freq 22050)...
[New Thread 0xb5631b90 (LWP 28778)]
        sound is enabled
Mix_Volume (master) 480...
MusicManager...
        loaded 0 tracks
InputHandler...
Loading weapons...
Constructing aim...
Loading monsters...
Total monsters found: 0
Loading of monsters is completed.
Forming terrain...

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6971720 (LWP 28752)]
0x0806e632 in MonsterFactory::create ()
(gdb) bt
#0  0x0806e632 in MonsterFactory::create ()
#1  0x08056f35 in spawnEnemy ()
#2  0x0805edf3 in startSurvival ()
#3  0x0807b42e in Window::process ()
#4  0x08058324 in drawWindows ()
#5  0x08063aed in runMainLoop ()
#6  0x08063cdd in main ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y

Original issue reported on code.google.com by intergal...@gmail.com on 9 Jan 2010 at 6:10

GoogleCodeExporter commented 9 years ago
How you install the game? Looks like path /usr/bin/../share/violetland/ don't 
point
to the game resources.

Original comment by 5253...@gmail.com on 9 Jan 2010 at 9:17

GoogleCodeExporter commented 9 years ago
This path is correct. Application build with the following commands:

mkdir build
cd build
cmake \
  -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/usr \
  -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  -DMAN_INSTALL_DIR=/usr/man \
  -DSYSCONF_INSTALL_DIR=/etc/kde \
  ..
make -j2 || exit 1
make install DESTDIR=$PKG || exit 1
cd -

Original comment by intergal...@gmail.com on 9 Jan 2010 at 9:35

GoogleCodeExporter commented 9 years ago
Post result of the command ls -l /usr/bin/../share/violetland/

Original comment by 5253...@gmail.com on 9 Jan 2010 at 9:53

GoogleCodeExporter commented 9 years ago
$ ls -l /usr/bin/../share/violetland/
итого 21
-rw-r--r-- 1 root root 2583 2009-12-03 22:08 README_EN.TXT
-rw-r--r-- 1 root root 2172 2009-12-03 22:08 README_RU.TXT
drwxr-xr-x 2 root root   80 2010-01-10 00:42 fonts/
-rw-r--r-- 1 root root 4650 2009-10-30 23:46 icon-light.png
drwxr-xr-x 4 root root  640 2010-01-10 00:42 images/
drwxr-xr-x 4 root root   96 2010-01-10 00:42 monsters/
drwxr-xr-x 2 root root  168 2010-01-10 00:42 music/
drwxr-xr-x 2 root root  616 2010-01-10 00:42 sounds/
-rw-r--r-- 1 root root  496 2009-11-25 20:01 weapons

-------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb6a12720 (LWP 6795)]
0x0806d247 in MonsterFactory::create (this=0x85d3b08, baseLvl=1, lvl=1,
    param=0xbf938870) at /tmp/tgz/violetland-v0.2.5/src/game/MonsterFactory.cpp:76
76                              m_deathSprites[monsterIndex], 
m_hitSounds[monsterIndex]);
(gdb) bt
#0  0x0806d247 in MonsterFactory::create (this=0x85d3b08, baseLvl=1, lvl=1,
    param=0xbf938870) at /tmp/tgz/violetland-v0.2.5/src/game/MonsterFactory.cpp:76
#1  0x08056ee2 in spawnEnemy (r=1600, lvl=1, param=0xbf938870)
    at /tmp/tgz/violetland-v0.2.5/src/program.cpp:211
#2  0x0805e780 in startSurvival () at 
/tmp/tgz/violetland-v0.2.5/src/program.cpp:250
#3  0x080799a4 in Window::process (this=0x821fbd0, input=0x821f9f8)
    at /tmp/tgz/violetland-v0.2.5/src/system/graphic/Window.cpp:84
#4  0x0805834a in drawWindows () at 
/tmp/tgz/violetland-v0.2.5/src/program.cpp:1657
#5  0x08062df8 in runMainLoop () at 
/tmp/tgz/violetland-v0.2.5/src/program.cpp:1719
#6  0x08062ff4 in main (argc=134768064, argv=0x8208a40)
    at /tmp/tgz/violetland-v0.2.5/src/program.cpp:1986

Original comment by intergal...@gmail.com on 9 Jan 2010 at 9:59

GoogleCodeExporter commented 9 years ago
Look. The messages:
MusicManager...
        loaded 0 tracks
and
Loading monsters...
Total monsters found: 0
says to us that the program can't load the resources (music files and gfx).

But this message:
Loading weapons...
says to us that the program can open a list of weapons from file weapons.

It is strange.

I think you saw the main menu and have chosen the New Survival entry.

Forming terrain...

I think the terrain gfx couldn't be loaded too.

Now I can suggest to you just to check if you have a symbolic links or 
something in
your paths and to try to install to your home directory, for example.

Meanwhile I will try to reproduce your problem.

Original comment by 5253...@gmail.com on 9 Jan 2010 at 10:36

GoogleCodeExporter commented 9 years ago
Hmm... yes, it seems that your FileUtility.cpp is broken under linux. 
Partial fix for the one of the bugs (readlink() does not append a null byte to 
result): 
--- FileUtility.cpp.orig        2010-01-05 21:26:48.000000000 +0300
+++ FileUtility.cpp     2010-01-10 01:20:04.000000000 +0300        
@@ -100,7 +100,9 @@                                                
        m_appPath.append("/bin");                                  
 #ifndef DATA_INSTALL_DIR
        char result[PATH_MAX];
-       if (readlink("/proc/self/exe", result, PATH_MAX) != -1) {
+       int link_len = readlink("/proc/self/exe", result, PATH_MAX);
+       if (link_len != -1) {
+               result[link_len] = '\0';
                FileUtility::truncateFullPathToDir(result);
                m_appPath = result;
                m_resPath = m_appPath;

P.S. FileUtility::truncateFullPathToDir could be replaced with the standard 
libgen.h/dirname()

Original comment by intergal...@gmail.com on 9 Jan 2010 at 11:21

GoogleCodeExporter commented 9 years ago
Thanks, I will check this for compatibility to other os. My FileUtility already 
has
many fixes for windows, freebsd and personally for gentoo users. I hoped that I 
have
already finished with it...

Original comment by 5253...@gmail.com on 9 Jan 2010 at 11:47

GoogleCodeExporter commented 9 years ago
violetland-0.2.4 used to work on my pc

Original comment by intergal...@gmail.com on 10 Jan 2010 at 12:59

GoogleCodeExporter commented 9 years ago
try the newest version from svn

Original comment by 5253...@gmail.com on 11 Jan 2010 at 8:31

GoogleCodeExporter commented 9 years ago

Original comment by 5253...@gmail.com on 14 Jan 2010 at 7:29

GoogleCodeExporter commented 9 years ago
$ violetland
Path to resources is set to:
        /usr/bin/../share/violetland/
To change the path use -r <path> key
violetland v0.2.7
Assuming LINUX environment...
SDL_Init...
SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER...
SDL_SetVideoMode 800x600 (w)...
glViewport...
SoundManager...
Mix_OpenAudio (freq 22050)...
        sound is enabled
Mix_Volume (master) 480...
MusicManager...
        loaded 0 tracks
InputHandler...
Loading weapons...
Constructing aim...
Loading monsters...
Total monsters found: 0
Couldn't load monsters, program can't run!

Original comment by intergal...@gmail.com on 17 Jan 2010 at 1:39

GoogleCodeExporter commented 9 years ago
I've made some investigation and fixed monsters loading. Patch attached. But 
the game still crashes. Here is 
the output:

$ gdb --args ./violetland -r /usr/share/violetland/                             

GNU gdb 6.8                                                                     

Copyright (C) 2008 Free Software Foundation, Inc.                               

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>   

This is free software: you are free to change and redistribute it.              

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"      

and "show warranty" for details.                                                

This GDB was configured as "i486-slackware-linux"...                            

(gdb) run                                                                       

Starting program: 
/home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/build/violetland 
-r /usr/
share/violetland/                                                 
[Thread debugging using libthread_db enabled]                                   

Path to resources is set to:                                                    

        /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/build/../share/
violetland/                                                                     

To change the path use -r <path> key                                            

Path to resources is set to:                                                    

        /usr/share/violetland//                                                       
To change the path use -r <path> key                                            

violetland v0.2.7                                                               

Assuming LINUX environment...                                                   

SDL_Init...                                                                     

[New Thread 0xb62679e0 (LWP 16164)]                                             

SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER...                                      

SDL_SetVideoMode 800x600 (w)...                                                 

glViewport...                                                                   

SoundManager...                                                                 

Mix_OpenAudio (freq 22050)...                                                   

[New Thread 0xb4f24b70 (LWP 16167)]                                             

        sound is enabled                                                              
Mix_Volume (master) 480...                                                      

MusicManager...                                                                 

        loaded 0 tracks                                                               
InputHandler...                                                                 

Loading weapons...                                                              

Constructing aim...                                                             

Loading monsters...                                                             

        runner                                                                        
        spider
        zombie
Total monsters found: 3
Monster runner, animation of walk, frames count: 0.
Monster runner, animation of death, frames count: 0.
Monster spider, animation of walk, frames count: 0.
Monster spider, animation of death, frames count: 0.
Monster zombie, animation of walk, frames count: 0.
Monster zombie, animation of death, frames count: 0.
Loading of monsters is completed.
Forming terrain...

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb62679e0 (LWP 16164)]
0x0809e7f8 in Sprite::getFrame (this=0x864fc88, index=0)
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/system/graphic/Sprite.cpp:12
12              return m_frames[index];
(gdb) bt
#0  0x0809e7f8 in Sprite::getFrame (this=0x864fc88, index=0)
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/system/graphic/Sprite.cpp:12
#1  0x0809f7df in DynamicObject::draw (this=0x8b4b238, x=-1253.42737, 
y=1315.50146,
    angle=218.160004, scale=1, rMask=0.800000012, gMask=0.699999988,
    bMask=0.400000006, aMask=1)
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/system/graphic/
DynamicObject.cpp:42
#2  0x0808dee3 in Enemy::draw (this=0x8b4b1a0)
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/game/Enemy.cpp:128
#3  0x0807cc18 in drawGame ()
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/program.cpp:1612
#4  0x0807d4d7 in runMainLoop ()
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/program.cpp:1719
#5  0x08080055 in main (argc=3, argv=0xbf888904)
    at /home/lxuser/repository/src/violetland-0.2.7/violetland-v0.2.7/src/program.cpp:2005
(gdb) quit
The program is running.  Exit anyway? (y or n) y

Original comment by intergal...@gmail.com on 23 Jan 2010 at 1:17

Attachments:

GoogleCodeExporter commented 9 years ago
Another version of the patch. I can play the game now.

Original comment by intergal...@gmail.com on 23 Jan 2010 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
I'm glad that you can play the game now. I've seen description of stat() 
function. It
really has some improvements against previous code (for example, it should 
properly
handle symlinks). But I can't understand how I and many others could play the 
game
without any issues in linux (ubuntu, suse, gentoo) without this patch. And I 
should
check now support of stat() in mac os x that is supported now. By the way, 
thank you
for patch and sorry we couldn't help you with this.

Original comment by 5253...@gmail.com on 23 Jan 2010 at 8:18

GoogleCodeExporter commented 9 years ago
On my system d_type is not equal DT_DIR = 4, d_type value is DT_UNKNOWN = 0, 
that's it. And stat() 
function is described in posix standard, so it should be available everywhere.

Original comment by intergal...@gmail.com on 23 Jan 2010 at 1:23