dale_chip has asked for the wisdom of the Perl Monks concerning the following question:

Hi ,
i am using centos 5 and am trying to run some regressions(using perl),
my friend on RHEL 4 is also running them.
we do all the things same , but its running fine on his comp while is giving segmentation fault in mine.
somebody said that there can be missing packages or conflicting ones.
but i thought that in this case perl flashes the error messages.
can this be the problem or anything else ?
thnx in advance

Replies are listed 'Best First'.
Re: segmentation fault
by jbert (Priest) on Aug 27, 2008 at 13:04 UTC

    The suggestion elsewhere to use Devel::Trace is a good one.

    Otherwise, you need to isolate what is causing the segmentation fault.

    You might get some useful information by running perl under gdb and getting a backtrace:

    box> gdb perl yourscript.pl gdb> r ...your program runs and then stops with a segmentation fault ...dropping you back to gdb... gdb> bt

    the displayed backtrace is perl's call stack, it might give some information as to where perl is dying.

    You might also have success by trying to find the minimum amount of code needed to cause the segfault. Try commenting out about 1/2 of the module loads (you can use =pod and =cut to comment out a block of code) and do a binary search. Even with a thousand modules, that would only take approx 10 steps.

      box> gdb perl yourscript.pl gdb> r

      I think "yourscript.pl" shoud be after "r", not after "gdb perl".

        Thanks, you're right.

        I blame too much time spent in the perl debugger recently.

Re: segmentation fault
by JavaFan (Canon) on Aug 27, 2008 at 11:01 UTC
    Perl isn't bug free some segmentation faults can happen. Or it could be that you are using a package or module that uses XS code, and the segfault is happening there. Or it's linked to some library that cause the segfault.

    But you are not showing any code, you are not showing any error message, nor are you even telling what you are doing when the segfault happens. So, don't expect a miracle answer.

    A reply falls below the community's threshold of quality. You may see it by logging in.