kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 78 forks source link

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

Open net1957 opened 1 year ago

net1957 commented 1 year ago

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:inblock 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:incheck_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:inrescue 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:inrequire' 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:inrequire' <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:inrequire' 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:inrequire' 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:inrequire' <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:inrequire' `

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:

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 commented 1 year ago

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 commented 1 year ago

after testing, the problem appear after updating the packages:

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 commented 1 year ago

I tried it one more time on ruby 3.1.4.

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 commented 1 year ago

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 commented 1 year ago

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.