kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

There was an error while trying to load the gem 'ruby-oci8' #128

Closed RameshKrishnamoorthy closed 8 years ago

RameshKrishnamoorthy commented 8 years ago

I have the following:

export ORACLE_BASE=/usr/local/oracle export ORACLE_HOME=$ORACLE_BASE/product/instantclient_64/11.2.0.4.0 export PATH=$ORACLE_HOME/bin:/Users/rameshkrishnamoorthy/pear/bin:$PATH export DYLD_LIBRARY_PATH=$ORACLE_HOME export OCI_DIR=$ORACLE_HOME

And interestingly, when I run IRB from the ORACLE_HOME folder (/usr/local/oracle/product/instantclient_64/11.2.0.4.0), it works fine!

I am not sure what else is missing in my setup to make it work from any folder and with my rails application.

kubo commented 8 years ago

Could you post the output of the following command?

cd /usr/local/oracle/product/instantclient_64/11.2.0.4.0
ls -l
otool -l libclntsh.dylib.11.1 | grep -E '(DYLIB|RPATH)' -A2
RameshKrishnamoorthy commented 8 years ago

Thanks for the quick response. Here are the outputs:

cd /usr/local/oracle/product/instantclient_64/11.2.0.4.0 pwd /usr/local/oracle/product/instantclient_64/11.2.0.4.0 ls -l total 386304 -rw-rw-rw- 1 rameshkrishnamoorthy staff 484 May 31 2015 BASIC_README -rw-rw-rw- 1 rameshkrishnamoorthy staff 488 May 31 2015 SQLPLUS_README -rwxr-xr-x 1 rameshkrishnamoorthy wheel 14348 Apr 4 16:48 adrci drwxr-xr-x 6 rameshkrishnamoorthy wheel 204 Oct 28 22:54 bin -rw-r--r-- 1 root wheel 7152 Apr 4 13:14 fix_oralib.rb -rw-r--r-- 1 rameshkrishnamoorthy wheel 3297 Apr 4 16:48 fix_oralib.sh -rwxr-xr-x 1 rameshkrishnamoorthy wheel 40768 Apr 4 16:48 genezi -r--r--r-- 1 rameshkrishnamoorthy wheel 368 May 31 2015 glogin.sql drwxr-xr-x 3 rameshkrishnamoorthy wheel 102 Oct 28 22:53 jdbc drwxr-xr-x 12 rameshkrishnamoorthy wheel 408 Oct 28 23:01 lib lrwxr-xr-x 1 rameshkrishnamoorthy wheel 20 Apr 4 18:03 libclntsh.dylib -> libclntsh.dylib.11.1 -r-xr-xr-x 1 rameshkrishnamoorthy wheel 66167420 Apr 4 16:48 libclntsh.dylib.11.1 -r-xr-xr-x 1 rameshkrishnamoorthy wheel 2817872 Apr 4 16:48 libnnz11.dylib -r-xr-xr-x 1 rameshkrishnamoorthy wheel 1897664 Apr 4 16:48 libocci.dylib.11.1 -rwxr-xr-x 1 rameshkrishnamoorthy wheel 118707148 Apr 4 16:48 libociei.dylib -r-xr-xr-x 1 rameshkrishnamoorthy wheel 159004 Apr 4 16:48 libocijdbc11.dylib -r-xr-xr-x 1 rameshkrishnamoorthy wheel 1365444 Apr 4 16:48 libsqlplus.dylib -r-xr-xr-x 1 rameshkrishnamoorthy wheel 1504252 Apr 4 16:48 libsqlplusic.dylib -r--r--r-- 1 rameshkrishnamoorthy wheel 2091135 May 31 2015 ojdbc5.jar -r--r--r-- 1 rameshkrishnamoorthy wheel 2739616 May 31 2015 ojdbc6.jar drwxr-xr-x 3 rameshkrishnamoorthy wheel 102 Oct 28 22:53 rdbms drwxr-xr-x 22 rameshkrishnamoorthy wheel 748 Apr 5 10:13 ruby-oci8 drwxr-xr-x 7 rameshkrishnamoorthy wheel 238 Oct 28 22:58 sdk drwxr-xr-x 3 rameshkrishnamoorthy wheel 102 Oct 28 22:54 sqlplus -rwxr-xr-x 1 rameshkrishnamoorthy wheel 162380 Apr 4 16:48 uidrvci -r--r--r-- 1 rameshkrishnamoorthy wheel 66779 May 31 2015 xstreams.jar

otool -l libclntsh.dylib.11.1 | grep -E '(DYLIB|RPATH)' -A2 cmd LC_ID_DYLIB cmdsize 104

     name /usr/local/oracle/product/instantclient_64/11.2.0.4.0/libclntsh.dylib.11.1 (offset 24)

      cmd LC_LOAD_DYLIB
  cmdsize 96

     name /usr/local/oracle/product/instantclient_64/11.2.0.4.0/libnnz11.dylib (offset 24)

      cmd LC_LOAD_DYLIB
  cmdsize 56
     name /usr/lib/libSystem.B.dylib (offset 24)
kubo commented 8 years ago

Did you try fix_oralib.rb and then try fix_oralib.sh because fix_oralib.rb didn't work? Sorry, fix_oralib.rb had been broken for three days.

Could you run the following command to use the latest version?

/usr/local/oracle/product/instantclient_64/11.2.0.4.0
curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
ruby fix_oralib.rb

It will fix rpath in libclntsh.dylib.11.1.

RameshKrishnamoorthy commented 8 years ago

Yes it worked !!!! Thank you very much. I had already run fix_oralib.sh on the files as you had surmised and assumed that it had fixed everything. What gave you the clue that I had to run fix_oralib.rb again?

Thanks very much again and your fast/timely help is much appreciated.

kubo commented 8 years ago

What gave you the clue that I had to run fix_oralib.rb again?

If libclntsh.dylib.11.1 is fixed by fix_oralib.rb, otool -l libclntsh.dylib.11.1 | grep -E '(DYLIB|RPATH)' -A2 should print LC_RPATH. However LC_PRATH was not found. I guessed that it was fixed by fix_oralib.sh because it doesn't fix LC_RPATH. I noticed that the time stamp of fix_oralib.rb is older than that of fix_oralib.sh. So I guessed that you used broken fix_oralib.rb and then used fix_oralib.sh.

RameshKrishnamoorthy commented 8 years ago

Wow, that is great sleuthing! Keep up the good work! Thanks again.