繁体   English   中英

mac (El Capitan) 中的 ruby​​-oci8 安装错误

[英]ruby-oci8 installation error in mac (El Capitan)

我正在尝试使用 ruby​​-oci8 安装 ruby​​-oci8 (mac) 并且无法安装。

当我尝试安装这个 gem 时。

gem install ruby-oci8

它为环境变量生成错误。 我无法弄清楚这个问题。

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/tayyab/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160423-11068-8lu6zg.rb extconf.rb
checking for load library path... 
*** 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/tayyab/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
    --with-instant-client
    --without-instant-client
/Users/tayyab/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby-oci8-2.2.1/ext/oci8/oraconf.rb:566:in `check_ic_dir': RuntimeError (RuntimeError)
    from /Users/tayyab/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby-oci8-2.2.1/ext/oci8/oraconf.rb:316:in `get'
    from extconf.rb:22:in `<main>'
  DYLD_LIBRARY_PATH is not set.
  checking DYLD_FALLBACK_LIBRARY_PATH...
    checking /Users/tayyab/lib... no
    checking /usr/local/lib... no
    checking /lib... no
    checking /usr/lib... no
  checking OCI_DIR...
---------------------------------------------------

错误信息:

  Set the environment variable DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or
  OCI_DIR to point to the Instant client directory.

  If DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH is set, the environment
  variable must be set at runtime also.

  If OCI_DIR is set, dependent shared library paths are checked. If the checking
  is passed, ruby-oci8 works without DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH.

  Note: OCI_DIR should be absolute path.
  Note: DYLD_* environment variables are unavailable for security reasons on OS X 10.11 El Capitan.

知道如何解决它吗?

您需要执行与此处提供的几乎相同的步骤https://stackoverflow.com/a/21443313/4439981,而不是8。

  1. 用OCI_DIR替换DYLD_LIBRARY_PATH

     OCI_DIR=/opt/oracle/instantclient_11_2 export OCI_DIR 

几天后,我也遇到了同样的错误..尝试了很多思考,最后得到的解决方案非常简单。

El Capitan附带了一项新的OS X功能:系统完整性保护(SIP),也称为“无根”模式。 这减少了恶意软件的攻击面。 这是导致无法设置“ DYLD_LIBRARY_PATH”的主要原因。 所以解决方案是禁用此功能以ins

请按照以下步骤禁用SIP:

  1. 重新启动Mac。
  2. 在OS X启动之前,按住Command-R并按住不放,直到看到Apple图标和进度条。 发布。 这会引导您进入恢复状态。
  3. 从实用工具菜单中,选择终端。
  4. 在提示符下,键入以下内容,然后按Return键:csrutil disable
  5. 终端应显示一条消息,指出SIP已禁用。
  6. 从the菜单中,选择重新启动。

    从恢复的实用程序菜单中选择终端。 终端视图使用“恢复中的终端”输入禁用SIP的命令。

错误信息:

在此处输入图片说明

使固定:

export OCI_DIR=$HOME/../../opt/oracle/instantclient_11_2 

在此处输入图片说明

成功:

在此处输入图片说明

下载链接即时客户端:

https://www.oracle.com/uk/database/technologies/instant-client/macos-intel-x86-downloads.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM