randygalbraith has asked for the wisdom of the Perl Monks concerning the following question:
The wisdom I'm seeking relates to Perl DynaLoader on IBM AIX. Specifically in regards to the Tuxedo-2.08 module on IBM AIX. This module will allow me to create a Perl program to call a service within a Tuxedo domain. Tuxedo is Oracle's middleware for C, originally from BEA.
Here are my details:$ uname -a AIX hostname 1 6 00CBD3124C00 $ gcc --version gcc (GCC) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. $ perl --version This is perl 5, version 16, subversion 2 (v5.16.2) built for aix-threa +d-multi-64int $ echo $TUXDIR /opt/tuxedo/11.1_32
An initial attempt to compile the module fails in a way we've seen before, let me demo this... With AIX 6.1, gcc 4.6.3, Perl 5.16.2 and Tuxedo 11.1 I do this...
$ tar zxvf Tuxedo-2.08.tar.gz Tuxedo-2.08/ Tuxedo-2.08/testflds <snip> $ cd Tuxedo-2.08/ $ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Tuxedo Writing MYMETA.yml and MYMETA.json $ make --version GNU Make 4.0 Built for powerpc-ibm-aix6.1.0.0 $ make test cp tpadm.pm blib/lib/tpadm.pm cp genubbconfig.pl blib/lib/genubbconfig.pl <snip> CC="gcc -maix32 -L/usr/local/lib -L/path/to/perl-5.16.2/powerpc-AIX6.1 +/lib/CORE"; export CC; /opt/tuxedo/11.1_32/bin/buildserver -o PERLSVR + -s ":PERL" -f "blib/arch/auto/Tuxedo/Tuxedo.so" -f "-Xlinker -bE:/pa +th/to/perl-5.16.2/powerpc-AIX6.1/lib/CORE/perl.exp -Wl,-brtl -Wl,-bd +ynamic -Wl,-b32 -Wl,-bmaxdata:0x80000000 -lperl -lbind -lnsl -ldl -l +ld -lm -lcrypt -lpthreads -lc" gcc: error: unrecognized option '-brtl' gcc: error: unrecognized option '-qstaticinline' gcc: error: unrecognized option '-qrtti=all' gcc: error: unrecognized option '-brtl' gcc: error: unrecognized option '-qstaticinline'
The problem here is "buildserver" issues a gcc command that includes these -b and -q linker options. Older versions of gcc probably did not mind this, but it does now. Fortunately, we've fixed this in our environment by writing a script that runs buildserver to extract the compile command then using sed edit out these offending options. If I do that I can get past these gcc errors. Admittedly, this approach may be where I go off the rails, however I can report our custom script works for building Tuxedo server processes for our development group on AIX many times a day.
So.. lets do this again, but now with a replacement for buildserver...
$ rm -rf Tuxedo-2.08 $ tar zxvf Tuxedo-2.08.tar.gz $ cp Makefile.PL Tuxedo-2.08/. $ cd Tuxedo-2.08/ $ perl Makefile.PL perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Tuxedo Writing MYMETA.yml and MYMETA.json
My custom Makefile.PL creates a script called aix-buildserver, so when we run...
$ make test <snip> CC="gcc -maix32 -L/usr/local/lib -L/path/to/perl-5.16.2/powerpc-AIX6.1 +/lib/CORE"; export CC; ./aix-buildserver -o PERLSVR -s ":PERL" -f "bl +ib/arch/auto/Tuxedo/Tuxedo.so" -f "-Xlinker -bE:/path/to/perl-5.16.2/ +powerpc-AIX6.1/lib/CORE/perl.exp -Wl,-brtl -Wl,-bdynamic -Wl,-b32 -W +l,-bmaxdata:0x80000000 -lperl -lbind -lnsl -ldl -lld -lm -lcrypt -lp +threads -lc"
I have the script report the gcc command it built as follows...
COMPILE_CMD=gcc -maix32 -L/usr/local/lib -L/path/to/perl-5.16.2/powerp +c-AIX6.1/lib/CORE -I/opt/tuxedo/11.1_32/include -o PERLSVR BS-1d301fe +.c -L/opt/tuxedo/11.1_32/lib blib/arch/auto/Tuxedo/Tuxedo.so -Xlinker + -bE:/path/to/perl-5.16.2/powerpc-AIX6.1/lib/CORE/perl.exp -Wl,-bdyna +mic -Wl,-b32 -Wl,-bmaxdata:0x80000000 -lperl -lbind -lnsl -ldl -lld - +lm -lcrypt -lpthreads -lc -ltux -lbuft -lfml -lfml32 -lengine -lpthre +ad
Running $COMPILE_CMD, works without problem. In fact the PERLSVR executable can be run. But look what happens when Perl attempts to load Tuxedo.so:
PERL_DL_NONLAZY=1 /path/to/powerpc-AIX6.1/bin/perl "-Iblib/lib" "-Ibli +b/arch" test.pl 1..1 Can't load 'blib/arch/auto/Tuxedo/Tuxedo.so' for module Tuxedo: rtld: +0712-001 Symbol tptypes was referenced from module blib/arch/auto/Tuxedo/Tuxedo.so(), but a runtime def +inition of the symbol was not found.
It goes on to complain about several other not-found-symbols before finally giving up.
It looks like something is going awry in DynaLoader.pm where "use Tuxedo;" appears in test.pl, but what?
Here is the rest of my efforts expressed as a FAQ...
Q. Does Tuxedo.so reference tptypes?$ file blib/arch/auto/Tuxedo/Tuxedo.so blib/arch/auto/Tuxedo/Tuxedo.so: executable (RISC System/6000) or obje +ct module not stripped
Q. Is your LIBPATH (AIX version of LD_LIBRARY_PATH) set correctly?$ nm blib/arch/auto/Tuxedo/Tuxedo.so|grep tptypes .XS_Tuxedo_tptypes t 268483616 .tptypes T 268439336 .tptypes t 268439336 40 XS_Tuxedo_tptypes d 536874984 12 XS_Tuxedo_tptypes d 536876760 4 tptypes U - tptypes d 536876124 4
Q. Is tptypes in libtux?$ echo $LIBPATH /opt/tuxedo/11.1_32/lib $ ls $LIBPATH/libtux.a $LIBPATH/libtux.so /opt/tuxedo/11.1_32/lib/libtux.a /opt/tuxedo/11.1_32/lib/libtux.so
Q. Have you tried debugging via DynaLoader?$ nm /opt/tuxedo/11.1_32/lib/libtux.so|grep tptypes .tptypes T 208392 tptypes D 57036 12 $ nm /opt/tuxedo/11.1_32/lib/libtux.a|grep tptypes .tptypes T 208392 tptypes D 57036 12
Q. Have you tried debugging via the bootstrap file?$ PERL_DL_DEBUG=1 PERL_DL_NONLAZY=1 /path/to/powerpc-AIX6.1/bin/perl " +-Iblib/lib" "-Iblib/arch" test.pl 1..1 DynaLoader.pm loaded (blib/lib blib/arch /path/to/lib/perl5/site_perl +/home/myname/lib/perl5/site_perl /path/to/perl-5.16.2/powerpc-AIX6.1/ +lib/site_perl /path/to/perl-5.16.2/powerpc-AIX6.1/lib ., /usr/local/l +ib /lib /usr/lib /usr/ccs/lib /opt/tuxedo/11.1_32/lib) DynaLoader::bootstrap for Tuxedo (auto/Tuxedo/Tuxedo.so) Can't load 'blib/arch/auto/Tuxedo/Tuxedo.so' for module Tuxedo: rtld: +0712-001 Symbol tptypes was referenced from module blib/arch/auto/Tuxedo/Tuxedo.so(), but a runtime def +inition of the symbol was not found. <snip> at test.pl line 11. Compilation failed in require at test.pl line 11. BEGIN failed--compilation aborted at test.pl line 11. not ok 1
Q. Do you have other Perl CPAN modules that work?$ cat blib/arch/auto/Tuxedo/Tuxedo.bs print "Hello, dynaloader bootstrap...\n"; print "(before) dl_resolve_using=@dl_resolve_using\n"; @dl_resolve_using = dl_findfile('-ltux'); print "(after) dl_resolve_using=@dl_resolve_using\n"; $ PERL_DL_NONLAZY=1 /path/to/powerpc-AIX6.1/bin/perl "-Iblib/lib" "-Ib +lib/arch" test.pl 1..1 Hello, dynaloader bootstrap... (before) dl_resolve_using= (after) dl_resolve_using=/opt/tuxedo/11.1_32/lib/libtux.a Can't load 'blib/arch/auto/Tuxedo/Tuxedo.so' for module Tuxedo: rtld: +0712-001 Symbol tptypes was referenced from module blib/arch/auto/Tuxedo/Tuxedo.so(), but a runtime def +inition of the symbol was not found.
Q. Have you thought of moving from AIX to GNU/Linux?$ find /path/to/perl-5.16.2/ -name '*.so'|wc 68 68 4675
Thanks for reading. If you're able to help, thanks in advance. If I can resolve this I'll post the results back here.
Regards,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tuxedo CPAN module on AIX 6.1
by Corion (Patriarch) on May 22, 2015 at 06:28 UTC | |
by Anonymous Monk on May 22, 2015 at 13:25 UTC | |
by randygalbraith (Initiate) on May 25, 2015 at 21:24 UTC | |
|
Re: Tuxedo CPAN module on AIX 6.1
by Anonymous Monk on May 22, 2015 at 00:46 UTC |