This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: perl_construct segfaults under cygwin


In case anyone else is ever stuck trying to figure this out, the answer is to RTFM.

It turns out that in perl5.8.? you need to add a call to:

PERL_SYS_INIT3(&argc,&argv,&env)

before you do anything else with perl. This is documented in the Perl embed man page.

Luke Diamand wrote:

I'm seeing the call to perl_construct() segfault under cygwin. The same code works fine on linux.


Here's the code:

#include <EXTERN.h>
#include <perl.h>
static PerlInterpreter *my_perl;

int main() {
        my_perl = perl_alloc();
        perl_construct(my_perl);
        printf("Hooray\n");
}

The last 10 lines of the backtrace give:
#0 0x10072547 in cygperl5_8_2!Perl_sv_add_arena ()
from /usr/bin/cygperl5_8_2.dll
#1 0x1007dc8b in cygperl5_8_2!Perl_newSVpvn () from /usr/bin/cygperl5_8_2.dll
#2 0x10058488 in cygperl5_8_2!Perl_savesharedpv ()
from /usr/bin/cygperl5_8_2.dll
#3 0x100586b7 in cygperl5_8_2!Perl_vmess () from /usr/bin/cygperl5_8_2.dll
#4 0x10059171 in cygperl5_8_2!Perl_vcroak () from /usr/bin/cygperl5_8_2.dll
#5 0x1005963f in cygperl5_8_2!Perl_croak_nocontext ()
from /usr/bin/cygperl5_8_2.dll
#6 0x1000ae1b in cygperl5_8_2!Perl_malloc () from /usr/bin/cygperl5_8_2.dll
#7 0x1007254c in cygperl5_8_2!Perl_sv_add_arena ()
from /usr/bin/cygperl5_8_2.dll
#8 0x1007dc8b in cygperl5_8_2!Perl_newSVpvn () from /usr/bin/cygperl5_8_2.dll
#9 0x10058488 in cygperl5_8_2!Perl_savesharedpv ()
from /usr/bin/cygperl5_8_2.dll
(More stack frames follow...)



The last few lines of the backtrace appear to be:


#35002 0x10058488 in cygperl5_8_2!Perl_savesharedpv ()
   from /usr/bin/cygperl5_8_2.dll
#35003 0x100586b7 in cygperl5_8_2!Perl_vmess () from /usr/bin/cygperl5_8
#35004 0x10059171 in cygperl5_8_2!Perl_vcroak ()
   from /usr/bin/cygperl5_8_2.dll
#35005 0x1005963f in cygperl5_8_2!Perl_croak_nocontext ()
   from /usr/bin/cygperl5_8_2.dll
#35006 0x1000ae1b in cygperl5_8_2!Perl_malloc ()
   from /usr/bin/cygperl5_8_2.dll
#35007 0x1007254c in cygperl5_8_2!Perl_sv_add_arena ()
   from /usr/bin/cygperl5_8_2.dll
#35008 0x10079a0e in cygperl5_8_2!Perl_newSV () from /usr/bin/cygperl5_8
#35009 0x100014ac in perl_construct () from /usr/bin/cygperl5_8_2.dll
#35010 0x0040108d in cygcrypt-0!crypt ()
#35011 0x6101c868 in dlerror () from /usr/bin/cygwin1.dll

I've seen a suggestion elsewhere that this is new in 5.8.2, although I can't verify this myself, since I haven't worked out how to downgrade to anything newer than cygwin perl 5.6.

Thanks in advance
Luke Diamand




******************Legal Disclaimer************************** "This email may contain confidential and privileged material for the sole use of the intended recipient. Any unauthorized review, use or distribution by others is strictly prohibited. If you have received the message in error, please advise the sender by reply email help@conexant.com, and delete the message. Thank you." ************************************************************


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]