Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Perlxs DCE interface dumps core when built with gcc

 
SOLVED
Go to solution
Highlighted
Occasional Visitor

Perlxs DCE interface dumps core when built with gcc

Hi,

I created a Perlxs interface to change a principal's password in DCE from Perl scripts, which works fine when compiled using HP's CC. However when I build it using gcc, Perl dumps core (memory fault) when the script is executed. I could use the CC compiled version if it wasn't for the fact that I'm planning to use this interface with HP's mod_perl, which requires HP's Perl 5.8.x (built with gcc).

I attached the Password.xs file and the module can be built as follows:

1) /opt/perl/bin/h2xs -cn Password
2) cd Password; cp ../Password.xs .
3) Add "-ldce" to Makefile.PL
4) perl Makefile.pl LIB=my_lib
5) make install

The test script can be something simple as follows:

#!/opt/perl/bin/perl -w -I my_lib
use Password;
my ($pname, $opass, $npass);
my $st = Password::changePrincipalPasswd($pname,$opass,$npass);
if ($st) {
print "works\n";
}
else {
print "doh\n";
}

This is what I get when execute the test script:

$ ./test.pl
Memory fault(coredump)
$

And here's the output from gdb:

$ /usr/local/bin/gdb /opt/perl/bin/perl core
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "hppa2.0n-hp-hpux11.00"...(no debugging symbols found)...
Core was generated by `test.pl'.
Program terminated with signal 11, Segmentation fault.

warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the program.

Reading symbols from /usr/lib/libnsl.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libxti.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libnm.sl...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libsec.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libm.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libpthread.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libc.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libdld.2...(no debugging symbols found)...done.
Reading symbols from /appl/tmp/perl/PA-RISC1.1-thread-multi/auto/Password/Password.sl...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libdce.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libcma.2...(no debugging symbols found)...done.
#0 0xc004d704 in pthread_mutex_init () from /usr/lib/libpthread.1
(gdb) bt
#0 0xc004d704 in pthread_mutex_init () from /usr/lib/libpthread.1
#1 0xc0ba92bc in krb5_fcc_resolve () from /usr/lib/libdce.2
#2 0xc0a671a8 in sec_login_pvt_ccache_gennew () from /usr/lib/libdce.2
#3 0xc0a5e1a8 in allocate_krb_info () from /usr/lib/libdce.2
#4 0xc0a61198 in sec_login_pvt_allocate_login_context () from /usr/lib/libdce.2
#5 0xc0a5499c in sec_login_setup_identity () from /usr/lib/libdce.2
#6 0xc113a664 in XS_Password_changePrincipalPasswd () from /appl/tmp/perl/PA-RISC1.1-thread-multi/auto/Password/Password.sl
#7 0x000c3f68 in Perl_pp_entersub ()
#8 0x000ba8d4 in Perl_runops_standard ()
#9 0x000391c0 in S_run_body ()
#10 0x00038ea4 in perl_run ()
#11 0x000349f8 in main ()
(gdb)

System info:

HP-UX B.11.11 U 9000/800
gcc version 3.4.3
HP Perl D.5.8.0.G
$ swlist|grep -i dce
B3187B B.11.00.10 DCE/9000 CDS Server, Media and Manuals
B3188B B.11.00.10 DCE/9000 Security Server, Media and Manuals
B3192B B.11.00.10 Examples and OODCE Development Tools, Media and Manuals
B3864AA B.11.00.10 DCE/9000 DES Libraries, US & Canada Only
B6192AA B.11.11.10 DCE/9000 Programming & Administration Tools Media and Manuals
B6733AA B.11.00.10 DCE/9000 Kernel Threads Support
PHSS_28387 1.0 HP DCE/9000 1.8 Server/DevTools cum. patch
PHSS_29964 1.0 HP DCE/9000 1.8 DCE Client IPv6 patch

Any thoughts why this is happening?

I appreciate if anyone can help me.

Thanks and regards,

Adriano

3 REPLIES 3
Highlighted
Honored Contributor
Solution

Re: Perlxs DCE interface dumps core when built with gcc

libdce brings in libcma (user threads library) and libcma/libpthread (kernel threads library) cannot be mixed in the same executable. perl is linked with libpthread.

You should try linking with libdcekt (dce kernel threads version of libdce) instead of libdce.
Highlighted
Occasional Visitor

Re: Perlxs DCE interface dumps core when built with gcc

Hi Ermin,

I wish I had asked before. :) Problem solved!!! thanks a lot and have a nice day!!!

Adriano
Highlighted
Occasional Visitor

Re: Perlxs DCE interface dumps core when built with gcc

closed