现在的位置: 首页 > 综合 > 正文

rails 4.0 中使用 cap 发布的时候,出现 LD_LIBRARY_PATH 没有设置的问题 的解决办法

2013年04月01日 ⁄ 综合 ⁄ 共 4148字 ⁄ 字号 评论关闭

rails 4.0 中  使用 cap 2.15.4 (用 cap 2.15.5 和 3.0.0, 3.0.1 版本) 会出现 svn无法执行的错误。

1.由于使用了 orcale的adapter  

安装 ruby-oci8 -v '2.1.5'` 的时候会出现 

** [out :: 192.168.10.188] /home/dev/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb

 ** [out :: 192.168.10.188] checking for load library path...

 ** [out :: 192.168.10.188] LD_LIBRARY_PATH is not set.

 ** [out :: 192.168.10.188] checking ld.so.conf... no

 ** [out :: 192.168.10.188] checking for cc... ok

 ** [out :: 192.168.10.188] checking for gcc... yes

 ** [out :: 192.168.10.188] checking for LP64... yes

 ** [out :: 192.168.10.188] checking for sys/types.h... yes

 ** [out :: 192.168.10.188] checking for ruby header... ok

 ** [out :: 192.168.10.188] *** extconf.rb failed ***

 ** [out :: 192.168.10.188] Could not create Makefile due to some reason, probably lack of necessary

 ** [out :: 192.168.10.188] libraries and/or headers.  Check the mkmf.log file for more details.  You may

 ** [out :: 192.168.10.188] need configuration options.

 ** [out :: 192.168.10.188] 

 ** [out :: 192.168.10.188] Provided configuration options:

 ** [out :: 192.168.10.188] --with-opt-dir

 ** [out :: 192.168.10.188] --without-opt-dir

 ** [out :: 192.168.10.188] --with-opt-include

 ** [out :: 192.168.10.188] --without-opt-include=${opt-dir}/include

 ** [out :: 192.168.10.188] --with-opt-lib

 ** [out :: 192.168.10.188] --without-opt-lib=${opt-dir}/lib

 ** [out :: 192.168.10.188] --with-make-prog

 ** [out :: 192.168.10.188] --without-make-prog

 ** [out :: 192.168.10.188] --srcdir=.

 ** [out :: 192.168.10.188] --curdir

 ** [out :: 192.168.10.188] --ruby=/home/dev/.rvm/rubies/ruby-2.0.0-p247/bin/ruby

 ** [out :: 192.168.10.188] --with-instant-client

 ** [out :: 192.168.10.188] --without-instant-client

 ** [out :: 192.168.10.188] /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:889:in `get_home': RuntimeError (RuntimeError)

 ** [out :: 192.168.10.188] from /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:705:in `initialize'

 ** [out :: 192.168.10.188] from /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'

 ** [out :: 192.168.10.188] from /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'

 ** [out :: 192.168.10.188] from extconf.rb:18:in `<main>'

 ** [out :: 192.168.10.188] ---------------------------------------------------

 ** [out :: 192.168.10.188] Error Message:

 ** [out :: 192.168.10.188] Set the environment variable ORACLE_HOME if Oracle Full Client.

 ** [out :: 192.168.10.188] Append the path of Oracle client libraries to LD_LIBRARY_PATH if Oracle Instant Client.

 ** [out :: 192.168.10.188] 

 ** [out :: 192.168.10.188] Backtrace:

 ** [out :: 192.168.10.188] /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:889:in `get_home'

 ** [out :: 192.168.10.188] /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:705:in `initialize'

 ** [out :: 192.168.10.188] /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `new'

 ** [out :: 192.168.10.188] /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/oraconf.rb:320:in `get'

 ** [out :: 192.168.10.188] extconf.rb:18:in `<main>'

 ** [out :: 192.168.10.188] ---------------------------------------------------

 ** [out :: 192.168.10.188] See:

 ** [out :: 192.168.10.188] * http://ruby-oci8.rubyforge.org/en/HowToInstall.html

 ** [out :: 192.168.10.188] * http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html

 ** [out :: 192.168.10.188] 

 ** [out :: 192.168.10.188] 

 ** [out :: 192.168.10.188] 

 ** [out :: 192.168.10.188] Gem files will remain installed in /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5 for inspection.

 ** [out :: 192.168.10.188] Results logged to /home/dev/SysMaintain/shared/bundle/ruby/2.0.0/gems/ruby-oci8-2.1.5/ext/oci8/gem_make.out

 ** [out :: 192.168.10.188] An error occurred while installing ruby-oci8 (2.1.5), and Bundler cannot

 ** [out :: 192.168.10.188] continue.

 ** [out :: 192.168.10.188] Make sure that `gem install ruby-oci8 -v '2.1.5'` succeeds before bundling.

错误,

解决办法 :

 在 config/deploy.rb 中 设置环境变量

# -*- encoding : utf-8 -*-
require "rvm/capistrano"
require "bundler/capistrano"


default_environment["LD_LIBRARY_PATH"] = "/opt/oracle/instantclient_12_1"
default_environment["ORACLE_HOME"]= '/opt/oracle/instantclient_12_1'
default_environment["NLS_LANG"] = 'AMERICAN_AMERICA.UTF8'


set :application, "SysMaintain"

抱歉!评论已关闭.