首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在linux上安装ruby-oci8时无法编译OCI错误

在linux上安装ruby-oci8时无法编译OCI错误
EN

Stack Overflow用户
提问于 2019-09-16 21:52:37
回答 1查看 493关注 0票数 0

在linux上安装ruby-oci8时,我得到了cannot compile OCI错误,我使用的命令是gem install ruby-oci8 -v '2.2.7',我使用的是oracle全客户端

代码语言:javascript
运行
复制
[root@advlints01 redf]# gem install 'ruby-oci8' -v '2.2.7'
Building native extensions. This could take a while...
ERROR:  Error installing ruby-oci8:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8
/usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -I /usr/local/rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0 -r ./siteconf20190916-29697-1loq660.rb extconf.rb
checking for load library path...
  LD_LIBRARY_PATH...
    checking /oracle/app/oracle/product/12.2.0/client_1/lib...   skip: /oracle/app/oracle/product/12.2.0/client_1/lib/libclntsh.so.12.1 is for i386 cpu.
  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
Get the version of Oracle from SQL*Plus... 1220
try  -I/oracle/app/oracle/product/12.2.0/client_1/rdbms/public
checking for oci.h... yes
checking for OCIEnvCreate() in oci.h... no
*** 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=/usr/local/rvm/rubies/ruby-2.5.1/bin/$(RUBY_BASE_NAME)
        --with-instant-client
        --without-instant-client
/usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:755:in `initialize': RuntimeError (RuntimeError)
        from /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `new'
        from /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `get'
        from extconf.rb:22:in `<main>'
---------------------------------------------------
Error Message:
  cannot compile OCI
Backtrace:
  /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:755:in `initialize'
  /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/ext/oci8/oraconf.rb:269:in `new'
  /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7/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:

  /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/extensions/x86_64-linux/2.5.0/ruby-oci8-2.2.7/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/gems/ruby-oci8-2.2.7 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.5.1@real_estate_fund/extensions/x86_64-linux/2.5.0/ruby-oci8-2.2.7/gem_make.out
[root@advlints01 redf]#
EN

回答 1

Stack Overflow用户

发布于 2020-02-02 12:58:34

看起来我找到问题的原因了。我正在运行arch linux (manjaro 18xfce),有一个特定于arch linux oracle的安装过程,使用makepkgpacman,所以,oracle-xe包一切正常,安装后我可以运行sqlplus并连接到xe数据库,这是一个默认创建的数据库(通常),但我无法编译ruby-oci8gem(2.2.8v),经过一些研究,我发现问题是在$ORACLE_HOME/lib文件夹中缺少链接:

libclntsh.so -> libclntsh.so.11.1libocci.so -> libocci.so.11.1

11.1是一个lib版本(它取决于oracle版本,例如:11.2、19.5等)

oracle用户下通过ln -s创建这些链接之后,就可以编译ruby-oci8了。

注意:我使用的是完整的instant客户端,而不是即时客户端,并且所有的指南都没有提到如何链接这些.so文件,但是所有与oracle客户端相关的指南都说it =D,这是来自ruby-oci8 - instant client installation开发人员的指南

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57958341

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档