Monday, 26 December 2011

Perl DBI and DB2 modules installation on AIX 6.1

My AIX6.1 natively didnot have c compiler.So, I have downloaded xlc compiler to compile and install perl DBI and DB2 modules.
Also, DB2 module installation using perl5.8.8  failed with Usage: Cwd::fastcwd()  error.

# Here are the debugging steps I have performed to install DB2 module using perl 5.14.2 #
AIX Tools for linux:
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html 

Install xlc_r compiler as follows:
http://www-01.ibm.com/software/awdtools/xlcpp/aix/   - xlcpp  compiler (aix c/c++ compiler)
xlcpp installation guide:https://www-304.ibm.com/support/docview.wss?uid=swg27017988&aid=1

Command to install:
installp -aXYgd ./xlcpp/usr/sys/inst.images -e /tmp/install.log all

export PATH=$PATH:/usr/vac/bin:/usr/vacpp/bin


## Install perl 5.14.2 in threaded 32-bit mode ##
####################################################
 rm config.sh
    ./Configure \
    -d \
    -Dcc=cc_r \
    -Duseshrplib \
    -Dusethreads \
    -Dprefix=/usr/opt/perl5_32
####################################################

Using [:upper:] and [:lower:] to convert case.
./Configure[3141]: cc_r:  not found.
You need to find a working C compiler.
Either (purchase and) install the C compiler supplied by your OS vendor,
or for a free C compiler try
http://gcc.gnu.org/
I cannot continue any further, aborting.
####################################################
Trouble shooting:
export PATH=$PATH:/usr/vac/bin  (for xlc_r compiler in PATH)

use -Dcc=xlc_r (xlc_r installed manually)
####################################################

####################################################
./Configure -d -Dcc=xlc_r -Duseshrplib -Dusethreads -Dprefix=/usr/opt/perl5_32

Looking for extensions...
A number of extensions are supplied with perl5.  You may choose to
compile these extensions for dynamic loading (the default), compile
them into the perl5 executable (static loading), or not include
them at all.  Answer "none" to include no extensions.
Note that DynaLoader is always built and need not be mentioned here.

perl5.14 dynamically loaded modules :
What extensions do you wish to load dynamically?
[B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA

Encode Fcntl File/Glob Filter/Util/Call Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util
MIME/Base64 Math/BigInt/FastCalc NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File
Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate
Unicode/Normalize XS/APItest XS/Typemap attributes mro re threads threads/shared]
What extensions do you wish to load statically? [none]

Stripping down cppstdin path name
End of configuration questions.

Stripping down executable paths...
Creating config.sh...
If you'd like to make any changes to the config.sh file before I begin
to configure things, do it as a shell escape now (e.g. !vi config.sh).


make
make test
make install


/usr/opt/perl5_32/lib/5.14.2/aix-thread-multi/Config.pm   file now contains  xlc_r and proper archlib path to perl
5.14.2.
####################################################

####################################################
bash-3.2# export PATH=/usr/opt/perl5_32/bin/:$PATH
echo $PATH
/usr/opt/perl5_32/bin/:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/usr/va

c/bin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc
Install Perl DBI using /usr/opt/perl5_32/bin/perl Makefile.PL
make
make test
make install

Before Installing DBD::DB2 module:
do : 
bash-3.2# source /home/db2inst2/sqllib/db2profile
bash-3.2# export PATH=/usr/opt/perl5_32/bin/:$PATH  (inlcude perl5.14.2 binary first in the PATH)
bash-3.2# export DB2_HOME=/home/db2inst2/sqllib


Note that $DB2_HOME/include should contain db2 sqlclient related header files.

Now do:
bash-3.2# /usr/opt/perl5_32/bin/perl Makefile.PL

Configuring DBD::DB2...
Remember to actually read the README and CAVEATS files!

Using DB2 in "/home/db2inst2/sqllib"
System: perl5.014002 DBI1.616 aix app4 1 6 00f6fa664c00  aix-thread-multi dl_aix.xs
Compiler: xlc_r -q32 -O -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN

-DNEED_PTHREAD_INIT -qlanglvl=extended -q32 -D_LARGE_FILES -qlonglong
Includes:  -I"/home/db2inst2/sqllib/include" -I"/usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBI"

-I"/usr/opt/perl5_32/lib/5.14.2/aix-thread-multi/auto/DBI"
-I"/usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBI"
Libraries: -L/home/db2inst2/sqllib/lib64 -ldb2

Checking if your kit is complete...
Looks good
Writing Makefile for DBD::DB2::Constants
Writing MYMETA.yml
Writing Makefile for DBD::DB2
Writing MYMETA.yml


make:
bash-3.2# make
bash-3.2# make test
bash-3.2# make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/DB2.bs
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/DB2.so
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/Constants/Constants.bs
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/Constants/Constants.so
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/Bundle/DBD/DB2.pm
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/DBD/DB2.pm
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/DBD/DB2.pod
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/DBD/DB2/Constants.pm
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/Constants/autosplit.ix
Installing /usr/opt/perl5_32/man/man3/Bundle::DBD::DB2.3
Installing /usr/opt/perl5_32/man/man3/DBD::DB2.3
Appending installation info to /usr/opt/perl5_32/lib/5.14.2/aix-thread-multi/perllocal.pod

####################################################
Now, DB2 module is ready for connecting perl scripts to db2 database.

No comments:

Post a Comment

Tweets by @sriramperumalla