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

ADDED: Could be a 32-bit/64-bit mismatch -- I am 64-bit, and trying to build a 32-bit app because I've heard tell (and have had some other issues) with the 64-bit stuff (like sqlplus hasn't worked for me as a 64-bit app). So that might be a hint to the core problem, but I'm not sure... --- Hi, Trying to do an install, read some posts from PerlMonks (like here ), but ultimately followed instructions I found at stackoverflow Ultimately, I because of some funniness with DYLD_LIBRARY_PATH, I believe, I had to go in and become root to do this (per the stackoverflow instructions). However, at the end, when I try a DBI->connect call, i get:
dyld: lazy symbol binding failed: Symbol not found: _OCIAttrSet Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/ +DBD/Oracle/Oracle.bundle Expected in: flat namespace dyld: Symbol not found: _OCIAttrSet Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/ +DBD/Oracle/Oracle.bundle Expected in: flat namespace
I think those symbols should be defined in libclntsh.dylib, and I think i have that set up right:
mpettis@MAC-162-MPETTIS:/Applications/instantclient_11_2 $ ll total 357376 ... lrwxr-xr-x 1 root staff 53B Oct 9 15:08 libclntsh.dylib -> / +Applications/instantclient_11_2/libclntsh.dylib.11.1 ...
But it is not being read. Those warnings also come up when I am doing the manual 'make' command as recommended in the stackoverflow link, but it presses on. Any advice? I'm totally lost as to why symbols aren't being seen...

Thanks in advance, Matt

Replies are listed 'Best First'.
Re: DBD::Oracle install on Mac OSX 10.8.5 (Mountain Lion) (mwahaha)
by Anonymous Monk on Oct 10, 2013 at 00:00 UTC
      Thanks!

      I got it all to work, all on 64bit, and sqlplus even works. Here's my process:

      First, I followed mostly what was at this stackoverflow accepted solution.

      To that end, I did the following:

      I created the directory /Applications/instantclient_11_2.

      I downloaded from Oracle the following packages (not sure they are all necessary, but they were sufficient):

      instantclient-basic-macos.x64-11.2.0.3.0.zip instantclient-sdk-macos.x64-11.2.0.3.0.zip instantclient-sqlplus-macos.x64-11.2.0.3.0.zip

      This was all in my ~/Downloads directory, and they all unzipped into a local 'instantclient_11_2' directory, and I copied all of the results of unzipping that to /Applications/instantclient_11_2.

      Then I did the DBD::Oracle install (see following code), which fails to completely install, but at least gets the files down, which I deal with manually after this step.

      sudo perl -MCPAN -e shell install DBD::Oracle

      That code downloaded to my ~/.cpan/build directory, but per the stack overflow post, you can follow the directions there if that is not where you cpan build directory is.

      Once there I had to cd into the ~/.cpan/build/DBD-Oracle-1.66-(something) directory, then sudo su root. Now, on MacOSX, root is not enabled by default, follow the directions here to get a root account enabled on your machine.

      Now I was ready to build. I had to set two environment variables (while I'm root), like so:

      export ORACLE_HOME=/Applications/instantclient_11_2 export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Applications/instantclien +t_11_2

      to make this work. The second one is paramount because that's why you have to su to root and not just sudo it -- if you try to sudo this, the shell tells you that it doesn't pick up the DYLD_LIBRARY_PATH info. I don't know why, but there you go.

      Now I was ready to do the

      perl Makefile.pl make make install
      commands (while in the module build directory as root).

      This installed, and I got a ton of warnings, but it worked.

      Good luck to you, hope you find these instructions if you hit the same problem I did...

        Well nice tutorial but I have a question, I did all you explain and I have Mountain Lion.. but at the end when I launch < perl example.pl > an error message appear like this:

        DBD::oracle initialisation failed: Can't locate object method "driver" + via package "DBD::oracle" at /System/Library/Perl/Extras/5.16/darwin +-thread-multi-2level/DBI.pm line 808. Perhaps the capitalisation of DBD 'oracle' isn't right. at Modulos/lib +/ConectarDB.pm line 17.

        and this is ConectarDB.pm

        #!/usr/bin/perl package ConectarDB; use strict; use DBI; # variables BD my $db_user = "example"; my $db_pass = "example"; my $host_name = "example"; my $db_name = "example"; # vars my $q_string = "DBI:oracle:host=$host_name;database=$db_name"; sub connect{ return (DBI->connect ($q_string, $db_user, $db_pass, {PrintError => 0, + RaiseError => 1})); } 1;

        So, I try again, but it never works, can you help me??

        Following these instructions, I got the following errors:
        Trying to find an ORACLE_HOME Found /Library/Oracle/instantclient_11_2 WARNING: Setting ORACLE_HOME env var to /Library/Oracle/instantclient_ +11_2 for you. WARNING: If these tests fail you may have to set ORACLE_HOME yourself! Installing on a darwin, Ver#12.0 Using Oracle in /Library/Oracle/instantclient_11_2 Use of uninitialized value $sqlplus_release in pattern match (m//) at +Makefile.pl line 1626. Use of uninitialized value $sqlplus_release in print at Makefile.pl li +ne 1635. Use of uninitialized value $sqlplus_release in pattern match (m//) at +Makefile.pl line 1636. If sqlplus failed due to a linker/symbol/relocation/library er +ror or similar problem then it's likely that you've not configured your environment c +orrectly. Specifically, your DYLD_LIBRARY_PATH environment variable set to include the directory containing the Oracle libraries. I'm having trouble finding your Oracle version number... trying harder WARNING: I could not determine Oracle client version so I'll just default to version 8.0.0.0. Some features of DBD::Oracle may not work. Oracle version based logic in Makefile.PL may produce erroneous result +s. You can use "perl Makefile.PL -V X.Y.Z" to specify a your client versi +on. Oracle version 8.0.0.0 (8.0) DBD::Oracle no longer supports Oracle client versions before 9.2 Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.pl line 2 +71.