You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04下Ruby 3.0.1安装ruby-oci8 gem失败求助

在Ubuntu 22.04 LTS上安装ruby-oci8 gem失败

环境信息

  • 系统:Ubuntu 22.04 LTS
  • Ruby版本:3.0.1
  • Oracle InstantClient版本:19_17

问题详情

尝试为Ruby 3.0.1安装ruby-oci8 gem时失败,已安装libdev等相关依赖库,但问题未解决。系统能在指定的LD_LIBRARY_PATH路径中找到Oracle InstantClient 19_17,但安装过程仍崩溃,具体报错日志如下:

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/sanchit/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ruby-oci8-2.2.12/ext/oci8
/home/sanchit/.rbenv/versions/3.0.1/bin/ruby -I /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/3.0.0 -r ./siteconf20240205-19908-h8sb3w.rb extconf.rb
attempting to locate oracle-instantclient...
checking load library path... 
  LD_LIBRARY_PATH... 
    checking /opt/oracle/instantclient_19_17... yes
  /opt/oracle/instantclient_19_17/libclntsh.so.19.1 looks like an instant client.
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
checking for OCIEnvCreate() in oci.h... yes
checking for OCI_MAJOR_VERSION in oci.h... 19
checking for OCI_MINOR_VERSION in oci.h... 17
checking for localtime_r()... yes
checking for dladdr()... yes
checking for dlmodinfo()... no
checking for dlgetname()... no
checking for ruby/thread.h... yes
checking for rb_class_superclass() in ruby.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_sym2str() in ruby.h... yes
checking for plthook... plthook_elf.c
creating extconf.h
*** 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/sanchit/.rbenv/versions/3.0.1/bin/$(RUBY_BASE_NAME)
    --with-instant-client
    --without-instant-client
    --with-instant-client-dir
    --without-instant-client-dir
    --with-instant-client-include
    --without-instant-client-include=${instant-client-dir}/include
    --with-instant-client-lib
    --without-instant-client-lib=${instant-client-dir}/lib
    --with-sys-dir
    --without-sys-dir
    --with-sys-include
    --without-sys-include=${sys-dir}/include
    --with-sys-lib
    --without-sys-lib=${sys-dir}/lib
    --with-oracle-version
    --without-oracle-version
    --with-runtime-check
    --without-runtime-check
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include
    --without-ruby-include=${ruby-dir}/include
    --with-ruby-lib
    --without-ruby-lib=${ruby-dir}/lib
    --with-oracle-version
    --without-oracle-version
    --with-runtime-check
    --without-runtime-check
/home/sanchit/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:456:in `parse_stream': undefined method `parse' for #<Psych::Parser:0x0000559d28a5cb28 @handler=#<Psych::Handlers::DocumentStream:0x0000559d28a5d230 @stack=[], @last=nil, @root=nil, @start_line=nil, @start_column=nil, @end_line=nil, @end_column=nil, @block=#<Proc:0x0000559d28a5cc18 /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:390>>, @external_encoding=0> (NoMethodError)
    from /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:390:in `parse'
    from /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:280:in `load'
    from /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ruby-oci8-2.2.12/ext/oci8/apiwrap.rb:64:in `create_apiwrap'
    from extconf.rb:201:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/ruby-oci8-2.2.12/mkmf.log


extconf failed, exit code 1

Gem files will remain installed in /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ruby-oci8-2.2.12 for inspection.
Results logged to /home/sanchit/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/extensions/x86_64-
linux/3.0.0/ruby-oci8-2.2.12/gem_make.out

内容的提问来源于stack exchange,提问作者Sanchit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 15:47:08