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

fails to load oci.dll on windows x64/msys2 rub 3.1.4p223 after update of msys2 #254

Open
net1957 opened this issue May 30, 2023 · 5 comments

Comments

@net1957
Copy link

net1957 commented May 30, 2023

For a long time I used this gem (ruby-oci8-2.2.12-x64-mingw-ucrt) on windows10 (latest version and patch) to connect to a Oracle11 DB located on a linux server.

I update the msys2 subsystem with ridk exec pacman -S -u -y 2 or times in a month.

And now this gem won't load.

I checked with a simple:
ruby -r oci8 -e "OCI8.new('dbpresenter', 'dbpresenter',' sk-oracle1.sk.loc/XE).exec('select login from users') do |r| puts r.join(','); end"

and it fail with
D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8/check_load_error.rb:60:in block in check_os_specific_load_error': Cannot find DLLs depended by D:\program\Oracle\x64\instantclient_18_5\OCI.DLL. (LoadError)
See http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-instant-client.md#Windows
from D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8/check_load_error.rb:48:in each' from D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8/check_load_error.rb:48:in check_os_specific_load_error'
from D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8/check_load_error.rb:138:in check_load_error' from D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8.rb:115:in rescue in <top (required)>'
from D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8.rb:113:in <top (required)>' from <internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in require'
from internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb:160:in rescue in require' from <internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:149:in require'
internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb:85:in require': 126: Le module spÚcifiÚ est introuvable. - D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8lib_310.so (LoadError) from <internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require'
from D:/program/Ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/ruby-oci8-2.2.12-x64-mingw-ucrt/lib/oci8.rb:112:in <top (required)>' from <internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in require'
from internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb:160:in rescue in require' from <internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:149:in require'
internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb:85:in require': cannot load such file -- oci8 (LoadError) from <internal:D:/program/Ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require'
`

I checked that the correct Visual C++ runtime library is installed.
It fails with all supported versions of InstantClient!

I did remove the 314p2223 version and msys2 from the system and reinstalled it with the this package:
https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.4-1/rubyinstaller-devkit-3.1.4-1-x64.exe

the msys subsystem is:
D:\Dvlt\ruby\projects\_active>ridk exec uname -a MINGW64_NT-10.0-19045 SK-XPS 3.4.6.x86_64 2023-02-15 18:03 UTC x86_64 Msys

installed the ruby-oci8 gem:
D:\Dvlt\ruby\projects\_active>gem install ruby-oci8 Fetching ruby-oci8-2.2.12-x64-mingw-ucrt.gem Successfully installed ruby-oci8-2.2.12-x64-mingw-ucrt 1 gem installed

After that oci.dll is correctly loaded!
ruby -r oci8 -e "OCI8.new('dbpresenter', 'dbpresenter',' sk-oracle1.sk.loc/XE).exec('select login from users') do |r| puts r.join(','); end"

After upgrading msys2, it fail.

So, some library break ruby-oci8, but I don't have any clue about it. (the latest time it was running was may the 8)
the msys2 updates:

  • msys2-runtime-3.4.6-2-x86_64
  • pacman-6.0.2-6-x86_64
  • curl-8.1.1-2
  • gawk-5.2.2-1
  • less-633-1
  • libcurl-8.1.1-2
  • libgc-8.2.4-1
  • libgcrypt-1.10.2-1
  • libgpg-error-1.47-1
  • libgpgme-1.20.0-1
  • libhogweed-3.9-1
  • liblzma-5.4.3-1
  • libnettle-3.9-1
  • libnghttp2-1.53.0-1
  • libopenssl-3.1.0-2
  • libsqlite-3.42.0-2
  • libxml2-2.10.4-1
  • libzstd-1.5.5-1
  • mingw-w64-ucrt-x86_64-binutils-2.40-4
  • mingw-w64-ucrt-x86_64-crt-git-11.0.0.r18.g9df2e604d-1
  • mingw-w64-ucrt-x86_64-gcc-13.1.0-6
  • mingw-w64-ucrt-x86_64-gcc-libs-13.1.0-6
  • mingw-w64-ucrt-x86_64-headers-git-11.0.0.r18.g9df2e604d-1
  • mingw-w64-ucrt-x86_64-isl-0.26-1
  • mingw-w64-ucrt-x86_64-libmangle-git-11.0.0.r18.g9df2e604d-1
  • mingw-w64-ucrt-x86_64-libwinpthread-git-11.0.0.r18.g9df2e604d-1
  • mingw-w64-ucrt-x86_64-mpfr-4.2.0.p9-1
  • mingw-w64-ucrt-x86_64-tools-git-11.0.0.r18.g9df2e604d-1
  • mingw-w64-ucrt-x86_64-winpthreads-git-11.0.0.r18.g9df2e604d-1
  • mingw-w64-ucrt-x86_64-zstd-1.5.5-1
  • mpfr-4.2.0.p9-1
  • nettle-3.9-1
  • openssl-3.1.0-2
  • pacman-contrib-1.9.0-1
  • rebase-4.5.0-4
  • tcl-8.6.12-3
  • wget-1.21.4-1
  • xz-5.4.3-1
  • zstd-1.5.5-1

On ruby 3.2.2 it work with the laatest msys update:
D:\Dvlt\ruby\projects\_active>ridk exec uname -a
MINGW64_NT-10.0-19045 SK-XPS 3.4.6.x86_64 2023-04-01 11:43 UTC x86_64 Msys`

Could you help me about this problem?
regards

@net1957
Copy link
Author

net1957 commented May 30, 2023

to sum up:

work on ruby 3.1.4 with msys2 shipped with https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.4-1/rubyinstaller-devkit-3.1.4-1-x64.exe
fail after update of msys2 with ridk exec pacman -S -u -y

work on ruby 3.2.2 with current msys2 updated the same way

so the problem seems to be generated after applying the msys2 update (list of package updated listed in previous post)

Serge

@net1957
Copy link
Author

net1957 commented May 30, 2023

after testing, the problem appear after updating the packages:

  • mingw-w64-ucrt-x86_64-gcc-13.1.0-6
  • mingw-w64-ucrt-x86_64-gcc-libs-13.1.0-6

the log:
[2023-05-30T19:18:38+0200] [ALPM] upgraded mingw-w64-ucrt-x86_64-gcc-libs (12.2.0-10 -> 13.1.0-6)
[2023-05-30T19:18:54+0200] [ALPM] upgraded mingw-w64-ucrt-x86_64-gcc (12.2.0-10 -> 13.1.0-6)

perhaps some problem with gcc libs between v12 and 13 ?

downgrading those 2 packages
ridk exec pacman -U mingw-w64-ucrt-x86_64-gcc-12.2.0-10-any.pkg.tar.zst mingw-w64-ucrt-x86_64-gcc-libs-12.2.0-10-any.pkg.tar.zst correct the problem but will not work in the long term

@net1957
Copy link
Author

net1957 commented Jun 5, 2023

I tried it one more time on ruby 3.1.4.

  • first uninstall the gem: gem --remove ruby-oci8

  • install it (without pre-compiled lib) gem install --platform ruby ruby-oci8

And this time it work!
But if I install it the standard way gem install ruby-oci8, it fail!

Hope this can help someone.

@mohits
Copy link

mohits commented Jun 13, 2023

thanks, I have some notes on: https://notepad.onghu.com/2021/ruby-oracle-oci-windows-sequel/ and will try to describe your issue and solution there, in case it shows up in search results at some point for others.

@net1957
Copy link
Author

net1957 commented Jun 13, 2023

I assume that the .so module of this gem was compiled with gcc12 and that there is a compatibility issue with the msys2 libs that have migrated to gcc13. A compilation solves the problem.

With ruby 3.2 this problem does not exist.

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