comment compiler perl sous aix afin de pouvoir utiliser dbd:oracle

Creation: 11 octobre 2014
Mise à jour: 1 novembre 2014
Version: 1.1
Author: Jean-Louis Bicquelet-Salaün
Location: http://jlbicquelet.free.fr
Copyright: (c) 2014 Jean-Louis BICQUELET-SALAÜN

Installation des modules perl DBI et DBD::Oracle Perl sous AIX 5.3

La version de perl standrad sous AIX a été générée avec le compilateur cc_r d'IBM. Installer des modules Perl sous AIX necessite d'avoir le compilateur C d'IBM qui n'est pas inclus nativement dans le système et qui est payant.

IBM fournit avec l'AIX Toolbox, le compilateur gcc, mais il faut alors recompiler perl et l'installer dans un répertoire différent de celui du système.

On pourra ainsi recompiler les modules dont on a besoin (DBI, DBD::Oracle), mais aussi tous les modules que l'on souhaiterai utiliser, pourvus qu'il proviennet de CPAN.

C'est cette méthode que nous allons voir.

procédure

installation de bos.adt.libm

Avant d'installer gcc et de pouvoir compiler perl Il faut vérifier que bos.adt.libm est présent dans le système ou l'installer.

#lslpp -l | grep libm
  bos.adt.libm              5.3.12.0  COMMITTED  Base Application Development

Si le fileset n'est pas présent il faut l'installer à partir du CD d'installation AIX ou à partir d'un lppsource.

Installation de gcc

vérifier que gcc est disponible

rpm -qa | egrep "gcc|libstdc"
libgcc-4.2.0-3
libstdc++-4.2.0-3
gcc-4.2.0-3

Si ce n'est pas le cas, il faut l'installer. Je vous conseille la version 4.2.0.3, car j'ai eu des problèmes avec d'autres versions plus récentes sous AX 5.3.

Les rpms dont vous avez besoin sont:

  • gcc-4.2.0-3.aix5.3.ppc.rpm
  • libgcc-4.2.0-3.aix5.3.ppc.rpm
  • libstdcplusplus-4.2.0-3.aix5.3.ppc.rpm

Pour l'installation:

for i in gcc-4.2.0-3.aix5.3.ppc.rpm libgcc-4.2.0-3.aix5.3.ppc.rpm libstdcplusplus-4.2.0-3.aix5.3.ppc.rpm
do
rpm -Uvh $i
done
gcc                         ##################################################
libgcc                      ##################################################
libstdc++                   ##################################################

On peut utiliser les options ivh si on préfère.

compilation et installation de perl

  1. Téléchargez le source Perl à l'adresse http://www.perl.org/get.html. J'ai choisi un perl 5.8.9 car c'était une version proche de celle de mon système (5.8.8). Il faut ensuite décompresser et détarrer l'archive.
    gunzip perl-5.8.9.tar.gz
    tar xvf perl-5.8.9.tar
    

  2. Pour que le module DBD:Oracle fonctionne correctement, il faut compiler perl en 64bits. C'est l'option OBJECT_MODE=64 qui s'en charge.

    On en profite pour fixer le prefix du répertoire d'installation au répertoire où l'on souhaite installer perl (ici en bleu).

    export OBJECT_MODE=64
    rm config.sh
    ./Configure -d -Dcc='gcc -maix64' -Duseshrplib -Duse64bitall -Dprefix=/apps/application/perl5
    
    Updating makefile...
             test -s perlmain.c && touch perlmain.c
            cd x2p; make depend
            sh ../makedepend MAKE=make
            echo hash.c  str.c util.c walk.c | tr ' ' '\n' >.clist
    Finding dependencies for hash.o.
    Finding dependencies for str.o.
    Finding dependencies for util.o.
    Finding dependencies for walk.o.
            echo Makefile.SH cflags.SH | tr ' ' '\n' >.shlist
    Updating makefile...
    Now you must run 'make'.
    
    If you compile perl5 on a different machine or from a different object
    directory, copy the Policy.sh file from this object directory to the
    new one before you run Configure -- this will help you with most of
    the policy defaults.
    

    Le configure étant terminé, on lance make

    make
    

    Si tout se passe bien, on lance les tests.

    make test
    
    t/pod/poderrs...................................ok
    t/pod/podselect.................................ok
    t/pod/special_seqs..............................ok
    t/pod/twice.....................................ok
    t/x2p/s2p.......................................ok
    All tests successful.
    u=1.51  s=0.82  cu=139.99  cs=17.65  scripts=1105  tests=133021
    
  3. Les tests étant correct on peut installer perl. L'instalaltion se ferra par défaut, dans le répertoire indiqué par prefix:

    make install
    
  4. On vérifie la présence de perl, sa version et ses options de compilations:

    /apps/application/perl5/bin/perl -V
    Summary of my perl5 (revision 5 version 8 subversion 9) configuration:
      Platform:
        osname=aix, osvers=5.3.0.0, archname=aix-64all
        uname='aix sxdifrast53 3 5 00f6af604c00 '
        config_args='-d -Dcc=gcc -maix64 -Duseshrplib -Duse64bitall -Dprefix=/apps/application/perl5'
        hint=recommended, useposix=true, d_sigaction=define
        usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
        useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
        use64bitint=define use64bitall=define uselongdouble=undef
        usemymalloc=n, bincompat5005=undef
      Compiler:
        cc='gcc -maix64 -maix64', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -DUSE_NATIVE_DLOPEN -fno-strict-aliasing -pipe -maix64 -DUSE_64_BIT_ALL',
        optimize='-O',
        cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -DUSE_NATIVE_DLOPEN -fno-strict-aliasing -pipe'
        ccversion='', gccversion='4.2.0', gccosandvers=''
        intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=87654321
        d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
        ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
        alignbytes=8, prototype=define
      Linker and Libraries:
        ld='gcc -maix64 -maix64', ldflags =' -Wl,-brtl -Wl,-bdynamic -Wl,-b64'
        libpth=/lib /usr/lib /usr/ccs/lib
        libs=-lbind -lnsl -lgdbm -ldbm -ldl -lld -lm -lcrypt -lc -lbsd
        perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lc -lbsd
        libc=, so=a, useshrplib=true, libperl=libperl.a
        gnulibc_version=''
      Dynamic Linking:
        dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Xlinker -bE:/apps/application/perl5/lib/5.8.9/aix-64all/CORE/perl.exp'
        cccdlflags=' ', lddlflags='  -Wl,-b64 -Wl,-bhalt:4 -Wl,-G -Wl,-bI:$(PERL_INC)/perl.exp -Wl,-bE:$(BASEEXT).exp -Wl,-bnoentry -lc -lm'
    
    
    Characteristics of this binary (from libperl):
      Compile-time options: PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT
                            USE_FAST_STDIO USE_LARGE_FILES USE_PERLIO
      Built under aix
      Compiled at Oct  8 2014 16:59:11
      @INC:
        /apps/application/perl5/lib/5.8.9/aix-64all
        /apps/application/perl5/lib/5.8.9
        /apps/application/perl5/lib/site_perl/5.8.9/aix-64all
        /apps/application/perl5/lib/site_perl/5.8.9
    

    Une dernière vérification peut se faire avec l'outil instmodsh en tapant l (q pour sortir), en inspectant le module perl.

    /apps/application/perl5/bin/instmodsh
    Available commands are:
       l            - List all installed modules
       m    - Select a module
       q            - Quit the program
    cmd? l
    Installed modules are:
       Perl
    
    cmd? m Perl
    Available commands are:
       f [all|prog|doc]   - List installed files of a given type
       d [all|prog|doc]   - List the directories used by a module
       v                  - Validate the .packlist - check for missing files
       t         - Create a tar archive of the module
       h                  - Display module help
       q                  - Quit the module
    Perl cmd? v
    Perl has no missing files
    
    d all
       /apps/application/perl5/lib/5.8.9/unicore/lib/ea
       /apps/application/perl5/lib/5.8.9/unicore/lib/gc_sc
       /apps/application/perl5/lib/5.8.9/unicore/lib/hst
       /apps/application/perl5/lib/5.8.9/unicore/lib/jt
       /apps/application/perl5/lib/5.8.9/unicore/lib/lb
       /apps/application/perl5/lib/5.8.9/unicore/lib/nt
       /apps/application/perl5/lib/5.8.9/warnings
    
    t /tmp/perl589.tar
    
    q

    On peut avec cet outil faire un tar de perl.

compilation et installation de DBI

  1. Récupération du module DBI au CPAN: DBI 163, puis gunzip et untar.

    gunzip DBI-1.631.tar.gz
    tar xvf DBI-1.631.tar
    x DBI-1.631
    x DBI-1.631/Changes, 116464 bytes, 228 media blocks.
    x DBI-1.631/dbd_xsh.h, 3092 bytes, 7 media blocks.
    x DBI-1.631/DBI.pm, 313719 bytes, 613 media blocks.
    x DBI-1.631/DBI.xs, 204243 bytes, 399 media blocks.
    x DBI-1.631/dbi_sql.h, 3703 bytes, 8 media blocks.
    x DBI-1.631/dbilogstrip.PL, 1937 bytes, 4 media blocks.
    x DBI-1.631/dbipport.h, 180260 bytes, 353 media blocks.
    x DBI-1.631/dbiprof.PL, 6774 bytes, 14 media blocks.
    x DBI-1.631/dbiproxy.PL, 5960 bytes, 12 media blocks.
    ...
    x DBI-1.631/ex/corogofer.pl, 695 bytes, 2 media blocks.
    x DBI-1.631/ex/perl_dbi_nulls_test.pl, 6283 bytes, 13 media blocks.
    x DBI-1.631/ex/profile.pl, 594 bytes, 2 media blocks.
    

    On compile le module et on l'installe avec la séquence perl Makefile.PL, make, make test, make install.

    cd DBI-1.631
    
    /apps/application/perl5/bin/perl Makefile.PL
    Your perl was compiled with gcc (version 4.2.0), okay.
    Creating test wrappers for DBD::Gofer:
    t/zvg_01basics.t
    t/zvg_02dbidrv.t
    t/zvg_03handle.t
    t/zvg_04mods.t
    t/zvg_05concathash.t
    
    t/zvxgnp_85gofer.t
    Checking if your kit is complete...
    Looks good
    Warning: prerequisite Test::Simple 0.90 not found. We have 0.8.
    
        I see you're using perl 5.008009 on aix-64all, okay.
        Remember to actually *read* the README file!
        Use  'make' to build the software (dmake or nmake on Windows).
        Then 'make test' to execute self tests.
        Then 'make install' to install the DBI and then delete this working
        directory before unpacking and building any DBD::* drivers.
    
    Writing Makefile for DBI
    
    make 
    
            /apps/application/perl5/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI
            rm -f blib/lib/DBI/Changes.pm
            cp Changes blib/lib/DBI/Changes.pm
    cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h
    cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm
    cp lib/DBI/Gofer/Response.pm blib/lib/DBI/Gofer/Response.pm
    cp lib/DBI/Gofer/Transport/Base.pm blib/lib/DBI/Gofer/Transport/Base.pm
    cp lib/DBI/Util/_accessor.pm blib/lib/DBI/Util/_accessor.pm
    cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm
    ...
    
    Manifying blib/man3/DBI::Gofer::Execute.3
    Manifying blib/man3/DBI::DBD.3
    Manifying blib/man3/Win32::DBIODBC.3
    Manifying blib/man3/DBI::DBD::SqlEngine.3
    Manifying blib/man3/DBI::PurePerl.3
    Manifying blib/man3/DBI::ProfileData.3
    
    #make install
    Manifying blib/man1/dbiprof.1
    Manifying blib/man1/dbiproxy.1
    Manifying blib/man1/dbilogstrip.1
    Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBI/DBI.bs
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBI/DBI.so
    ..
    Installing /apps/application/perl5/bin/dbiprof
    Installing /apps/application/perl5/bin/dbiproxy
    Writing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBI/.packlist
    Appending installation info to /apps/application/perl5/lib/5.8.9/aix-64all/perllocal.pod
    
  2. On vérifie /usr/opt/perl5_64/bin/perl -e 'use DBI;'

compilation et installation de DBD:Oracle

  1. On récupère de même le module DBD:Oracle au CPAN: DBD_oracle 1.74, et on le gunzip et on l'untar.

    tar xvf DBD-Oracle-1.74.tar
    cd DBD-Oracle-1.74
    
  2. Il faut maintenant déclarer l'endoit où se trouve oracle

    ORACLE_HOME=/apps/asm/10.2.0
    export ORACLE_HOME
    LIBPATH=/apps/asm/10.2.0/lib:/apps/asm/10.2.0/lib32
    export LIBPATH
    
  3. On peut alors lancer un perl Makefile.PL

    /apps/application/perl5/bin/perl Makefile.PL
    Using DBI 1.631 (for perl 5.008009 on aix-64all) installed in /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBI/
    
    Configuring DBD::Oracle for perl 5.008009 on aix (aix-64all)
    
    Remember to actually *READ* the README file! Especially if you have any problems.
    
    Installing on a aix, Ver#5.3
    Using Oracle in /apps/asm/10.2.0
    DEFINE _SQLPLUS_RELEASE = "1002000400" (CHAR)
    Oracle version 10.2.0.4 (10.2)
    Found /apps/asm/10.2.0/rdbms/demo/demo_rdbms.mk
    Found /apps/asm/10.2.0/rdbms/demo/demo_rdbms64.mk
    Found /apps/asm/10.2.0/rdbms/lib/ins_rdbms.mk
    Using /apps/asm/10.2.0/rdbms/demo/demo_rdbms.mk
    Your LIBPATH env var is set to '/apps/asm/10.2.0/lib:/apps/asm/10.2.0/lib32'
    Reading /apps/asm/10.2.0/rdbms/demo/demo_rdbms.mk
    Reading /apps/asm/10.2.0/rdbms/lib/env_rdbms.mk
    Deleting -b64 from COMPOBJS because -b64 doesn't exist.
    
    Attempting to discover Oracle OCI build rules
            gcc -maix64 -maix64 -O -c DBD_ORA_OBJ.c
    
    ...
    WARNING: If you have problems you may need to rebuild perl with threading enabled.
    Checking if your kit is complete...
    Looks good
    LD_RUN_PATH=/apps/asm/10.2.0/lib:/apps/asm/10.2.0/rdbms/lib
    Using DBD::Oracle 1.74.
    Using DBD::Oracle 1.74.
    Using DBI 1.631 (for perl 5.008009 on aix-64all) installed in /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBI/
    Writing Makefile for DBD::Oracle
    
    ***  If you have problems...
         read all the log printed above, and the README and README.help.txt files.
         (Of course, you have read README by now anyway, haven't you?)
    
  4. On peut ensuite lancer make, make test, make install

    make
    make test
    
    #make install
    Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/Oracle.bs
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/Oracle.h
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/Oracle.so
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/dbdimp.h
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/mk.pm
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/ocitrace.h
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle.pm
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/GetInfo.pm
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Object.pm
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Aix.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Cygwin.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Hpux.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Linux.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Macos.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Sun.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Vms.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Win32.pod
    Installing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/DBD/Oracle/Troubleshooting/Win64.pod
    Installing /apps/application/perl5/man/man3/DBD::Oracle.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::GetInfo.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Object.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Aix.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Cygwin.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Hpux.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Linux.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Macos.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Sun.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Vms.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Win32.3
    Installing /apps/application/perl5/man/man3/DBD::Oracle::Troubleshooting::Win64.3
    Writing /apps/application/perl5/lib/site_perl/5.8.9/aix-64all/auto/DBD/Oracle/.packlist
    Appending installation info to /apps/application/perl5/lib/5.8.9/aix-64all/perllocal.pod
    
  5. On vérifie avec instmodsh la présence du module et éventuellement qu'il ne manque rien au module.

    /apps/application/perl5/bin/instmodsh
    Available commands are:
       l            - List all installed modules
       m    - Select a module
       q            - Quit the program
    cmd? l
    Installed modules are:
       DBD::Oracle
       DBI
       Perl
    
    On peut aussi vérifier en ligne de commande:
    PSAVE=$PATH ; PATH=/apps/application/perl5/bin ; perl -MExtUtils::Installed -e '$inst = ExtUtils::Install ; PATH =$PSAVE
    
    doit retourner
    
    DBD::Oracle
    DBI
    

    Et vérifier le niveau des modules:

    /apps/application/perl5/bin/perl  -e 'use DBD::Oracle; print $DBI::VERSION,"\n";'
    1.631
    
    /apps/application/perl5/bin/perl  -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,"\n";'
    1.74
    

installation sur un autre serveur

Le plus simple est de faire un tar à la racine du répertoire contenant perl. On amene ainsi tout, y compris les modules DBI et DBD::Oracle.