http://www.perlmonks.org?node_id=1044919

rider754 has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

It seems there are some intricacies surrounding the installation of DBD::Oracle. I was hoping you can help clarify some questions of mine and help me troubleshoot the installation issue.

I am trying to install DBD::Oracle 1.58 (for Perl 5.8.8) on Linux RHEL 5.7 x86_64. Through trial and error installing through CPAN, the following environment variables were set:

ORACLE_HOME=/opt/oracleas/product/11.2.0/client_1 LD_LIBRARY_PATH=$ORACLE_HOME/lib

Then, we start encountering error messages around the tests. Two of the errors are:

t/00versions..................Can't load '/home/root/.cpan/build/DBD-O +racle-1.58/blib/arch/auto/DBD/Oracle/Oracle.so' for module DBD::Oracl +e: libclntsh.so.11.1: cannot open shared object file: No such file or + directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLo +ader.pm line 230. at t/00versions.t line 10 String found where operator expected at t/nchar_test_lib.pl line 459, +near "note "set \$ENV{NLS_LANG='$ENV{NLS_LANG}'"" (Do you need to predeclare note?)
We've next tried to set NLS_LANG=AMERICAN_AMERICA.US7ASCII (the previous value on our Solaris box). But the error persists.

I ran locate libclntsh.so.11.1 and it turned up two locations
lrwxrwxrwx 1 weblogic weblogic /opt/oracleas/product/11.2.0/client_1/ +instantclient/libclntsh.so.11.1 -rwxr-xr-x 1 weblogic weblogic /opt/oracleas/product/11.2.0/client_1/ +lib/libclntsh.so.11.1

Update: It doesn't make sense to me why LD_LIBRARY_PATH is not picked up by the build

Installing on a linux, Ver#2.6 Using Oracle in /opt/oracleas/product/11.2.0/client_1 DEFINE _SQLPLUS_RELEASE = "1102000100" (CHAR) Oracle version 11.2.0.1 (11.2) Found /opt/oracleas/product/11.2.0/client_1/rdbms/lib/ins_rdbms.mk Using /opt/oracleas/product/11.2.0/client_1/rdbms/lib/ins_rdbms.mk Your LD_LIBRARY_PATH env var is set to '' WARNING: Your LD_LIBRARY_PATH env var doesn't include '/opt/oracleas/p +roduct/11.2.0/client_1/lib' but probably needs to. Reading /opt/oracleas/product/11.2.0/client_1/rdbms/lib/ins_rdbms.mk Reading /opt/oracleas/product/11.2.0/client_1/rdbms/lib/env_rdbms.mk WARNING: Oracle /opt/oracleas/product/11.2.0/client_1/rdbms/lib/ins_rd +bms.mk doesn't define a 'build' rule. WARNING: I will now try to guess how to build and link DBD::Oracle for + you. This kind of guess work is very error prone and Oracle-versio +n sensitive. It is possible that it won't be supported in future versions +of DBD::Oracle. *PLEASE* notify dbi-users about exactly _why_ you had to buil +d it this way. Found header files in /opt/oracleas/product/11.2.0/client_1/rdbms/publ +ic. client_version=11.2 DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"11.2.0.1 +\" -DORA_OCI_102 -DORA_OCI_112 Checking for functioning wait.ph System: perl5.008008 linux x86-002.build.bos.redhat.com 2.6.18-194.26. +1.el5 #1 smp fri oct 29 14:21:16 edt 2010 x86_64 x86_64 x86_64 gnulin +ux Compiler: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexception +s -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_ +REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-afte +r-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_B +ITS=64 -I/usr/include/gdbm Linker: /usr/bin/ld Sysliblist: -ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml Oracle makefiles would have used these definitions but we override the +m: CC: $(COMPDIR)/bin/gcc CFLAGS: $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)\ $(SHARED_CFLAG) $(USRFLAGS) [$(GFLAG) -O3 $(CDEBUG) -m32 -trigraphs -fPIC -I/opt/oracle +as/product/11.2.0/client_1/rdbms/demo -I/opt/oracleas/product/11.2.0/ +client_1/rdbms/public -I/opt/oracleas/product/11.2.0/client_1/plsql/p +ublic -I/opt/oracleas/product/11.2.0/client_1/network/public -DLINUX +-D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_EN +ABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -D__NO_CTYPE=1 -DLDAP_ +CM $(LPFLAGS) $(PLSQLNCGFLAGS) $(USRFLAGS)] LDFLAGS: $(LDFLAGS32) [-m32 -o $@ -L/opt/oracleas/product/11.2.0/client_1/rdbms// +lib32/ -L/opt/oracleas/product/11.2.0/client_1/lib32/ -L/opt/oracleas +/product/11.2.0/client_1/lib32/stubs/] Linking with -lclntsh -ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml -l +dl -lm -lpthread [from $(OCISHAREDLIBS)] WARNING: META_MERGE is not a known parameter. Checking if your kit is complete... Looks good 'META_MERGE' is not a known MakeMaker parameter name. LD_RUN_PATH=/opt/oracleas/product/11.2.0/client_1/lib Using DBD::Oracle 1.58. Using DBD::Oracle 1.58. Using DBI 1.52 (for perl 5.008008 on x86_64-linux-thread-multi) instal +led in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/a +uto/DBI/ Writing Makefile for DBD::Oracle *** If you have problems... read all the log printed above, and the README and README.help.tx +t files. (Of course, you have read README by now anyway, haven't you?)

My questions are:

  1. Why is LD_LIBRARY_PATH not picked up by the CPAN install?
  2. Why is the error with libclntsh.so.11.1 happening? Is it a permissions issue for libclntsh.so.11.1 or Oracle.so? (We are running as root, why would permissions matter?)
  3. What is this issue with NLS_LANG and how should I go about fixing it?
  4. Are there other variables I need to set? (ex: TNS_ADMIN)
  5. There is a WebLogic installation here, and the LD_LIBRARY_PATH has many more locations than the one we used here for root. Does that matter?
  6. There seems to be some notion around not pointing to the actual Oracle instance, because Perl can change some settings(?), and it should point to a client instead. (I think I've done that?) But can this be explained in more detail on why or what happens?

Update #2 Hope this helps some other poor soul out there.
Some answers are:

  1. Turns out adding the environment variables to the .bashrc did the trick. http://www.perlmonks.org/?node_id=913262 (Probably when the make happens, it opens a new session so the temporary exports before launching CPAN will not stick)
  2. These errors went away when the LD_LIBRARY_PATH was correctly picked up
  3. Same thing, set in .bashrc
  4. Haven't tried to set other variables yet...
  5. ???
  6. ???
One additional is, we made sure to upgrade the DBI module also, which in turn upgraded ExtUtils::MakeMaker and something else. So in the end, it was glad to skip all the tests when a db connection wasn't found and happily installed.