Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query : Is ruby-oci8 gem version 2.2.12 broken on Windows (with Ruby 2.5.x)? #251

Closed
pbisht-lab opened this issue Jan 11, 2023 · 4 comments

Comments

@pbisht-lab
Copy link

pbisht-lab commented Jan 11, 2023

Hello,

  • In our automation, we use this gem on Windows and Linux machines with Ruby version 2.5.x.
  • But since the newly released version 2.2.12, installation of this gem has been failing on Windows environment with the error pasted at the bottom.
  • Meanwhile, it continues to run fine on the Linux machine, with the similar environment, including Ruby version 2.5.x.
  • Besides this, while digging for the root cause, I came across this commit for 2.2.12, and am wondering if the support for this gem has been removed or broken on Windows with Ruby 2.5.x? Because I couldn't find any such mention in the release notes.
    -- But I can still see here that it mentions Ruby version 1.9.1 as the min supported version

Please let me know if need any specific info from my end.
Thank you!

Expand to see error logs

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8
C:/tools/ruby25/bin/ruby.exe -r ./siteconf20230105-3792-1jqcghx.rb extconf.rb
attempting to locate oracle-instantclient...
checking load library path...
PATH...
checking C:\tools\ruby25\bin... no
checking C:\tools\ruby25\msys32\mingw32\bin... no
checking C:\tools\ruby25\msys32\usr\bin... no
checking C:\Program Files\postgresql\10\bin... no
checking C:\Program Files\Git\usr\bin... no
checking C:\tools\ruby25\bin... no
checking C:\Program Files\CMake\bin... no
checking C:\Program Files(x86)\CMake\bin... no
checking C:\ProgramData\Oracle\Java\javapath... no
checking C:\Program Files\7-Zip... no
checking C:\Windows\system32... no
checking C:\Windows... no
checking C:\Windows\System32\Wbem... no
checking C:\Windows\System32\WindowsPowerShell\v1.0... no
checking C:\Windows\System32\OpenSSH... no
checking C:\opscode\chef\bin... no
checking C:\opscode\chef\embedded\bin... no
checking C:\opscode\chef\bin... no
checking C:\ProgramData\chocolatey\bin... no
checking C:\cygwin... no
checking C:\cygwin\bin... no
checking C:\Program Files\Git\cmd... no
checking C:\Program Files\PostgreSQL\10\bin... no
checking C:\Users\vagrant\AppData\Local\Microsoft\WindowsApps... 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=C:/tools/ruby25/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
C:/tools/ruby25/lib/ruby/2.5.0/win32/registry.rb:289:in OpenKey': RuntimeError (RuntimeError) from C:/tools/ruby25/lib/ruby/2.5.0/win32/registry.rb:431:in open'
from C:/tools/ruby25/lib/ruby/2.5.0/win32/registry.rb:542:in open' from C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:23:in oracle_homes'
from
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:756:in
get_home' from C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:676:in initialize'
from
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:262:in
new' from C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:262:in get'
from extconf.rb:22:in `'
Error Message:
The system cannot find the file specified.
Backtrace:
C:/tools/ruby25/lib/ruby/2.5.0/win32/registry.rb:289:in OpenKey' C:/tools/ruby25/lib/ruby/2.5.0/win32/registry.rb:431:in open'
C:/tools/ruby25/lib/ruby/2.5.0/win32/registry.rb:542:in open' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:23:in oracle_homes'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:756:in
get_home' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:676:in initialize'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:262:in
new' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12/ext/oci8/oraconf.rb:262:in get'
extconf.rb:22:in `'
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:

C:/tools/ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/ruby-oci8-2.2.12/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/ruby-oci8-2.2.12 for inspection.
Results logged to
C:/tools/ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/ruby-oci8-2.2.12/gem_make.out

C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:92:in run' C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/ext_conf_builder.rb:46:in block
in build'
C:/tools/ruby25/lib/ruby/2.5.0/tempfile.rb:295:in open' C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/ext_conf_builder.rb:30:in build'
C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:164:in block (2 levels) in build_extension' C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:163:in chdir'
C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:163:in block in build_extension' C:/tools/ruby25/lib/ruby/2.5.0/monitor.rb:235:in mon_synchronize'
C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:162:in
build_extension' C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:201:in block in
build_extensions'
C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:198:in each' C:/tools/ruby25/lib/ruby/2.5.0/rubygems/ext/builder.rb:198:in build_extensions'
C:/tools/ruby25/lib/ruby/2.5.0/rubygems/installer.rb:791:in build_extensions' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:72:in build_extensions'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/rubygems_gem_installer.rb:28:in
install' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:207:in install'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:54:in
install' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:16:in install_from_spec'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:186:in
do_install' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:177:in block in worker_pool'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/worker.rb:62:in
apply_func' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/worker.rb:57:in block in process_queue'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in
loop' C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in process_queue'
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/bundler-2.3.26/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'

An error occurred while installing ruby-oci8 (2.2.12), and Bundler cannot
continue.

In Gemfile:
ruby-oci8
[Pipeline] }
ERROR: script returned exit code 1

@pbisht-lab pbisht-lab changed the title Query : Is ruby-oci8 gem version 2.2.12 broken on Windows? Query : Is ruby-oci8 gem version 2.2.12 broken on Windows (with Ruby 2.5.x)? Jan 12, 2023
@kubo
Copy link
Owner

kubo commented Jan 12, 2023

@pbisht-lab
Could you install Oracle instant client basic (or basic lite) and sdk packages?

On Windows 10 build 17063 or later where bsdtar (not GNU tar) and curl are bundled:

curl -O https://download.oracle.com/otn_software/nt/instantclient/218000/instantclient-basiclite-windows.x64-21.8.0.0.0dbru.zip
curl -O https://download.oracle.com/otn_software/nt/instantclient/218000/instantclient-sdk-windows.x64-21.8.0.0.0dbru.zip
tar xf instantclient-basiclite-windows.x64-21.8.0.0.0dbru.zip
tar xf instantclient-sdk-windows.x64-21.8.0.0.0dbru.zip
set PATH=%cd%\instantclient_21_8;%PATH%
gem install ruby-oci8

Well, I have not tested above. I'm using linux now.

I think that ruby-oci8 runs with ruby 2.5.x. I removed ruby 2.5.x support from binary gems (2.2.12-x64-mingw32 and 2.2.12-x86-mingw32) because 2.5.x has not been maintained anymore.

@kubo
Copy link
Owner

kubo commented Jan 12, 2023

@pbisht-lab
If you use Oracle clients whose version is lower than 18, you should use gem install ruby-oci8 -- --with-runtime-check instead of gem install ruby-oci8.

Ruby-oci8 compiled for Oracle client 21 doesn't run with Oracle client lower than 18 where oci.dll doesn't have OCIServerRelease2 function. When it is compiled with --with-runtime-check, it checks available functions at runtime.

@pbisht-lab
Copy link
Author

Thank you @kubo for the detailed response :-)
When I try the above suggestion to use --with-runtime-check, gem installation still fails on Windows with below error. So for now, I have pinned this gem to 2.2.11 in our automation. So I am closing this issue as my query was answered.

C:\vagrant_data>ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [i386-mingw32]
C:\vagrant_data>gem install ruby-oci8 -- --with-runtime-check
Fetching: ruby-oci8-2.2.12-x86-mingw32.gem (100%)
ERROR: Error installing ruby-oci8:
The last version of ruby-oci8 (>= 0) to support your Ruby & RubyGems was 2.2.12. Try installing it with gem install ruby-oci8 -v 2.2.12
ruby-oci8 requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

@kubo
Copy link
Owner

kubo commented Jan 13, 2023

@pbisht-lab Could you try again with gem install --platform ruby ruby-oci8 -- --with-runtime-check?

Your ruby platform is i386-mingw32, so gem install without --platform ??? tries to install gem containing compiled binary files for x86-mingw32, whose minimum ruby version is 2.6. When --platform ruby is specified, it tries to install gem without compiled binary files.

In addition you need to get Oracle instant client for Windows 32 bit, instead of Windows x64 when ruby is 32-bit.

curl -O https://download.oracle.com/otn_software/nt/instantclient/218000/instantclient-basiclite-nt-21.8.0.0.0dbru.zip
curl -O https://download.oracle.com/otn_software/nt/instantclient/218000/instantclient-sdk-nt-21.8.0.0.0dbru.zip
tar xf instantclient-basiclite-nt-21.8.0.0.0dbru.zip
tar xf instantclient-sdk-nt-21.8.0.0.0dbru.zip
set PATH=%cd%\instantclient_21_8;%PATH%
gem install --platform ruby ruby-oci8 -- --with-runtime-check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants