Hi PerlMonks,
I have managed to resolve my linking issues and have generated a patch (diff -u) for the module. This works for our environment (GCC on AIX). Alas, I could not resolve one problem. PERLSVR core dumps upon initialization. It appears to be right at the point where perl_alloc() is called. Without PERLSVR one cannot create a Perl-based Tuxedo server. Fortunately all I need is a Tuxedo client.
I addressed a number of other issues that came up in our environment. These may not impact others, but have nonetheless been expressed in the following diff output.
$ diff -r -u Tuxedo-2.08 tuxrepo/Tuxedo-2.08 diff -r -u Tuxedo-2.08/Changes tuxrepo/Tuxedo-2.08/Changes --- Tuxedo-2.08/Changes 2005-06-08 18:33:28 -0700 +++ tuxrepo/Tuxedo-2.08/Changes 2015-05-25 14:07:01 -0700 @@ -18,3 +18,9 @@ AIX 5.2 64bit 5.8.4 xlC 8.1 64bit RP 107 HPUX 11.11 64bit 5.8.6 cc 8.1 64bit RP 107 WinXP SP2 5.8.6 VC++ 2003 8.1 + +2.?? - add support for GCC on AIX 6.1 (sans PERLSVR unfortunately) + operating system perl compiler tuxedo version +===================================================================== += + AIX 6.1 32bit 5.16.2 gcc 4.6.3 11.1_32 + diff -r -u Tuxedo-2.08/Makefile.PL tuxrepo/Tuxedo-2.08/Makefile.PL --- Tuxedo-2.08/Makefile.PL 2005-06-08 18:33:28 -0700 +++ tuxrepo/Tuxedo-2.08/Makefile.PL 2015-05-25 14:00:01 -0700 @@ -6,6 +6,13 @@ xsinit("perlxsi.c"); my $os = $^O; +my $gcc_aix = 0; + +if ( $os eq 'aix' ) { + if (index($Config{cc}, 'gcc ') == 0) { + $gcc_aix = 1; + } +} # get the ldopts used to build perl chop(my $ldopts = ldopts); @@ -34,6 +41,46 @@ ); +if ($gcc_aix) { + $opts{clean}{FILES} .= ' aix-buildserver'; +} + + +sub Check_tmloadcf +{ + # Apparently the CPAN module FindBin can do this, but + # we which to avoid additional dependencies here. + if ( !defined($ENV{PATH}) ) + { + print "PATH not defined.\n"; + die; + } + my @dirs = split(/:/, $ENV{PATH}); + my $found = 0; + foreach my $d (@dirs) + { + if ( -x "$d/tmloadcf" ) + { + $found = 1; + print "$d/tmloadcf found.\n"; + last; + } + } + if (!$found) + { + print "tmloadcf executable not found.\n"; + die; + } +} + + +if ( !defined($ENV{TUXDIR}) ) +{ + print "TUXDIR not defined.\n"; + die; +} + + # --- How shall we link with Tuxedo? if ( $os eq 'MSWin32' ) { @@ -41,9 +88,10 @@ $opts{DEFINE} = "-D__TURBOC__"; } -# -- unix variants..tested on solaris +# -- unix variants..tested on solaris and aix else { + Check_tmloadcf(); $buildclient_cmd = `buildclient -v 2>/dev/null`; @buildclient_options = split( / /, $buildclient_cmd ); @lib_options = grep /-[LlR]/, @buildclient_options; @@ -52,11 +100,70 @@ #print "libs = $libs\n"; $opts{LIBS} = [ $libs ]; $opts{LDDLFLAGS} = $Config{lddlflags} . " " . $dynaloader_lib; + if ( $gcc_aix ) { + # -- Tested with AIX 6.1, gcc 4.6.3, Perl 5.16.2 and Tuxedo 1 +1.1. + # Your mileage may vary. + if ( !defined($ENV{LIBPATH}) ) + { + print "LIBPATH not defined.\n"; + die; + } + if ( !defined($ENV{TUXCONFIG}) ) + { + print "TUXCONFIG not defined.\n"; + print "Consider running the command:\n"; + print "export TUXCONFIG=\$(pwd)/TUXCONFIG\n"; + die; + } + $opts{LIBS} = [ "-L$ENV{TUXDIR}/lib -ltux -lbuft -lfml -lfml3 +2 -lengine" ]; + $opts{LDDLFLAGS} = $Config{lddlflags} . " -Wl,-bernotok " . $ +dynaloader_lib; + $opts{OBJECT} .= " $ENV{TUXDIR}/lib/tpinit.o"; + } } -WriteMakefile( %opts ); + +sub CreateAixScript +{ + my $string = qq{ +trap 'rm -f \$\$.\$SERVER_MAIN \$SERVER_MAIN' EXIT + +# Get CC compile command and strip out AIX-specific link options +set -A CCSERVER -- \$(CC="echo \$CC" \$TUXDIR/bin/buildserver -k \${1 +:+"\$@"} \\ + | sed -e 's/-brtl *//g' \\ + -e 's/-qstaticinline *//g' \\ + -e 's/-qrtti=all *//g') + +# Add time.h to eliminate warnings +SERVER_MAIN=\${CCSERVER[7]} + +sed '1 i\\ +#include <time.h> + +' \$SERVER_MAIN > \$\$.\$SERVER_MAIN && mv -f \$\$.\$SERVER_MAIN \$S +ERVER_MAIN + +# Execute Compilation +COMPILE_CMD=\$(echo "\${CCSERVER[@]}" | sed -e's/-Wl,-Wl,-bdynamic/-W +l,-bdynamic/') +echo COMPILE_CMD=\$COMPILE_CMD +\$COMPILE_CMD +SERVER_EXIT=\$? + +exit \$SERVER_EXIT +}; + + print "Writing aix-buildserver\n"; + open(AIXSCRIPT, ">aix-buildserver") or die; + print AIXSCRIPT "#!/usr/bin/ksh\n"; + print AIXSCRIPT $string; + close(AIXSCRIPT) or die; + chmod(0755, "aix-buildserver") or die; +} +WriteMakefile( %opts ); +if ($gcc_aix) { + CreateAixScript(); +} + sub MY::postamble { my $string = <<EOS; @@ -76,6 +183,11 @@ buildserver -o \$@ -k -s "PERL" -f "-DTMMAINEXIT \$(INST_STATIC)" EOS } +elsif ( $gcc_aix ) { + $string = $string . <<EOS; + CC="$Config{cc} $libpaths"; export CC; \$(PWD)/aix-buildserver -o + \$@ -s ":PERL" -f "\$(INST_DYNAMIC)" -f "\$(PERL_EMBED_LIBS)" +EOS +} else { $string = $string . <<EOS; CC="$Config{cc} $libpaths"; export CC; \$(TUXDIR)/bin/buildserver + -o \$@ -s ":PERL" -f "\$(INST_DYNAMIC)" -f "\$(PERL_EMBED_LIBS)" diff -r -u Tuxedo-2.08/README tuxrepo/Tuxedo-2.08/README --- Tuxedo-2.08/README 2005-06-08 18:33:28 -0700 +++ tuxrepo/Tuxedo-2.08/README 2015-05-22 09:16:11 -0700 @@ -18,7 +18,7 @@ The steps to build the module are... -1/ perl Makefile.pl +1/ perl Makefile.PL 2/ make test diff -r -u Tuxedo-2.08/genubbconfig.pl tuxrepo/Tuxedo-2.08/genubbconfi +g.pl --- Tuxedo-2.08/genubbconfig.pl 2005-06-08 18:33:28 -0700 +++ tuxrepo/Tuxedo-2.08/genubbconfig.pl 2015-05-25 14:00:38 -0700 @@ -1,5 +1,14 @@ +use Config; my $os = $^O; +my $gcc_aix = 0; +my $next_line_too = 0; + +if ( $os eq 'aix' ) { + if (index($Config{cc}, 'gcc ') == 0) { + $gcc_aix = 1; + } +} ############# Global Variables ############## my $cwd; @@ -20,6 +29,8 @@ } my $tuxconfig = $cwd . "\/TUXCONFIG"; +my $hostname_no_dots = $hostname; +$hostname_no_dots =~ s/[.]/_/g; ################################################ @@ -125,6 +136,10 @@ $hostname; /eg; + s/<HOSTNAME_NO_DOTS>/ + $hostname_no_dots; + /eg; + s/<TUXDIR>/ $ENV{TUXDIR}; /eg; @@ -141,7 +156,23 @@ get_wsnaddr() . ""; /eg; - printf UBBCONFIG $_; + # Unfortunately PERLSVR fails with AIX 6.1 and 32-bit GCC 4.6 +.3 + # for unknown reasons. The failure appears to happen in + # tpsvrinit() where perl_alloc() is called. + if (($gcc_aix) && (/^PERLSVR/)) + { + printf UBBCONFIG "#$_"; + $next_line_too = 1; + } + elsif (($gcc_aix) && ($next_line_too)) + { + printf UBBCONFIG "#$_"; + $next_line_too = 0; + } + else + { + printf UBBCONFIG $_; + } } close( TEMPLATE ); diff -r -u Tuxedo-2.08/test.pl tuxrepo/Tuxedo-2.08/test.pl --- Tuxedo-2.08/test.pl 2005-06-08 18:33:28 -0700 +++ tuxrepo/Tuxedo-2.08/test.pl 2015-05-25 13:57:39 -0700 @@ -11,8 +11,18 @@ use Tuxedo; use tpadm; use testflds; +use Config; require "genubbconfig.pl"; +my $os = $^O; +my $gcc_aix = 0; + +if ( $os eq 'aix' ) { + if (index($Config{cc}, 'gcc ') == 0) { + $gcc_aix = 1; + } +} + # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 @@ -24,7 +34,14 @@ ################################################################### tuxputenv( "TUXCONFIG=" . get_tuxconfig() ); $path = tuxgetenv( "PATH" ); -tuxputenv( "PATH=$path;./blib/arch/auto/Tuxedo" ); +if ( $os eq 'MSWin32' ) +{ + tuxputenv( "PATH=$path;./blib/arch/auto/Tuxedo" ); +} +else +{ + tuxputenv( "PATH=$path:./blib/arch/auto/Tuxedo" ); +} system( "tmshutdown -y" ); gen_ubbconfig(); @@ -277,19 +294,27 @@ $string->value( "fat boy" ); printf( "\$string = " . $string->value . "\n" ); -# Test PERLSVR TOUPPER -$rval = tpcall( "TOUPPER", $string, 0, $string, $len, 0 ); -if ( $rval == -1 ) { - die ( "tpcall failed: " . tpstrerror(tperrno) . "\n" ); -} -printf( "\$string = " . $string->value . "\n" ); - -# Test PERLSVR REVERSE -$rval = tpcall( "REVERSE", $string, 0, $string, $len, 0 ); -if ( $rval == -1 ) { - die ( "tpcall failed: " . tpstrerror(tperrno) . "\n" ); +# Skip PERLSVR for AIX 6.1 32-bit GCC 4.6.3 +if ($gcc_aix) +{ + print "Skip PERLSVR for gcc on aix\n"; +} +else +{ + # Test PERLSVR TOUPPER + $rval = tpcall( "TOUPPER", $string, 0, $string, $len, 0 ); + if ( $rval == -1 ) { + die ( "tpcall failed: " . tpstrerror(tperrno) . "\n" ); + } + printf( "\$string = " . $string->value . "\n" ); + + # Test PERLSVR REVERSE + $rval = tpcall( "REVERSE", $string, 0, $string, $len, 0 ); + if ( $rval == -1 ) { + die ( "tpcall failed: " . tpstrerror(tperrno) . "\n" ); + } + printf( "\$string = " . $string->value . "\n" ); } -printf( "\$string = " . $string->value . "\n" ); # TEST 5: tpterm $rval = tpterm(); diff -r -u Tuxedo-2.08/ubbconfig.template tuxrepo/Tuxedo-2.08/ubbconfi +g.template --- Tuxedo-2.08/ubbconfig.template 2005-06-08 18:33:28 -0700 +++ tuxrepo/Tuxedo-2.08/ubbconfig.template 2015-05-22 12:05:17 -070 +0 @@ -1,19 +1,21 @@ *RESOURCES IPCKEY <IPCKEY> MODEL SHM -MASTER <HOSTNAME> +MASTER <HOSTNAME_NO_DOTS> +MAXACCESSERS 100 +MAXSERVERS 120 *MACHINES "<HOSTNAME>" - LMID="<HOSTNAME>" + LMID="<HOSTNAME_NO_DOTS>" TUXDIR="<TUXDIR>" APPDIR="<APPDIR>" TUXCONFIG="<TUXCONFIG>" MAXWSCLIENTS=10 *GROUPS -TUXGRP LMID=<HOSTNAME> GRPNO=1 -APPGRP LMID=<HOSTNAME> GRPNO=2 +TUXGRP LMID=<HOSTNAME_NO_DOTS> GRPNO=1 +APPGRP LMID=<HOSTNAME_NO_DOTS> GRPNO=2 *SERVERS #WSL SRVID=1 SRVGRP=TUXGRP
Regards,
-Randy
In reply to Re^3: Tuxedo CPAN module on AIX 6.1
by randygalbraith
in thread Tuxedo CPAN module on AIX 6.1
by randygalbraith
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |