perlaix(1)
Perl version 5 on IBM AIX (UNIX) systems
Description
PERLAIX
NAME
perlaix - Perl version 5 on IBM AIX (UNIX) systems
DESCRIPTION
This document describes various features of IBM ’s UNIX operating system AIX that will affect how Perl version 5 (hereafter just Perl) is compiled and/or runs.
Compiling Perl 5 on AIX
For information on compilers on older versions of AIX, see "Compiling Perl 5 on older AIX versions up to 4.3.3".
When compiling Perl, you must use an ANSI C compiler. AIX does not ship an ANSI compliant C compiler with AIX by default, but binary builds of gcc for AIX are widely available. A version of gcc is also included in the AIX Toolbox which is shipped with AIX.
Supported Compilers
Currently all versions of IBM ’s "xlc", "xlc_r", "cc", "cc_r" or "vac" ANSI/C compiler will work for building Perl if that compiler works on your system.
If you plan to link Perl to any module that requires thread-support, like DBD::Oracle, it is better to use the _r version of the compiler. This will not build a threaded Perl, but a thread-enabled Perl. See also "Threaded Perl" later on.
As of writing (2010-09) only the IBM XL C for AIX or IBM XL C/C ++ for AIX compiler is supported by IBM on AIX 5L/6.1/7.1.
The following compiler versions are currently supported by IBM:
IBM XL C and IBM XL C/C++ V8, V9, V10, V11
The XL C for AIX is integrated in the XL C/C ++for AIX compiler and therefore alsosupported.
If you choose XL C/C ++ V9 youneedAPARIZ35785installedotherwisetheintegrated SDBM_Filedonotcompilecorrectlyduetoanoptimizationbug.Youcan circumvent this problem byadding-qipatotheoptimizationflags(-Doptimize=’-O-qipa’).ThePTFfor APARIZ35785whichsolvesthisproblemisavailablefromIBM(April2009PTFforXL C/C++ EnterpriseEditionforAIX,V9.0).
If you chooseXLC/C++V11youneedtheApril2010PTF(ornewer)installedotherwiseyou willnotgetaworkingPerlversion.
PerlcanbecompiledwitheitherIBM’s ANSI C compiler or with gcc. The former is recommended, as not only it can compile Perlwithnodifficulty,butalsocantake advantageoffeatureslistedlaterthat require the use of IBM compiler-specific command-lineflags.
Ifyoudecidetousegcc,makesureyourinstallationisrecentandcomplete,andbesureto readthePerlINSTALLfileformoregcc-specificdetails.Pleasereportanyhoopsyouhad tojumpthroughtothedevelopmentteam.
IncompatibilitywithAIXToolboxlibgdbm
If theAIXToolboxversionoflibgdbm<1.8.3-5isinstalledonyoursystemthenPerlwill not work. This library contains the header files /opt/freeware/include/gdbm/dbm.h|ndbm.h which conflict with the AIX system versions.Thelibgdbmwillbeautomaticallyremovedfromthewanted libraries if the presence of oneofthesetwoheaderfilesisdetected.IfyouwanttobuildPerlwithGDBM supportthenpleaseinstallatleastgdbm-devel-1.8.3-5(orhigher).
Perl5wassuccessfullycompiledandtestedon:
Perl|AIXLevel|CompilerLevel|wth|w/oth
-------+---------------------+-------------------------+------+-------
5.12.2|5.1TL932bit|XLC/C++V7|OK|OK
5.12.2|5.1TL964bit|XLC/C++V7|OK|OK
5.12.2|5.2TL10SP832bit|XLC/C++V8|OK|OK
5.12.2|5.2TL10SP832bit|gcc3.2.2|OK|OK
5.12.2|5.2TL10SP864bit|XLC/C++V8|OK|OK
5.12.2|5.3TL8SP832bit|XLC/C++V9+IZ35785|OK|OK
5.12.2|5.3TL8SP832bit|gcc4.2.4|OK|OK
5.12.2|5.3TL8SP864bit|XLC/C++V9+IZ35785|OK|OK
5.12.2|5.3TL10SP332bit|XLC/C++V11+Apr2010|OK|OK
5.12.2|5.3TL10SP364bit|XLC/C++V11+Apr2010|OK|OK
5.12.2|6.1TL1SP732bit|XLC/C++V10|OK|OK
5.12.2|6.1TL1SP764bit|XLC/C++V10|OK|OK
5.13|7.1TL0SP132bit|XLC/C++V11+Jul2010|OK|OK
5.13|7.1TL0SP164bit|XLC/C++V11+Jul2010|OK|OK
wth=withthreadsupport
w/oth=withoutthreadsupport
OK=tested
Successfullytestedmeansthatall"maketest"runsfinishwitharesultof100% OK. All testswereconductedwith-Duseshrplibset.
All tests were conductedontheoldestsupportedAIXtechnologylevelwiththelatest supportpackageapplied.IfthetestedAIXversionisoutofsupport(AIX4.3.3,5.1,5.2) thenthelastavailablesupportlevelwasused.
BuildingDynamicExtensionsonAIX
StartingfromPerl5.7.2(andconsequently5.8.x/5.10.x/5.12.x)andAIX4.3 or newer Perl usestheAIXnativedynamicloadinginterfaceinthesocalledruntimelinkingmode insteadoftheemulatedinterfacethatwasusedinPerlreleases5.6.1andearlieror,for AIXreleases4.2andearlier.This change does break backward compatibility with compiled modules from earlier Perl releases. ThechangewasmadetomakePerlmore compliantwithotherapplicationslikeApache/mod_perlwhichareusingtheAIX native interface. This change also enablestheuseofC++codewithstaticconstructorsand destructorsinPerlextensions,whichwasnotpossibleusingtheemulatedinterface.
Itishighlyrecommendedtousethenewinterface.
UsingLargeFileswithPerl
Shouldyieldnoproblems.
ThreadedPerl
ShouldyieldnoproblemswithAIX5.1/5.2/5.3/6.1/7.1.
IBMusestheAIXsystemPerl(V5.6.0onAIX5.1andV5.8.2onAIX5.2/5.3and6.1;V5.8.8 on AIX 5.3TL11andAIX6.1TL4;V5.10.1onAIX7.1)forsomeAIXsystemscripts.Ifyouswitch thelinksin/usr/binfromtheAIXsystemPerl(/usr/opt/perl5)tothenewly build Perl then you getthesamefeaturesaswiththeIBMAIXsystemPerlifthethreadedoptionsare used.
ThethreadedPerlbuildworksalsoonAIX5.1buttheIBMPerlbuild(Perl v5.6.0) is not threadedonAIX5.1.
Perl5.12annewerisnotcompatiblewiththeIBMfilesetperl.libext.
64-bitPerl
If your AIX system is installed with 64-bit support, you can expect 64-bit configurationstowork.Ifyouwanttouse64-bitPerlonAIX6.1you need an APAR for a libc.a bug which affects (n)dbm_XXX functions.TheAPARnumberforthisproblemis IZ39077.
Ifyouneedmorememory(largerdatasegment)foryourPerlprogramsyoucanset:
/etc/security/limits
default:(oryouruser)
data=-1(defaultis262144*512byte)
Withthedefaultsettingthesizeislimitedto128MB.The-1removesthis limit. If the "maketest"failspleasechangeyour/etc/security/limitsasstatedabove.
Longdoubles
IBM calls its implementation of longdoubles128-bit,butitisnottheIEEE128-bit ("quadrupleprecision")whichwouldgive116bitofmantissa(noritis implemented in hardware), instead it’saspecialsoftwareimplementationcalled"double-double", whichgives106bitsofmantissa.
Thereseemtobevariousproblemsinthis long double implementation. If Configure detectsthisbrokenness,itwilldisablethelongdoublesupport.Thiscanbeoverridden withexplicit"-Duselongdouble"(or"-Dusemorebits",whichenablesbothlongdoubles and 64 bitintegers).Ifyoudecidetoenablelongdoubles,formostofthebrokenthings Perlhasimplementedworkarounds,butthehandlingofthespecialvalues infinity and NaNremainsbadlybroken:forexampleinfinitypluszeroresultsinNaN.
RecommendedOptionsAIX5.1/5.2/5.3/6.1and7.1(threaded/32-bit)
With thefollowingoptionsyougetathreadedPerlversionwhichpassesallmaketestsin threaded32-bitmode,whichisthedefaultconfigurationforthePerl builds that AIX shipswith.
rmconfig.sh
./Configure\
-d\
-Dcc=cc_r\
-Duseshrplib\
-Dusethreads\
-Dprefix=/usr/opt/perl5_32
The -Dprefix optionwillinstallPerlinadirectoryparalleltotheIBMAIXsystemPerl installation.
RecommendedOptionsAIX5.1/5.2/5.3/6.1and7.1(32-bit)
WiththefollowingoptionsyougetaPerlversionwhichpassesallmake tests in 32-bit mode.
rmconfig.sh
./Configure\
-d\
-Dcc=cc_r\
-Duseshrplib\
-Dprefix=/usr/opt/perl5_32
The -Dprefix optionwillinstallPerlinadirectoryparalleltotheIBMAIXsystemPerl installation.
RecommendedOptionsAIX5.1/5.2/5.3/6.1and7.1(threaded/64-bit)
WiththefollowingoptionsyougetathreadedPerlversionwhichpassesallmaketests in 64-bitmode.
exportOBJECT_MODE=64/setenvOBJECT_MODE64(dependingonyourshell)
rmconfig.sh
./Configure\
-d\
-Dcc=cc_r\
-Duseshrplib\
-Dusethreads\
-Duse64bitall\
-Dprefix=/usr/opt/perl5_64
RecommendedOptionsAIX5.1/5.2/5.3/6.1and7.1(64-bit)
With the following optionsyougetaPerlversionwhichpassesallmaketestsin64-bit mode.
exportOBJECT_MODE=64/setenvOBJECT_MODE64(dependingonyourshell)
rmconfig.sh
./Configure\
-d\
-Dcc=cc_r\
-Duseshrplib\
-Duse64bitall\
-Dprefix=/usr/opt/perl5_64
The-DprefixoptionwillinstallPerlinadirectoryparalleltotheIBMAIX system Perl installation.
Ifyouchoosegcctocompile64-bitPerlthenyouneedtoaddthefollowingoption:
-Dcc='gcc-maix64'
CompilingPerl5onAIX7.1.0
AregressioninAIX7causesafailureinmaketestinTime::Pieceduringdaylightsavings time. APAR IV16514 provides the fix for this.Aquicktesttoseeifit’srequired, assumingitiscurrentlydaylightsavingsinEasternTime,wouldbetorun"TZ=EST5 date +%Z".Thiswillcomebackwith"EST"normally,butnothingifyouhavetheproblem.
CompilingPerl5onolderAIXversionsupto4.3.3
Due to the fact that AIX 4.3.3 reached end-of-service inDecember31,2003this informationisprovidedasis.ThePerlversionspriortoPerl5.8.9couldbecompiled on AIXupto4.3.3withthefollowingsettings(yourmileagemayvary):
When compiling Perl,youmustuseanANSICcompiler.AIXdoesnotshipanANSIcompliant C-compilerwithAIXbydefault,butbinarybuildsofgccforAIXarewidelyavailable.
Atthemomentofwriting,AIXsupportstwodifferentnativeCcompilers, for which you havetopay:xlCandvac.Ifyoudecidetouseeitherofthesetwo(whichisquitealoteasier thanusinggcc),besuretoupgradetothelatestavailablepatchlevel.Currently:
xlC.C3.1.4.10or3.6.6.0or4.0.2.2or5.0.2.9or6.0.0.3
vac.C4.4.0.3or5.0.2.6or6.0.0.1
notethatxlChastheOSversioninthenameasofversion4.0.2.0,soyouwillfindxlC.Cfor AIX-5.0aspackage
xlC.aix50.rte5.0.2.0or6.0.0.3
subversionsarenotthesame"latest"onallOSversions.Forexample,thelatestxlC-5on aix41is5.0.2.9,whileonaix43,itis5.0.2.7.
Perl can be compiled with either IBM’s ANSI C compilerorwithgcc.Theformeris recommended,asnotonlycanitcompilePerl with no difficulty, but also can take advantage of features listed later that requiretheuseofIBMcompiler-specific command-lineflags.
TheIBM’scompilerpatchlevels5.0.0.0and5.0.1.0have compiler optimization bugs that affect compiling perl.candregcomp.c,respectively.IfPerl’sconfiguration detectsthosecompilerpatchlevels,optimizationisturnedoffforthesaidsourcecode files.Upgradingtoatleast5.0.2.0isrecommended.
Ifyoudecidetousegcc,makesureyourinstallationisrecentandcomplete,andbesureto readthePerlINSTALLfileformoregcc-specificdetails.Pleasereportanyhoopsyouhad tojumpthroughtothedevelopmentteam.
OSlevel
BeforeinstallingthepatchestotheIBMC-compileryouneedtoknowthelevelofpatching fortheOperatingSystem.IBM’scommand’oslevel’willshowthebase,butis not always complete (in thisexampleoslevelshows4.3.NULL,whereasthesystemmightrunmostof 4.3.THREE):
#oslevel
4.3.0.0
#lslpp-l|grep'bos.rte'
bos.rte4.3.3.75COMMITTEDBaseOperatingSystemRuntime
bos.rte4.3.2.0COMMITTEDBaseOperatingSystemRuntime
#
ThesamemighthappentoAIX5.1orotherOSlevels.Asasidenote, Perl cannot be built withoutbos.adt.syscallsandbos.adt.libminstalled
#lslpp-l|egrep"syscalls|libm"
bos.adt.libm5.1.0.25COMMITTEDBaseApplicationDevelopment
bos.adt.syscalls5.1.0.36COMMITTEDSystemCallsApplication
#
BuildingDynamicExtensionsonAIX<5L
AIX supports dynamically loadable objects as well as sharedlibraries.Shared librariesbyconventionendwiththesuffix.a,whichisabitmisleading,as an archive cancontainstaticaswellasdynamicmembers.ForPerldynamicallyloadedobjectsweuse the.sosuffixalsousedonmanyotherplatforms.
NotethatstartingfromPerl5.7.2(andconsequently5.8.0)andAIX4.3ornewerPerluses theAIXnativedynamicloadinginterfaceinthesocalledruntimelinkingmodeinsteadof the emulated interface that was used inPerlreleases5.6.1andearlieror,forAIX releases4.2andearlier.Thischangedoesbreakbackwardcompatibilitywith compiled modules fromearlierPerlreleases.ThechangewasmadetomakePerlmorecompliantwith otherapplicationslikeApache/mod_perlwhichareusingtheAIXnativeinterface.This changealsoenablestheuseofC++codewithstaticconstructorsanddestructorsin Perl extensions,whichwasnotpossibleusingtheemulatedinterface.
TheIBMANSICCompiler
AlldefaultsforConfigurecanbeused.
If you’ve chosen to usevac4,besuretorun4.4.0.3.Olderversionswillturnupnasty lateron.Forvac5besuretorunat least 5.0.1.0, but vac 5.0.2.6 or up is highly recommended. Note that since IBM has removedvac5.0.2.1through5.0.2.5fromthe softwaredepot,theseversionsshouldbeconsideredobsolete.
Here’sabriefleadofhowtoupgradethecompilertothelatestlevel.Of course this is subject to changes. You canonlyupgradeversionsfromftp-availableupdatesifthe firstthreedigitgroupsarethesame(inwhereyou can skip intermediate unlike the patches in the developer snapshots ofPerl),ortooneversionupwherethe"base"is available.Inotherwords,theAIXcompilerpatchesarecumulative.
vac.C.4.4.0.1=>vac.C.4.4.0.3isOK(vac.C.4.4.0.2notneeded)
xlC.C.3.1.3.3=>xlC.C.3.1.4.10isNOTOK(xlC.C.3.1.4.0isnot
available)
#ftpftp.software.ibm.com
Connectedtoservice.boulder.ibm.com.
:welcomemessage...
Name(ftp.software.ibm.com:merijn):anonymous
331Guestloginok,sendyourcompletee-mailaddressaspassword.
Password:
...acceptedloginstuff
ftp>cd/aix/fixes/v4/
ftp>dirotherother.ll
outputtolocal-file:other.ll?y
200PORTcommandsuccessful.
150OpeningASCIImodedataconnectionfor/bin/ls.
226Transfercomplete.
ftp>dirxlcxlc.ll
outputtolocal-file:xlc.ll?y
200PORTcommandsuccessful.
150OpeningASCIImodedataconnectionfor/bin/ls.
226Transfercomplete.
ftp>bye
...goodbyemessages
#ls-l*.ll
-rw-rw-rw-1merijnsystem1169432Nov217:29other.ll
-rw-rw-rw-1merijnsystem29170Nov217:29xlc.ll
OnAIX4.2usingxlC,wecontinue:
#lslpp-l|fgrep'xlC.C'
xlC.C3.1.4.9COMMITTEDCforAIXCompiler
xlC.C3.1.4.0COMMITTEDCforAIXCompiler
#grep'xlC.C.3.1.4.*.bff'xlc.ll
-rw-r--r--14577610116286336Jul221996xlC.C.3.1.4.1.bff
-rw-rw-r--14577610116173696Aug241998xlC.C.3.1.4.10.bff
-rw-r--r--14577610116319104Aug141996xlC.C.3.1.4.2.bff
-rw-r--r--14577610116316032Oct211996xlC.C.3.1.4.3.bff
-rw-r--r--14577610116315008Dec201996xlC.C.3.1.4.4.bff
-rw-rw-r--14577610116178816Mar281997xlC.C.3.1.4.5.bff
-rw-rw-r--14577610116188032May221997xlC.C.3.1.4.6.bff
-rw-rw-r--14577610116191104Sep51997xlC.C.3.1.4.7.bff
-rw-rw-r--14577610116185984Jan131998xlC.C.3.1.4.8.bff
-rw-rw-r--14577610116169600May271998xlC.C.3.1.4.9.bff
#wgetftp://ftp.software.ibm.com/aix/fixes/v4/xlc/xlC.C.3.1.4.10.bff
#
OnAIX4.3usingvac,wecontinue:
#lslpp-l|grep'vac.C'
vac.C5.0.2.2COMMITTEDCforAIXCompiler
vac.C5.0.2.0COMMITTEDCforAIXCompiler
#grep'vac.C.5.0.2.*.bff'other.ll
-rw-rw-r--145776101113592576Apr162001vac.C.5.0.2.0.bff
-rw-rw-r--145776101114133248Apr92002vac.C.5.0.2.3.bff
-rw-rw-r--145776101114173184May202002vac.C.5.0.2.4.bff
-rw-rw-r--145776101114192640Nov222002vac.C.5.0.2.6.bff
#wgetftp://ftp.software.ibm.com/aix/fixes/v4/other/vac.C.5.0.2.6.bff
#
LikewiseonallotherOSlevels.Thenexecutethefollowing command, and fill in its choices
#smitinstall_update
->InstallandUpdatefromLATESTAvailableSoftware
*INPUTdevice/directoryforsoftware[vac.C.5.0.2.6.bff]
[OK]
[OK]
Followthemessages...andyou’redone.
If you like a more web-like approach, a good start point can be <http://www14.software.ibm.com/webapp/download/downloadaz.jsp>andclick"Cfor AIX",andfollowtheinstructions.
Theusenmoption
Iflinkingminiperl
cc-ominiperl...miniperlmain.oopmini.operl.o...-lm-lc...
causeserrorlikethis
ld:0711-317ERROR:Undefinedsymbol:.aintl
ld:0711-317ERROR:Undefinedsymbol:.copysignl
ld:0711-317ERROR:Undefinedsymbol:.syscall
ld:0711-317ERROR:Undefinedsymbol:.eaccess
ld:0711-317ERROR:Undefinedsymbol:.setresuid
ld:0711-317ERROR:Undefinedsymbol:.setresgid
ld:0711-317ERROR:Undefinedsymbol:.setproctitle
ld:0711-345Usethe-bloadmapor-bnoquietoptiontoobtainmore
information.
youcouldretrywith
makerealclean
rmconfig.sh
./Configure-Dusenm...
whichmakesConfiguretousethe"nm"toolwhen scanning for library symbols, which usuallyisnotdoneinAIX.
Related tothis,youprobablyshouldnotusethe"-r"optionofConfigureinAIX,because thataffectsofhowthe"nm"toolisused.
UsingGNU’sgccforbuildingPerl
Usinggcc-3.x(testedwith3.0.4,3.1,and3.2)nowworksoutof the box, as do recent gcc-2.9 builds available directly from IBM as partoftheirLinuxcompatibility packages,availablehere:
http://www.ibm.com/servers/aix/products/aixos/linux/
UsingLargeFileswithPerl<5L
Shouldyieldnoproblems.
ThreadedPerl<5L
ThreadsseemtoworkOK,thoughatthemomentnotalltestspasswhenthreads are used in combinationwith64-bitconfigurations.
Youmaygetawarningwhendoingathreadedbuild:
"pp_sys.c",line4640.39:1506-280(W)Functionargumentassignment
betweentypes"unsignedchar*"and"constvoid*"isnotallowed.
Theexactlinenumbermayvary,butifthewarning(W)comesfromalinelinethis
hent=PerlSock_gethostbyaddr(addr,(Netdb_hlen_t)addrlen,addrtype);
in the "pp_ghostent" function, youmayignoreitsafely.Thewarningiscausedbythe reentrantvariantofgethostbyaddr()havingaslightlydifferentprototype than its non-reentrantvariant,butthedifferenceisnotreallysignificanthere.
64-bitPerl<5L
If your AIX isinstalledwith64-bitsupport,youcanexpect64-bitconfigurationsto work.Incombinationwiththreadssometestsmightstillfail.
AIX4.2andextensionsusingC++withstatics
InAIX4.2PerlextensionsthatuseC++functionsthatusestaticsmay have problems in that thestaticsarenotgettinginitialized.InnewerAIXreleasesthishasbeensolved bylinkingPerlwiththelibC_rlibrary,butunfortunatelyinAIX4.2thesaidlibraryhas anobscurebugwhere the various functions related to time (such as time() and gettimeofday()) return broken values, and therefore inAIX4.2Perlisnotlinked againstthelibC_r.
AUTHORS
RainerTammer<tammer@tammer.net>