0

I am trying to install DBD:Oracle.

I'm in the following environment:

Red Hat Enterprise Linux release 8.8 (Ootpa) Perl v5.26.3

Our DBA installed the Oracle 19 client in this location: /u01/app/oracle/product/19.0.0/client_1

I have the following environment variables set up:

ORACLE_HOME="/u01/app/oracle/product/19.0.0/client_1"

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/u01/app/oracle/product/19.0.0/client_1/bin"

LD_LIBRARY_PATH=":/u01/app/oracle/product/19.0.0/client_1/lib"

When I run cpan install DBD::Oracle as root, I get a bunch of compiler warnings, and the linker fails with this error:

/usr/bin/ld: cannot find -lnsl

I'm at a loss with how to proceed. Any advice would be appreciated.

Here's the output of the cpan command:

Reading '/root/.local/share/.cpan/Metadata'
  Database was generated on Sat, 12 Aug 2023 15:17:02 GMT
Running install for module 'DBD::Oracle'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.081)
Checksum for /root/.local/share/.cpan/sources/authors/id/Z/ZA/ZARQUON/DBD-Oracle-1.83.tar.gz ok
'YAML' not installed, will not store persistent state
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20181130)
Configuring Z/ZA/ZARQUON/DBD-Oracle-1.83.tar.gz with Makefile.PL
Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 36.
Using DBI 1.643 (for perl 5.026003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
Configuring DBD::Oracle for perl 5.026003 on linux (x86_64-linux-thread-multi)

If you encounter any problem, a collection of troubleshooting
guides are available under lib/DBD/Oracle/Troubleshooting.
'DBD::Oracle::Troubleshooting' is the general troubleshooting
guide, while platform-specific troubleshooting hints
live in their labelled sub-document (e.g., Win32
hints are gathered in 'lib/DBD/Oracle/Troubleshooting/Win32.pod').

Installing on a linux, Ver#4.18
Using Oracle in /u01/app/oracle/product/19.0.0/client_1
DEFINE _SQLPLUS_RELEASE = "1903000000" (CHAR)
Oracle Version 19.3.0.0 (19.3)
Found direct-link candidates: libclntsh.so
Oracle sysliblist: -ldl -lm -lpthread -lnsl -lirc -limf -lirc -lrt -laio -lresolv -lsvml 
Found header files in /u01/app/oracle/product/19.0.0/client_1/rdbms/public.
Your LD_LIBRARY_PATH env var is set to ':/u01/app/oracle/product/19.0.0/client_1/lib'

client_version=19.3


DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112


Checking for functioning wait.ph


System: perl5.026003 linux x86-64-02.build.eng.rdu2.redhat.com 4.18.0-305.25.1.el8_4.x86_64 #1 smp mon oct 18 14:34:11 edt 2021 x86_64 x86_64 x86_64 gnulinux 
Compiler:   gcc   -g -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Linker:     /usr/bin/ld
Sysliblist: -ldl -lm -lpthread -lnsl -lirc -limf -lirc -lrt -laio -lresolv -lsvml 
Linking with -lclntsh.

Checking if your kit is complete...
Looks good
LD_RUN_PATH=/u01/app/oracle/product/19.0.0/client_1/lib:/lib64
Using DBD::Oracle 1.83.
Using DBD::Oracle 1.83.
Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/vendor_perl/auto/DBI/ at Makefile.PL line 1808.
Using DBI 1.643 (for perl 5.026003 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
Generating a Unix-style Makefile
Writing Makefile for DBD::Oracle
Writing MYMETA.yml and MYMETA.json

  ZARQUON/DBD-Oracle-1.83.tar.gz
  /usr/bin/perl Makefile.PL -- OK
Running make for Z/ZA/ZARQUON/DBD-Oracle-1.83.tar.gz
cp lib/DBD/Oracle/Troubleshooting/Vms.pod blib/lib/DBD/Oracle/Troubleshooting/Vms.pod
cp lib/DBD/Oracle/Troubleshooting/Win32.pod blib/lib/DBD/Oracle/Troubleshooting/Win32.pod
cp lib/DBD/Oracle/Troubleshooting/Linux.pod blib/lib/DBD/Oracle/Troubleshooting/Linux.pod
cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
cp lib/DBD/Oracle/Troubleshooting/Win64.pod blib/lib/DBD/Oracle/Troubleshooting/Win64.pod
cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
cp lib/DBD/Oracle/Troubleshooting.pod blib/lib/DBD/Oracle/Troubleshooting.pod
cp lib/DBD/Oracle/Object.pm blib/lib/DBD/Oracle/Object.pm
cp lib/DBD/Oracle/Troubleshooting/Macos.pod blib/lib/DBD/Oracle/Troubleshooting/Macos.pod
cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
cp lib/DBD/Oracle/Troubleshooting/Cygwin.pod blib/lib/DBD/Oracle/Troubleshooting/Cygwin.pod
cp lib/DBD/Oracle/Troubleshooting/Sun.pod blib/lib/DBD/Oracle/Troubleshooting/Sun.pod
cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
cp lib/DBD/Oracle.pm blib/lib/DBD/Oracle.pm
cp lib/DBD/Oracle/Troubleshooting/Hpux.pod blib/lib/DBD/Oracle/Troubleshooting/Hpux.pod
cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
cp lib/DBD/Oracle/Troubleshooting/Aix.pod blib/lib/DBD/Oracle/Troubleshooting/Aix.pod
Running Mkbootstrap for Oracle ()
chmod 644 "Oracle.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs 644
"/usr/bin/perl" -p -e "s/~DRIVER~/Oracle/g" /usr/local/lib64/perl5/auto/DBI/Driver.xst > Oracle.xsi
"/usr/bin/perl" "/usr/share/perl5/vendor_perl/ExtUtils/xsubpp"  -typemap '/usr/share/perl5/ExtUtils/typemap' -typemap '/root/.local/share/.cpan/build/DBD-Oracle-1.83-6/typemap'  Oracle.xs > Oracle.xsc
mv Oracle.xsc Oracle.c
gcc -c  -I/u01/app/oracle/product/19.0.0/client_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"1.83\" -DXS_VERSION=\"1.83\" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112 Oracle.c
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from Oracle.xs:1:
Oracle.xs: In function ‘XS_DBD__Oracle__db_ora_db_startup’:
Oracle.xs:330:82: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (admhp) OCIHandleFree_log_stat(imp_dbh, (dvoid*)admhp, (ub4)OCI_HTYPE_ADMIN, status);
                                                                                  ^~~~~~
ocitrace.h:411:2: note: in definition of macro ‘OCIHandleFree_log_stat’
  stat=OCIHandleFree( (hp), (t));    \
  ^~~~
Oracle.xs:330:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (admhp) OCIHandleFree_log_stat(imp_dbh, (dvoid*)admhp, (ub4)OCI_HTYPE_ADMIN, status);
  ^~
gcc -c  -I/u01/app/oracle/product/19.0.0/client_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"1.83\" -DXS_VERSION=\"1.83\" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112 dbdimp.c
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from dbdimp.c:21:
dbdimp.c: In function ‘ora_db_login6’:
dbdimp.c:923:57: warning: macro expands to multiple statements [-Wmultistatement-macros]
        (ub4) OCI_ATTR_CONNECTION_CLASS, imp_dbh->errhp, status);
                                                         ^~~~~~
ocitrace.h:325:2: note: in definition of macro ‘OCIAttrSet_log_stat’
  stat=OCIAttrSet(th,ht,ah,s1,a,eh);    \
  ^~~~
dbdimp.c:920:4: note: some parts of macro expansion are not guarded by this ‘if’ clause
    if (imp_dbh->pool_class) /*pool_class may or may not be used */
    ^~
dbdimp.c: In function ‘ora_bind_ph’:
dbdimp.c:3401:4: warning: increment of a boolean expression [-Wbool-operation]
    ++imp_sth->has_inout_params;
    ^~
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from dbdimp.c:21:
dbdimp.c: In function ‘ora_free_phs_contents’:
ocitrace.h:380:2: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (DBD_OCI_TRACEON(impxxh)) PerlIO_printf(DBD_OCI_TRACEFP(impxxh), \
  ^~
dbdimp.c:4395:9: note: in expansion of macro ‘OCIDescriptorFree_log’
         OCIDescriptorFree_log(imp_sth, phs->desc_h, phs->desc_t);
         ^~~~~~~~~~~~~~~~~~~~~
dbdimp.c:4394:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (phs->desc_h)
  ^~
dbdimp.c: In function ‘dump_env_to_trace’:
dbdimp.c:4764:29: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  } while ((char*)environ[i] != '\0');
                             ^~
dbdimp.c:4764:11: note: did you mean to dereference the pointer?
  } while ((char*)environ[i] != '\0');
           ^
gcc -c  -I/u01/app/oracle/product/19.0.0/client_1/rdbms/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g   -DVERSION=\"1.83\" -DXS_VERSION=\"1.83\" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"19.3.0.0\" -DORA_OCI_102 -DORA_OCI_112 oci8.c
oci8.c:18: warning: "sv_set_undef" redefined
 #define sv_set_undef(sv) if (SvROK(sv)) sv_unref(sv); else SvOK_off(sv)
 
In file included from /usr/lib64/perl5/CORE/perl.h:5644,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/lib64/perl5/CORE/embed.h:673: note: this is the location of the previous definition
 #define sv_set_undef(a)  Perl_sv_set_undef(aTHX_ a)
 
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from oci8.c:12:
oci8.c: In function ‘init_lob_refetch’:
ocitrace.h:380:2: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (DBD_OCI_TRACEON(impxxh)) PerlIO_printf(DBD_OCI_TRACEFP(impxxh), \
  ^~
oci8.c:4571:3: note: in expansion of macro ‘OCIDescriptorFree_log’
   OCIDescriptorFree_log(imp_sth, colhd, OCI_DTYPE_PARAM);
   ^~~~~~~~~~~~~~~~~~~~~
oci8.c:4570:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (colhd)
  ^~
In file included from dbdimp.h:445,
                 from Oracle.h:52,
                 from oci8.c:12:
oci8.c: In function ‘ora_free_lob_refetch’:
ocitrace.h:380:2: warning: macro expands to multiple statements [-Wmultistatement-macros]
  if (DBD_OCI_TRACEON(impxxh)) PerlIO_printf(DBD_OCI_TRACEFP(impxxh), \
  ^~
oci8.c:4911:3: note: in expansion of macro ‘OCIDescriptorFree_log’
   OCIDescriptorFree_log(imp_sth, lr->rowid, OCI_DTYPE_ROWID);
   ^~~~~~~~~~~~~~~~~~~~~
oci8.c:4910:2: note: some parts of macro expansion are not guarded by this ‘if’ clause
  if (lr->rowid)
  ^~
oci8.c: In function ‘get_attr_val’:
oci8.c:2337:25: warning: ‘%02d’ directive writing between 2 and 4 bytes into a region of size 2 [-Wformat-overflow=]
     sprintf(s_tz_hour," %02d",tz_hour);
                         ^~~~
oci8.c:2337:23: note: directive argument in the range [-128, 127]
     sprintf(s_tz_hour," %02d",tz_hour);
                       ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from /usr/lib64/perl5/CORE/perlio.h:41,
                 from /usr/lib64/perl5/CORE/iperlsys.h:51,
                 from /usr/lib64/perl5/CORE/perl.h:3880,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 4 and 6 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __glibc_objsize (__s), __fmt,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~
oci8.c:2335:25: warning: ‘%03d’ directive writing between 3 and 4 bytes into a region of size 2 [-Wformat-overflow=]
     sprintf(s_tz_hour," %03d",tz_hour);
                         ^~~~
oci8.c:2335:23: note: directive argument in the range [-128, 127]
     sprintf(s_tz_hour," %03d",tz_hour);
                       ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from /usr/lib64/perl5/CORE/perlio.h:41,
                 from /usr/lib64/perl5/CORE/iperlsys.h:51,
                 from /usr/lib64/perl5/CORE/perl.h:3880,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 5 and 6 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __glibc_objsize (__s), __fmt,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~
oci8.c:2340:23: warning: ‘%02d’ directive writing between 2 and 4 bytes into a region of size 2 [-Wformat-overflow=]
    sprintf(s_tz_min,":%02d", tz_minute);
                       ^~~~
oci8.c:2340:21: note: directive argument in the range [-128, 127]
    sprintf(s_tz_min,":%02d", tz_minute);
                     ^~~~~~~
In file included from /usr/include/stdio.h:873,
                 from /usr/lib64/perl5/CORE/perlio.h:41,
                 from /usr/lib64/perl5/CORE/iperlsys.h:51,
                 from /usr/lib64/perl5/CORE/perl.h:3880,
                 from /usr/local/lib64/perl5/auto/DBI/DBIXS.h:23,
                 from Oracle.h:50,
                 from oci8.c:12:
/usr/include/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 4 and 6 bytes into a destination of size 3
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __glibc_objsize (__s), __fmt,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~
rm -f blib/arch/auto/DBD/Oracle/Oracle.so
gcc  -lpthread -shared -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -fstack-protector-strong  Oracle.o dbdimp.o oci8.o  -o blib/arch/auto/DBD/Oracle/Oracle.so  \
   -L/u01/app/oracle/product/19.0.0/client_1/lib -lclntsh -ldl -lm -lpthread -lnsl -lirc -limf -lirc -lrt -laio -lresolv -lsvml -lperl   \
  
/usr/bin/ld: cannot find -lnsl
collect2: error: ld returned 1 exit status
make: *** [Makefile:524: blib/arch/auto/DBD/Oracle/Oracle.so] Error 1
  ZARQUON/DBD-Oracle-1.83.tar.gz
  /bin/make -- NOT OK

1
  • Possible solutions can be found at 1, 2 and 3.
    – John K. N.
    Aug 14, 2023 at 12:36

2 Answers 2

0

Based on information I found here: https://www.mail-archive.com/[email protected]/msg08014.html

I tried the following:

rpm -qf /usr/lib64/libnsl.so which showed nothing.

Then I tried sudo dnf install -y libnsl2-devel and I got No match for argument: libnsl2-devel Error: Unable to find a match: libnsl2-devel

I looked for libnsl locally:

ll /usr/lib64/libnsl*

-rwxr-xr-x. 1 root root  99160 Jan 23  2023 /usr/lib64/libnsl-2.28.so
lrwxrwxrwx. 1 root root     14 Jan 23  2023 /usr/lib64/libnsl.so.1 -> libnsl-2.28.so
lrwxrwxrwx. 1 root root     15 Aug 12  2018 /usr/lib64/libnsl.so.2 -> libnsl.so.2.0.0
-rwxr-xr-x. 1 root root 116408 Aug 12  2018 /usr/lib64/libnsl.so.2.0.0

I ended up adding a symbolic link:

cd /usr/lib64/

ln -s /usr/lib64/libnsl.so.1 libnsl.so

cpan install DBD::Oracle worked (compiler warnings notwithstanding).

0

Looks like they've moved libnsl2 to a new repo as of RHEL 8 (to solve Stev's issue) from https://access.redhat.com/discussions/5632561

And https://blogs.perl.org/users/kd/2018/07/dbdoracle-trial-release-2.html#comment-1801872 is pretty much the same as the above, suggesting dnf install libnsl libnsl2-devel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.