部署 utuntu 下 rvmsudo 安装 ruby-oci8 失败

joinall · 2012年11月07日 · 4407 次阅读

在安装 rvm 时没有 sudo,然后安装 oracle-instant-client 和 ruby-oci8 都正常。 因为 ubuntu 下 rails s -p 80 需要 root,在 3000 端口下网站能正常访问。 所以用 rvmsudo rails s -p 80,打开网站时提示连接数据库失败。

ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished): activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in retrieve_connection' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_specification.rb:170:inretrieve_connection' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in connection' activerecord (3.2.8) lib/active_record/query_cache.rb:67:inrescue in call' activerecord (3.2.8) lib/active_record/query_cache.rb:61:in call' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:incall' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'

然后 google,打不开。换 bing,搜到 http://babinho.net/2012/05/installing-rails-server-on-ubuntu-12-04-with-rvm-nginx-passenger-and-oracle-support/ 需要 rvmsudo gem install ruby-oci8 我 rvmsudo 时提示: joinall@nxbbs-server:/nxbbs/bbs$ rvmsudo gem install ruby-oci8 Building native extensions. This could take a while... ERROR: Error installing ruby-oci8: ERROR: Failed to build gem native extension.

/home/joinall/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for load library path... LD_LIBRARY_PATH is not set. 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 *** 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/joinall/.rvm/rubies/ruby-1.9.3-p286/bin/ruby --with-instant-client --without-instant-client /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:887:in get_home': RuntimeError (RuntimeError) from /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:703:ininitialize' from /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:319:in new' from /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:319:inget'

from extconf.rb:18:in `'

Error Message: Set the environment variable ORACLE_HOME if Oracle Full Client. Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.

Backtrace: /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:887:in get_home' /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:703:ininitialize' /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:319:in new' /home/joinall/.rvm/gems/ruby-1.9.3-p286/gems/ruby-oci8-2.1.2/ext/oci8/oraconf.rb:319:inget'

extconf.rb:18:in `'

See:

我的环境变量设置:/etc/profile export ORACLE_HOME=/opt/oracle/client export PATH=$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib export DYLD_LIBRARY_PATH=$ORACLE_HOME export NLS_LANG='SIMPLIFIED CHINESE_CHINA.AL32UTF8'

不知道是哪里的错误?

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