Gem 有谁在 OSX 10.7 Lion 上成功安装 Ruby 的 Oracle 驱动 ruby-oci8?

liangwenke · 2012年05月01日 · 最后由 shlallen 回复于 2013年07月03日 · 5136 次阅读

ruby-oci8 文档http://ruby-oci8.rubyforge.org/en/file.install-instant-client.html 提示在 64 位 mac os 系统使用 32 位 ruby 版本来安装 32 位 ruby-oci8. 但是我在 ruby1.8/1.9 版本都安装失败,有哪位成功安装这个 gem 的分享下,谢谢!

另外,我参考 http://www.liuzihua.org/past/2011/10/26/107_ionrubyoracleoci8/ 也是一样的结果。

我安装失败日志如下:

$ gem install ruby-oci8
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-oci8:
    ERROR: Failed to build gem native extension.

        /Users/wenke/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb
checking for load library path... 
  DYLD_LIBRARY_PATH... 
    checking /opt/oracle/instantclient_10_2-32bit...   skip: /opt/oracle/instantclient_10_2-32bit/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
Get the version of Oracle from SQL*Plus... *** 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=/Users/wenke/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby
    --with-instant-client
    --without-instant-client
./oraconf.rb:758:in `get_version': RuntimeError (RuntimeError)
    from ./oraconf.rb:707:in `initialize'
    from ./oraconf.rb:319:in `new'
    from ./oraconf.rb:319:in `get'
    from extconf.rb:18
---------------------------------------------------
Error Message:
  cannot get Oracle version from sqlplus
Backtrace:
  ./oraconf.rb:758:in `get_version'
  ./oraconf.rb:707:in `initialize'
  ./oraconf.rb:319:in `new'
  ./oraconf.rb:319:in `get'
  extconf.rb:18
---------------------------------------------------
See:
 * http://ruby-oci8.rubyforge.org/en/HowToInstall.html
 * http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html



Gem files will remain installed in /Users/wenke/.rvm/gems/ree-1.8.7-2012.02/gems/ruby-oci8-2.1.2 for inspection.
Results logged to /Users/wenke/.rvm/gems/ree-1.8.7-2012.02/gems/ruby-oci8-2.1.2/ext/oci8/gem_make.out

#1 楼 @Ddl1st 有使用上面链接的参考,但还是 ruby-cio8 安装失败

#3 楼 @lgn21st Lion 下应该不工作,我实验过,不过我实验的不是装 oci8,是装 oracle 10g

我之前把系统升到 10.7 后来折腾好久没搞定,又装回来了....

#3 楼 @lgn21st 我在系统升级到 10.7 之前一直是用 gem: activerecord-oracle_enhanced-adapter 和 ruby-oci8 连接 oracle 数据库的。

升级后 ruby-oci8 安装不了 (版本 ruby-1.8.7-p358 [ i686 ] 也不可以),但是 32bit 的 sqlplus 还是可以 oracle 数据库的。

不过听说 oracle 官方正准备打补丁支持 64bit Mac Lion 的 oracle 版本。

#6 楼 @liangwenke 这个问题解决了没有,准备升级 lion 中

oralce instantclient x86_64 11.2.0.3.0 已经发布了,可以直接用 64 位。 osx 10.8 ML with Xcode 4.6 ruby-1.9.3-p385 配置:

#9 楼 @hielf 谢谢,可以用了

不错,已升级了,终于可以用上 10.8.2 了。

大神,求助阿,在 ubuntu 上使用 oci8,老是不行,报错:oci8.c:513:in oci8lib.so: ORA-12541: TNS:no listener (OCIError)

需要 登录 后方可回复, 如果你还没有账号请 注册新账号