har*_*key 7 ruby oracle ruby-on-rails ruby-on-rails-3
我执行
$ bundle install
Run Code Online (Sandbox Code Playgroud)
对于我的导轨应用程序......(3.2.8)
当它到达ruby-oci8时...
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for load library path...
LD_LIBRARY_PATH...
checking /usr/lib/oracle/12.1/client/... no
checking ld.so.conf... no
checking for cc... ok
checking for gcc... yes
checking for LP64... no
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=/home/ubuntu/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-instant-client
--without-instant-client
/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:760:in `get_version': RuntimeError (RuntimeError)
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:709:in `initialize'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'
from extconf.rb:18:in `<main>'
---------------------------------------------------
Error Message:
cannot get Oracle version from sqlplus
Backtrace:
/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:760:in `get_version'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:709:in `initialize'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320: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 /home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5 for inspection.
Results logged to /home/ubuntu/.rvm/gems/ruby-1.9.3-p448/gems/ruby-oci8-2.1.5/ext/oci8/gem_make.out
An error occurred while installing ruby-oci8 (2.1.5), and Bundler cannot continue.
Make sure that `gem install ruby-oci8 -v '2.1.5'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我从每个网站和论坛(特别是从这里)做了一切.这个我觉得最近的... http://jigyasamakkar.com/ruby-oci8-with-rails-3-1-on-ubuntu/
解决这个问题的最佳方法是什么?
我最近不得不安装oracle + ruby gem,这里是mac的说明(但是对于ubuntu也可以.)完整说明如下:
http://blog.codiez.co.za/2013/09/setup-oracle-instant-client-ruby-oci8-gem-mac/
关键是ruby-oci gem需要知道动态库的存储位置.对于ubuntu,您需要设置:LD_LIBRARY_PATH
抓取以下文件:
提取它们并将它们放在某处,然后添加以下环境变量.有关详细说明,请参阅链接
export ORACLE_BASE=/usr/local/oracle
export ORACLE_HOME=$ORACLE_BASE/product/instantclient_64/11.2.0.3.0
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$DYLD_LIBRARY_PATH
export TNS_ADMIN=$ORACLE_BASE/admin/network
Run Code Online (Sandbox Code Playgroud)
环境变量的说明:
ORACLE_BASE:存储所有文件的位置 ORACLE_HOME:实际客户端LD_LIBRARY_PATH的路径 :应该指向lib目录,确保你在这里提取了SDK zip文件 TNS_ADMIN:在哪里找到你的TNS_ADMIN文件(对ruby来说不是必需的) oci gem)