ruby-on-rails - 由于 ruby-oci8 gem 捆绑失败,对于 ruby 版本 2.7.1
问题描述
尝试通过捆绑器安装 oci-8 gem
Installing ruby-oci8 2.2.9 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8
/Users/piush/.rvm/rubies/ruby-2.7.1/bin/ruby -I /Users/piush/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20210422-24251-1t9o27q.rb extconf.rb
attempting to locate oracle-instantclient...
checking 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
--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/piush/.rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
--with-instant-client
--without-instant-client
--with-instant-client-dir
--without-instant-client-dir
--with-instant-client-include
--without-instant-client-include=${instant-client-dir}/include
--with-instant-client-lib
--without-instant-client-lib=${instant-client-dir}/lib
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:568:in `guess_ic_dir': RuntimeError (RuntimeError)
from /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:268:in `get'
from extconf.rb:22:in `<main>'
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:568:in `guess_ic_dir': Set the environment variable DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or
(RuntimeError)
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.
from /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:268:in `get'
from extconf.rb:22:in `<main>'
DYLD_LIBRARY_PATH is not set.
DYLD_FALLBACK_LIBRARY_PATH is not set.
checking OCI_DIR...
checking the default value of DYLD_FALLBACK_LIBRARY_PATH...
checking /Users/piush/lib... no
checking /usr/local/lib... no
checking /lib... no
checking /usr/lib... no
---------------------------------------------------
Error Message:
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.
Backtrace:
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:568:in `guess_ic_dir'
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:268:in `get'
extconf.rb:22:in `<main>'
---------------------------------------------------
See:
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-full-client.md for Oracle full client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-on-osx.md for OS X
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/report-installation-issue.md to report an issue.
extconf failed, exit code 1
Gem files will remain installed in /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9 for inspection.
Results logged to /Users/piush/.rvm/gems/ruby-2.7.1/extensions/x86_64-darwin-19/2.7.0/ruby-oci8-2.2.9/gem_make.out
An error occurred while installing ruby-oci8 (2.2.9), and Bundler cannot continue.
Make sure that `gem install ruby-oci8 -v '2.2.9' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
ruby-oci8
即使我在 .bash_profile 文件下声明了所有必需的变量,我的 Bundle 安装也会失败,如下所示:
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # 加载默认的.profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH="$HOME/.rbenv/bin:$PATH"
#export DYLD_LIBRARY_PATH="/Users/piush/Documents/oracle_12c/instantclient_12_2"
#export DYLD_FALLBACK_LIBRARY_PATH="/Users/piush/Documents/oracle_12c/instantclient_12_2"
#export ORACLE_HOME="/Users/piush/Documents/oracle_12c//instantclient_12_2"
#export OCI_DIR="/Users/piush/Documents/oracle_12c/instantclient_12_2"
# Add Homebrew's executable directory to the front of the PATH
export PATH=/usr/local/bin:$PATH
~
Eveb 我尝试单独安装 gem,但仍然没有运气并得到以下结果:
piush@GUVA-161114-C02Y80Y3JGH8 project % gem install ruby-oci8 -v '2.2.9' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
current directory: /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8
/Users/piush/.rvm/rubies/ruby-2.7.1/bin/ruby -I /Users/piush/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20210422-25570-10pdwc4.rb extconf.rb
attempting to locate oracle-instantclient...
checking 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
--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/piush/.rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
--with-instant-client
--without-instant-client
--with-instant-client-dir
--without-instant-client-dir
--with-instant-client-include
--without-instant-client-include=${instant-client-dir}/include
--with-instant-client-lib
--without-instant-client-lib=${instant-client-dir}/lib
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:568:in `guess_ic_dir': RuntimeError (RuntimeError)
from /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:268:in `get'
from extconf.rb:22:in `<main>'
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:568:in `guess_ic_dir': Set the environment variable DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or (RuntimeError)
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.
from /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:268:in `get'
from extconf.rb:22:in `<main>'
DYLD_LIBRARY_PATH is not set.
DYLD_FALLBACK_LIBRARY_PATH is not set.
checking OCI_DIR...
checking the default value of DYLD_FALLBACK_LIBRARY_PATH...
checking /Users/piush/lib... no
checking /usr/local/lib... no
checking /lib... no
checking /usr/lib... no
---------------------------------------------------
Error Message:
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.
Backtrace:
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:568:in `guess_ic_dir'
/Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9/ext/oci8/oraconf.rb:268:in `get'
extconf.rb:22:in `<main>'
---------------------------------------------------
See:
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-full-client.md for Oracle full client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md for Oracle instant client
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-on-osx.md for OS X
* http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/report-installation-issue.md to report an issue.
extconf failed, exit code 1
Gem files will remain installed in /Users/piush/.rvm/gems/ruby-2.7.1/gems/ruby-oci8-2.2.9 for inspection.
Results logged to /Users/piush/.rvm/gems/ruby-2.7.1/extensions/x86_64-darwin-19/2.7.0/ruby-oci8-2.2.9/gem_make.out
任何快速帮助都会很棒,因为我被困在这里。我使用的 ruby 版本是 2.7.1
解决方案
我遇到了同样的问题。发现问题是因为我只安装了所需的 3 个 Oracle zip 文件中的 2 个。
我已经安装了:
- 即时客户端-基本-macos.x64-11.2.0.3.0.zip
- 即时客户端-sqlplus-macos.x64-11.2.0.3.0.zip
当我安装了 instantclient-sdk-macos.x64-11.2.0.3.0.zip 后,终于可以成功运行了:
gem install ruby-oci8 -v '2.2.9'
此处信息: https ://coderwall.com/p/nvva7a/setup-oracle-instant-client-and-ruby-oci8-gem-on-mac
推荐阅读
- mysql - MySQL - 如何在不使用联合表的情况下跨两个数据库服务器有效地查询数据
- c# - 如何将两个存储过程合并为一个方法并返回一个结果?
- php - Symfony 3:在选择标签中显示同一实体的 2 列,并且只选择一个
- tensorflow - 如何为值 1 / 10 / 100 计算 DetectionBoxes_Recall?
- google-maps-api-3 - 为什么 google maps js api marker mousein 事件在稍微超出标记时会发生?
- azure - arm 模板函数不能使用默认值
- c# - EWS:在电子邮件正文中搜索仅响应 250 个结果
- python - 创建容器内的进程并与之通信
- neo4j - 如何在 neo4j 中创建带有空格的节点属性键?
- php - 我一直收到此错误通知:尝试在 PHP 中获取非对象的属性:php 错误