LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Segmentation faults (https://www.linuxquestions.org/questions/linux-software-2/segmentation-faults-372254/)

winterhunter 10-12-2005 09:07 AM

Segmentation faults
 
Hi everyone,

I'm kind of new to Linux (though I have some programming background), and I keep getting this annoying "segmentation faults" when I run some programs that I've downloaded.

I use the configure scripts, make gives some warnings but no errors, make install reports nothing... but when I try to run the application I get a segmentation fault.

BTW: what is a segmentation fault? Is is some kind of protected mode exception (yeah, my programming skills REALLY are outdated) under linux?

The last two examples I remember are E-UAE and Ur-Quan Masters 0.4.

For example, the latter gives me this :

------------------------------------------
The Ur-Quan Masters v0.4.0 (compiled Oct 12 2005 13:26:53)
This software comes with ABSOLUTELY NO WARRANTY;
for details see the included 'COPYING' file.

Initializing base SDL functionality.
Using SDL version 1.2.9 (compiled with 1.2.9)
Warning: There's no 'packages/addons' directory in the 'content' directory;
'--addon' options are ignored.
Initializing Pure-SDL graphics.
SDL driver used: x11
SDL initialized.
Initializing Screen.
Set the resolution to: 640x480x32
0 joysticks were found.
Initializing SDL audio subsystem.
SDL audio subsystem initialized.
Opening SDL audio device.
using dsp at 44100 Hz 16 bit stereo, 4096 samples audio buffer
Initializing mixer.
Mixer initialized.
Initializing sound decoders.
Sound decoders initialized.
'lbm/title.ani' -- 19 bytes
Segmentation fault
-------------------------------------------

I'm running SuSE 9.3 on a Athlon 64 3000+.

Any idea how can I solve this recurring problem :confused: ?


Thanks!

jtshaw 10-12-2005 09:31 AM

I'm not sure how to solve the specific problem you have.. but I can explain what a Segmentation fault is.

A segfault occurs when a piece of memory is access in a method not allowed. Usually, but not always, this involves even access/loading an uninitialized pointer or a NULL pointer.

dinolinux 10-12-2005 09:33 AM

Hello

Segmentation fault happens when a program uses memory that it can't use.

Have you recently installed any memory? The problem may be that your memory is too slow or you have different memory speeds. Try running a memtest for some hours and see what happens.

winterhunter 10-12-2005 09:58 AM

Thanks for the answers!

@dinolux
As for having installed new memory, the answer's no. And the memtest programs I've run didn't detect any kind of failure. Besides, it's deterministic: no matter how many programs I have loaded into memory, they only ones that produce segfaults are the one who always did.

@jtshaw
Why would some programs that compile on other machines generate a segfault when compiled on mine? Can it be some kind of problem/obsolescence with GCC/glibc/SDL/whatever? The only "common points" between both programs are GCC/glibc/make and I think SDL.

Wim Sturkenboom 10-12-2005 10:19 AM

Quote:

Originally posted by winterhunter
Why would some programs that compile on other machines generate a segfault when compiled on mine? Can it be some kind of problem/obsolescence with GCC/glibc/SDL/whatever? The only "common points" between both programs are GCC/glibc/make and I think SDL.
Do you get the same warning (see below) with programs compiled (and running) on other machines.
Quote:

Warning: There's no 'packages/addons' directory in the 'content' directory;
If not, it might be a variable that's not (correctly) initialized if there's nothing in the given directory. Next the program might still try to access it without testing first with the segfault as a result. I make this type of mistakes quite often myself when I'm programming; most of the time I'll find them in the initial testing phase.

winterhunter 10-14-2005 03:06 AM

Quote:

Originally posted by Wim Sturkenboom
Do you get the same warning (see below) with programs compiled (and running) on other machines.

Actually, it is normal that the program gives that warning, and should work without addons. Just for the sake of it, I've tried installing some addons... Didn't get the warning, but still had a segfault.

But now I've managed to get a different kind of error!

I've installed the latest version of GCC, and recompiled the game in question. Well, no more segfaults, but the game can't open the data files (which are in .zip format) anymore. Actually, even the linker doesn't want to link libz anymore, saying it is "outdated or something".

This compiling stuff is getting quite frustrating!!!:cry:


All times are GMT -5. The time now is 03:06 PM.