如何安装ruby-oci8? [英] How to install ruby-oci8?

查看:129
本文介绍了如何安装ruby-oci8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在OS X上安装ruby-oci8.

I'm trying to install ruby-oci8 on OS X.

我尝试同时安装和不安装sudo.

I've tried installing both with and without sudo.

没有sudo的错误消息:

gem install ruby-oci8
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

带有sudo的错误消息:

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

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for load library path... 
  DYLD_LIBRARY_PATH is not set.
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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    --with-instant-client
    --without-instant-client
./oraconf.rb:887:in `get_home': RuntimeError (RuntimeError)
    from ./oraconf.rb:703:in `initialize'
    from ./oraconf.rb:319:in `new'
    from ./oraconf.rb:319:in `get'
    from extconf.rb:18

错误消息:

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.

The 'sudo' command unset some environment variables for security reasons.
Pass required varialbes as follows
     sudo env DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH /usr/bin/gem install ruby-oci8
  or 
     sudo env ORACLE_HOME=$ORACLE_HOME /usr/bin/gem install ruby-oci8


Backtrace:
  ./oraconf.rb:887:in `get_home'
  ./oraconf.rb:703: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

推荐答案

针对10.9/10.10/10.11OSX Mavericks/Yosemite/El Capitan的ruby-oci8安装的稍有更新的版本-分步:

Slightly updated version of install of ruby-oci8 for 10.9/10.10/10.11OSX Mavericks/Yosemite/El Capitan - step-by-step:

  1. 转到此处: http://www.oracle.com/technetwork/topics/intel- macsoft-096467.html
  2. 下载64位版本的Instantclient-sqlplus,instantclient-sdk,instantclient-basic -32位版本不适用于OSX 10.9
  3. 在/opt/oracle中创建目录
  4. 首先将Instantclient基本解压缩,移至/opt/oracle(应添加文件夹-类似于/opt/oracle/instantclient_11_2/)
  5. 解压缩Instantclient-sdk并将其内容移动到/opt/oracle/instantclient_11_2/
  6. 解压缩Instantclient-sqlplus并移动其内容/opt/oracle/instantclient_11_2/
  7. 打开终端(如果尚未打开)并输入...
  8. DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export DYLD_LIBRARY_PATH
  9. ORACLE_HOME=/opt/oracle/instantclient_11_2 export ORACLE_HOME
  10. cd /opt/oracle/instantclient_11_2
  11. ln -s libclntsh.dylib.11.1 libclntsh.dylib(创建符号链接)
  12. env
  13. 验证DYLD_LIBRARY_PATH =/opt/oracle/instantclient_11_2(确保在instantclient_11_2之后没有尾随/)
  14. 验证ORACLE_HOME =/opt/oracle/instantclient_11_2
  15. gem安装ruby-oci8
  1. Go here: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
  2. Download the 64bit versions of instantclient-sqlplus, instantclient-sdk, instantclient-basic - the 32bit versions do not work with OSX 10.9
  3. Create directories at /opt/oracle
  4. Unzip instantclient-basic first, move to /opt/oracle (should add a folder - something like /opt/oracle/instantclient_11_2/)
  5. Unzip instantclient-sdk and move its contents to /opt/oracle/instantclient_11_2/
  6. Unzip instantclient-sqlplus and move its contents /opt/oracle/instantclient_11_2/
  7. Open Terminal (if you haven't already) and type...
  8. DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export DYLD_LIBRARY_PATH
  9. ORACLE_HOME=/opt/oracle/instantclient_11_2 export ORACLE_HOME
  10. cd /opt/oracle/instantclient_11_2
  11. ln -s libclntsh.dylib.11.1 libclntsh.dylib (creates a symbolic link)
  12. env
  13. verify that DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 (be sure there's no trailing / after instantclient_11_2)
  14. verify ORACLE_HOME=/opt/oracle/instantclient_11_2
  15. gem install ruby-oci8

应该在那之后工作.文件结构应类似于以下内容:

Should work after that. The file structure should look similar to this:

这篇关于如何安装ruby-oci8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆