Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Mark Granoff
RE: compiling on OSX Lion difficulties [ reply ]  
2012-03-20 17:35
Have a look here. I recently went through this, and wrote about it.

http://blog.hawkimedia.com/2012/02/os-x-lion-oracle-ruby-oci8-gem-solution/

It's a working solution, boiled down from a lot of information about this problem from all over the 'net going back months.

By: Eric Peterson
compiling on OSX Lion difficulties [ reply ]  
2012-03-20 16:54
I have Oracle Instant Client (32-bit version) loaded on my MacBookPro 15" with OSX Lion. I am able to connect to 10g and 11g databases with no difficulty. SQL/Developer also works through this client. But I am unable to install the ruby-oci8 gem from the source or directly. Below are all the information asked by the ruby-oci8 issue reporting page.

I use kornshell as my shell and not bash. I was unable to get rvm loaded and working, kept popping up errors I could not solve.

Any help would be greatly appreciated.

Thanks
Eric








epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> which sqlplus
/usr/local/oracle/app/instantclient/sqlplus





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> sqlplus system@xyz01 />
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Mar 20 09:47:41 2012

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

XYZ01-system
>






epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> tail ext/oci8/mkmf.log
"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/Users/epeterson/tmp/ruby-oci8-2.1.0/ext/oci8 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl "
checked program was:
/* begin */
1: int main() { return 0; }
/* end */

./conftest
"gcc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/Users/epeterson/tmp/ruby-oci8-2.1.0/ext/oci8 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c conftest.c"
checked program was:
/* begin */
1: /*top*/
2: #ifndef __GNUC__
3: # error
4: >>>>>> __GNUC__ undefined <<<<<<
5: #endif
/* end */

"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/Users/epeterson/tmp/ruby-oci8-2.1.0/ext/oci8 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl "
checked program was:
/* begin */
1: int main() { return sizeof(long) == 8 ? 0 : 1; }
/* end */

./conftest
have_header: checking for sys/types.h... -------------------- yes

"gcc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/Users/epeterson/tmp/ruby-oci8-2.1.0/ext/oci8 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <sys/types.h>
/* end */

--------------------

sh: /usr/local/oracle/app/instantclient/bin/sqlplus: No such file or directory









epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> sudo env DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH} gem19 install ruby-oci8
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby19 extconf.rb
checking for load library path...
DYLD_LIBRARY_PATH...
checking /usr/local/oracle/app/instantclient... skip: /usr/local/oracle/app/instantclient/libclntsh.dylib.10.1 is for i386 cpu.
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby19
--with-instant-client
--without-instant-client
/usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:887:in `get_home': RuntimeError (RuntimeError)
from /usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:703:in `initialize'
from /usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:319:in `new'
from /usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:319:in `get'
from extconf.rb:18:in `<main>'
---------------------------------------------------
Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to DYLD_LIBRARY_PATH if Oracle Instant Client.

Backtrace:
/usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:887:in `get_home'
/usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:703:in `initialize'
/usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:319:in `new'
/usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/oraconf.rb:319:in `get'
extconf.rb:18:in `<main>'
---------------------------------------------------
See:
* http://ruby-oci8.rubyforge.org/en/HowToInstall.html
* http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html



Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/ruby-oci8-2.1.0/ext/oci8/gem_make.out







epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 --version
ruby 2.0.0dev (2012-02-29) [x86_64-darwin11.3.0]





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['host']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
"x86_64-apple-darwin11.3.0"





> ruby19 -r rbconfig -e "p Config::CONFIG['CC']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
"/usr/bin/gcc"





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['CFLAGS']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
" -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe"






epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['LDSHARED']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
"/usr/bin/gcc -dynamic -bundle"





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['LDFLAGS']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
"-L. -fstack-protector -L/usr/local/lib"





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['DLDLAGS']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
nil





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['LIBS']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
"-lpthread -ldl -lobjc"





son/tmp/ruby-oci8-2.1.0
> ruby19 -r rbconfig -e "p Config::CONFIG['GNU_LD']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.
"no"





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> gcc --print-prog-name=ld
/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/ld






epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> gcc --print-prog-name=as
/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/as





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> file `which ruby19`
/usr/local/bin/ruby19: Mach-O 64-bit executable x86_64





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> ll ${ORACLE_HOME}
total 204224
drwxr-xr-x 26 oracle oinstall 884B Feb 29 13:04 ./
drwxr-xr-x 3 oracle oinstall 102B Feb 29 10:48 ../
-rw-r--r--@ 1 oracle oinstall 278B Feb 29 13:04 BASIC_README
-rw-r--r--@ 1 oracle oinstall 276B Feb 29 13:05 JDBC_README
-rw-r--r--@ 1 oracle oinstall 282B Feb 29 13:05 SQLPLUS_README
-r--r--r--@ 1 oracle oinstall 1.5M Feb 29 13:04 classes12.jar
-rwxr-xr-x@ 1 oracle oinstall 30K Feb 29 13:04 genezi*
-r-xr-xr-x@ 1 oracle oinstall 1.5K Feb 29 13:05 glogin.sql*
lrwxr-xr-x 1 root oinstall 20B Feb 29 13:38 libclntsh.dylib@ -> libclntsh.dylib.10.1
-rwxr-xr-x@ 1 oracle oinstall 21M Feb 29 13:04 libclntsh.dylib.10.1*
-rwxr-xr-x@ 1 oracle oinstall 31K Feb 29 13:05 libheteroxa10.dylib*
-rwxr-xr-x@ 1 oracle oinstall 31K Feb 29 13:05 libheteroxa10.jnilib*
-rwxr-xr-x@ 1 oracle oinstall 1.6M Feb 29 13:04 libnnz10.dylib*
lrwxr-xr-x 1 root oinstall 18B Feb 29 13:38 libocci.dylib@ -> libocci.dylib.10.1
-rwxr-xr-x@ 1 oracle oinstall 1.1M Feb 29 13:04 libocci.dylib.10.1*
-rwxr-xr-x@ 1 oracle oinstall 69M Feb 29 13:04 libociei.dylib*
-rwxr-xr-x@ 1 oracle oinstall 104K Feb 29 13:04 libocijdbc10.dylib*
-rwxr-xr-x@ 1 oracle oinstall 104K Feb 29 13:04 libocijdbc10.jnilib*
-rwxr-xr-x@ 1 oracle oinstall 912K Feb 29 13:05 libsqlplus.dylib*
-rwxr-xr-x@ 1 oracle oinstall 1.4M Feb 29 13:05 libsqlplusic.dylib*
-r--r--r--@ 1 oracle oinstall 1.5M Feb 29 13:04 ojdbc14.jar
-r--r--r--@ 1 oracle oinstall 1.6M Feb 29 13:05 orai18n.jar
drwxr-xr-x 7 oracle oinstall 238B Feb 29 13:06 sdk/
-rw-r--r-- 1 oracle oinstall 147B Feb 29 13:09 sqlnet.ora
-rwxr-xr-x@ 1 oracle oinstall 12K Feb 29 13:05 sqlplus*
-rw-r--r-- 1 oracle oinstall 11K Mar 19 09:05 tnsnames.ora






epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> file ${ORACLE_HOME}/libclntsh.*
/usr/local/oracle/app/instantclient/libclntsh.dylib: Mach-O dynamically linked shared library i386
/usr/local/oracle/app/instantclient/libclntsh.dylib.10.1: Mach-O dynamically linked shared library i386






epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> env | grep ORA
28:ORACLE_BASE=/usr/local/oracle/app
29:ORACLE_HOME=/usr/local/oracle/app/instantclient
30:ORACLE_HOSTNAME=edp-mbp15.sea1.rhapsody.com





epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> env | grep TNS
51:TNS_ADMIN=/usr/local/oracle/app/instantclient




epeterson@edp-mbp15:/Users/epeterson/tmp/ruby-oci8-2.1.0
> env | grep NLS
27:NLS_LANG=AMERICAN_AMERICA.UTF8