Closed kematy closed 3 years ago
At first glance, it may be a Fiddle problem.
require 'fiddle'
require 'fiddle'
p Fiddle::VERSION
The VERSION constant was added recently, so it may not exist. It means that it is prior to 1.0.0.
How did you install Ruby on Windows? RubyInstaller?
I install ruby with RubyInstaller. irb(main):001:0> require 'fiddle' => false gem install fiddle Fetching: fiddle-1.0.8.gem (100%) Temporarily enhancing PATH for MSYS/MINGW... Installing required msys2 packages: mingw-w64-i686-libffi 错误:无法打开文件 /var/lib/pacman/local/mingw-w64-i686-gnutls-3.6.13-2/desc: No such file or directory Building native extensions. This could take a while...
in msys2, pacman -Syu update system pacman -S mingw-w64-i686-libffi
then in cmd :gem install fiddle irb(main):001:0> require 'fiddle' => false irb(main):002:0> p Fiddle::VERSION "1.0.8" => "1.0.8"
then
D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle.rb:67: warning: already initialized constant Fiddle::RTLD_GLOBAL
D:/Ruby25/lib/ruby/2.5.0/fiddle.rb:53: warning: previous definition of RTLD_GLOBAL was here
D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle.rb:68: warning: already initialized constant Fiddle::RTLD_LAZY
D:/Ruby25/lib/ruby/2.5.0/fiddle.rb:54: warning: previous definition of RTLD_LAZY was here
D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle.rb:69: warning: already initialized constant Fiddle::RTLD_NOW
D:/Ruby25/lib/ruby/2.5.0/fiddle.rb:55: warning: previous definition of RTLD_NOW was here
D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle.rb:61:in initialize': Exec format error (Fiddle::DLError) from D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle.rb:61:in
new'
from D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle.rb:61:in dlopen' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle/import.rb:86:in
block in dlload'
from D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle/import.rb:77:in collect' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/fiddle-1.0.8/lib/fiddle/import.rb:77:in
dlload'
from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui/ffi.rb:78:in <module:FFI>' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui/ffi.rb:74:in
<top (required)>' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui.rb:28:in
require_relative'
from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui.rb:28:in <module:LibUI>' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui.rb:6:in
<top (required)>'
from D:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in require' from D:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in
rescue in require'
from D:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in require' from D:/ruby-lab/guis/libui.rb:1:in
Thanks.
Sorry, It doesn't seem to be a fiddle problem. It seems that libui.dll cannot be loaded. LibUI problem.
First, we need to find out if libui.dll exists.
/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/vendor/libui.dll
Check the file size and make sure the file is not corrupt.
Only ofr 64 bit Ruby?
Only the 64bit version is packed in the Gem. (´-ω-`) Other versions are distributed on the libui site. If you replace it, it might work.
Thank you
Now I can reproduce the issue.
Ruby | libui.dll | work? |
---|---|---|
Ruby+Devkit 2.5.9-1 (x86) | libui-alpha4.1-windows-amd64-shared.zip | Not work |
Ruby+Devkit 2.5.9-1 (x86) | libui-alpha4.1-windows-386-shared.zip | OK |
Thank you for your report. If there are no further problems, please close it.
Updates Added a task to the Rakefile to download the 32-bit libui shared library.
rake vendor:all_x64 # Download libui.so, libui.dylib, and libui.dll to...
rake vendor:linux_x64 # Download libui.so for Linux to vendor directory
rake vendor:linux_x86 # Download libui.so for Linux to vendor directory
rake vendor:mac_x64 # Download libui.dylib for Mac to vendor directory
rake vendor:windows_x64 # Download libui.dll for Windows to vendor directory
rake vendor:windows_x86 # Download libui.dll for Windows to vendor directory
So, you can install it as follows
rake vendor:windows_x86
rake install
Oddly enough I re-installed the Win10 laptop and I ran into the exact same issue.
The strange thing is that prior to the re-installation, that issue did not happen.
Right now I am a bit confused how this error shows up. I don't recall what I did different prior to the reinstall; always installed via "gem install libui".
Note that require 'fiddle' and Fiddle::VERSION works. But require 'libui' fails with a "No such file or directory" Fiddle::DLError.
Is there some path issue perhaps? I can start "irb" from cmd.exe just fine and "ruby -v" shows the most recent ruby version (which is ruby 3.0.3).
@rubyFeedback Please tell us a little more about your environment. Did you use RubyInstaller to install Ruby, and is Ruby really a 64-bit version? Obviously using a 32bit version of Ruby will cause problems, but other causes are less clear and need to be investigated.
One way to tell 64bit Ruby from 32bit Ruby is to use
ruby -e "puts 1.size"
If it is 4, it is 32-bit, and if it is 8, it is 64-bit.
D:/Ruby25/lib/ruby/2.5.0/fiddle/import.rb:89:in'
from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui/ffi.rb:73:in
rescue in block in dlload': can't load D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/vendor/libui.dll (Fiddle::DLError) from D:/Ruby25/lib/ruby/2.5.0/fiddle/import.rb:86:in
block in dlload' from D:/Ruby25/lib/ruby/2.5.0/fiddle/import.rb:77:incollect' from D:/Ruby25/lib/ruby/2.5.0/fiddle/import.rb:77:in
dlload' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui/ffi.rb:78:in<module:FFI>' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui/ffi.rb:74:in
<top (required)>' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui.rb:28:in
require_relative' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui.rb:28:in<module:LibUI>' from D:/Ruby25/lib/ruby/gems/2.5.0/gems/libui-0.0.8/lib/libui.rb:6:in
<top (required)>' from D:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'