我试图在导轨上安装gem ruby-oci8
。
我收到以下错误,
$ gem install ruby-oci8
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
current directory: /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8
/home/solovievga/.rvm/rubies/ruby-2.4.2/bin/ruby -r ./siteconf20180213-21757-1hli0rl.rb 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... yes
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/solovievga/.rvm/rubies/ruby-2.4.2/bin/$(RUBY_BASE_NAME)
--with-instant-client
--without-instant-client
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:909:in `get_home': RuntimeError (RuntimeError)
from /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:728:in `initialize'
from /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `new'
from /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `get'
from extconf.rb:22:in `<main>'
---------------------------------------------------
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/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:909:in `get_home'
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:728:in `initialize'
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269:in `new'
/home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1/ext/oci8/oraconf.rb:269: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.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/solovievga/.rvm/gems/ruby-2.4.2/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.5.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/solovievga/.rvm/gems/ruby-2.4.2/gems/ruby-oci8-2.2.5.1 for inspection.
Results logged to /home/solovievga/.rvm/gems/ruby-2.4.2/extensions/x86_64-linux/2.4.0/ruby-oci8-2.2.5.1/gem_make.out
我想知道如何安装ruby-oci8包?
答案 0 :(得分:2)
这些步骤也会引导您完成即时客户端安装过程,只是为了提供一些上下文。在此处下载即时和SDK zip文件:
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
以root身份解压缩以下目录中的两个文件。
的/ opt / oracle的
在解压缩后输入instantclient_12_2目录并为libclntsh.so文件创建符号链接:
ln -s libclntsh.so.12.1 libclntsh.so
现在,根据您的操作系统,您需要更新LD_LIBRARY_PATH位置。在Ubuntu中,执行以下操作:
sudo nano /etc/ld.so.conf.d/moreLibs.conf
在文件中输入以下内容并保存
/opt/oracle/instantclient_12_2
现在运行以下命令:
sudo ldconfig
重新运行宝石安装
gem install ruby-oci8
答案 1 :(得分:1)
您必须设置LD_LIBRARY_PATH
才能安装ruby-oci8
gem。在这里我假设你使用的是linux操作系统。在您的终端上试试这个。
$ LD_LIBRARY_PATH=$ORACLE_HOME/lib
$ export LD_LIBRARY_PATH
$ gem install ruby-oci8
编辑:
如果您使用mswin32
ruby,请改用以下命令。
gem install --platform x86-mingw32 ruby-oci8
or
gem install --platform x64-mingw32 ruby-oci8
如果您有任何疑问或疑问,请与我们联系。
快乐编码
答案 2 :(得分:0)
此解决方案对我有用
在执行捆绑软件安装之前,请在控制台上运行以下代码,或将其添加到bash和源代码中。
Export OCI_DIR=/opt/oracle/instantclient_12_2
/opt/oracle/instantclient_12_2
是我的mac
计算机上的Instantclient的路径。
您需要从下载instantclient
https://www.oracle.com/database/technologies/instant-client/downloads.html
将下载文件解压缩到/opt/oracle
目录中,并导出OCI_DIR
环境变量。
答案 3 :(得分:0)
安装ruby-oci8
gem时遇到类似的问题。就我而言,已经有一个使用它的应用程序。在捆绑安装期间,当我使用同一gem部署另一个应用程序时,发生了此错误。它要求提供LD_LIBRARY_PATH
环境变量。显然,旧应用程序的安装程序未将变量设置为持久。
我认为服务器的某个位置应该有一个oracle库,因此我进行了搜索。它不在/opt
中,而在/usr/lib
中。我将变量设置为/usr/lib/oracle/11.1/client64/lib
,然后顺利安装了gem。