develooper Front page | perl.perl5.porters | Postings from March 2006

Question about dynamic libraries on AIX 5.1

Thread Next
From:
John L. Allen
Date:
March 20, 2006 14:40
Subject:
Question about dynamic libraries on AIX 5.1
Message ID:
Pine.GSO.4.53.0603201612360.20807@gateway.northropgrumman.com

I am having trouble with the Math::Pari module on AIX 5.1 with Perl 588.
I have been corresponding with Ilya Zakarevich about it but this problem
may need more AIX expertise than he or I have.

I builds ok and mostly tests ok, but the factoring of certain large
integers core dumps because the libbsd.a pow() function is being
called instead of the libm.a pow() function.  Vis:

Segmentation fault in pow.pow [/usr/lib/libbsd.a] at 0xd015442c ($t1)
0xd015442c (pow+0x68) 7f84eaae       lhax   r28,r4,r29
(dbx) where
pow.pow(??, ??, ??, ??) at 0xd015442c
mpqs(0x302633e4), line 3117 in "mpqs.c"
ifac_crack(0x2ff205c0, 0x2ff20530), line 3575 in "ifactor1.c"
ifac_main(0x2ff205c0), line 3845 in "ifactor1.c"
ifac_decomp_break(0x302633e4, 0x0, 0x3031fa28, 0x0),
  line 3981 in "ifactor1.c"
auxdecomp1(0x302633e4, 0x0, 0x3031fa28, 0x1, 0x0), line 498 in "arith2.c"
auxdecomp0(0x307758e8, 0x1, 0x0), line 539 in "arith2.c"
factorint(0x307758e8, 0x0), line 553 in "arith2.c"
unnamed block $b275, line 1833 in "Pari.xs"
unnamed block $b274, line 1833 in "Pari.xs"
XS_Math__Pari_interface_flexible_gen(0x3023c978, 0x307d7304),
  line 1833 in "Pari.xs"

The problem is that the libbsd pow() expects 4 arguments, but mpqs.c
is obviously only passing two.

But Pari.so was not even linked with libbsd.a:

  ld -bhalt:4 -bexpall -G -bnoentry -lc128 -lpthreads -lc Pari.o \
    -o blib/arch/auto/Math/Pari/Pari.so libPARI/libPARI.a -lm

[Putting -lm first makes no difference.]

libPARI.a does not define a pow() function either since it was
created with ar:

  rm -f libPARI.a
  ar  cr libPARI.a es.o base5.o bibli1.o buch2.o init.o gen1.o galconj.o
   trans3.o buch4.o sumiter.o polarit2.o gen3.o alglin2.o stark.o errmsg.o
   arith1.o helpmsg.o buch1.o nffactor.o galois.o plotgnuplot.o subfield.o
   gen2.o highlvl.o arith2.o polarit1.o subgroup.o alglin1.o base2.o
   polarit3.o ifactor1.o base1.o bibli2.o plotport.o trans2.o trans1.o
   kummer.o buch3.o elliptic.o mpqs.o thue.o base4.o rootpol.o anal.o
   compat.o base3.o kernel.o mp.o mpinl.o

So this must mean it is getting it from perl itself?  Or if not,
how _is_ it getting the libbsd.a pow() function?  Is there some
dynamic linking weirdness going on here?

My perl -V is below.

John.
-----------
$ perl588 -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=aix, osvers=5.1.0.0, archname=aix-thread-multi-64int-ld
    uname='aix baewi168 1 5 0001542a4c00 '
    config_args='-des -Dprefix=/prod/free/perl588 -Dusemorebits
-Dusethreads -Dc
c=xlc -Accflags=-DAPPLLIB_EXP=\"/prod/libperl\"'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=de
fine
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc_r', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem
=-1 -qnoansialias -qlongdouble -DUSE_NATIVE_DLOPEN
-DAPPLLIB_EXP="/prod/libperl"
 -DNEED_PTHREAD_INIT -q32 -D_LARGE_FILES -qlonglong',
    optimize='-O',
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoans
ialias -qlongdouble -DUSE_NATIVE_DLOPEN -DAPPLLIB_EXP="/prod/libperl"
-DNEED_PTH
READ_INIT'
    ccversion='5.0.2.8', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long long', ivsize=8, nvtype='long double', nvsize=16,
Off_t='off_t'
, lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -brtl -bdynamic -bmaxdata:0x80000000 -b32'
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lc128 -lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc
-lbsd
    perllibs=-lc128 -lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
-lbsd
    libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-bE:/prod/free/perl
588/lib/5.8.8/aix-thread-multi-64int-ld/CORE/perl.exp'
    cccdlflags=' ', lddlflags='-bhalt:4 -bexpall -G -bnoentry -lc128
	-lpthreads -lc'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_LONG_DOUBLE
                        USE_PERLIO USE_REENTRANT_API
  Built under aix
  Compiled at Feb 24 2006 14:26:24
  @INC:
    /prod/libperl/5.8.8
    /prod/libperl
    /prod/free/perl588/lib/5.8.8/aix-thread-multi-64int-ld
    /prod/free/perl588/lib/5.8.8
    /prod/free/perl588/lib/site_perl/5.8.8/aix-thread-multi-64int-ld
    /prod/free/perl588/lib/site_perl/5.8.8
    /prod/free/perl588/lib/site_perl
    .


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About