Is El Capitan preventing me from getting the Perl module DBD::Oracle working

command linedynamic libraryoracleperl

Let me start by saying I'm not traditionally a Mac user. I'm still trying to transition from Gentoo, where compiling everything from source was the default state, and the system wasn't actively trying to prevent me from doing "dangerous" things.

I have a new machine running 10.11. I've gotten sqlplus 11.2.0.4 running, and am able to connect to a remote Oracle server with it. I now want to use DBD::Oracle to connect in a Perl script. I was able to get DBD::Oracle to compile/install by manually passing a version to Makefile.pl rather than using CPAN (or, more specifically, cpanm):

perl Makefile.pl -V 11.2
make
make install

However, when I run the script using the default Perl (5.18.2 located at /usr/bin/perl), I get an error:

ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var  or PATH (Windows) and or NLS settings, permissions, etc.

In case the issue lies with the system perl, I installed perlbrew and then installed 5.22.0 into ~/perl5. Using the perlbrew Perl, I get a different error:

dyld: lazy symbol binding failed: Symbol not found: _OCIAttrSet
  Referenced from: /Users/jrittenh/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/darwin-2level/auto/DBD/Oracle/Oracle.bundle
  Expected in: dynamic lookup

dyld: Symbol not found: _OCIAttrSet
  Referenced from: /Users/jrittenh/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/darwin-2level/auto/DBD/Oracle/Oracle.bundle
  Expected in: dynamic lookup

Trace/BPT trap: 5

I've tried:

  • both 32-bit and 64-bit Oracle libraries
  • symlinking libraries from the specific version (libclntsh.dylib.11.1 => libclntsh.dylib)
  • fixing hard-coded paths to /ade
  • creating a 'mesg' folder and made it writeable in $ORACLE_HOME
  • setting ORACLE_HOME, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, and PATH to include /usr/local/oracle_client from /etc/profile, /etc/bashrc/, ~/.bashrc, and ~/.bash_profile

Is there something else I can try? What am I missing?

Best Answer

I am using Mac OS X 10.11.3 El Capitan, perlbrew 1.74 installed with cpanm & App::perlbrew/0.74 Perl revision 5 version 22 subversion 1 (installed via perlbrew) DBI -- 1.631 DBD::Oracle VERSION: 1.74 Oracle InstantClient 11.2.0.4.0 installed at /usr/local/lib/oracle/instantclient_11_2

I can confirm that the only way, so far, I have been able to get DBD::Oracle to work is by disabling SIP (http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/). Any other way I've tried results in the error "failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var ...".