kojix2 / LibUI

A portable GUI library for Ruby
MIT License
207 stars 10 forks source link

Ruby 3.3 fiddle issue #85

Closed AndyObtiva closed 7 months ago

AndyObtiva commented 7 months ago

I received this issue about running libui in Ruby 3.3 in the Glimmer Gitter chat. I suggested to the software engineer to downgrade their Ruby to 3.2 and that worked in resolving the issue.

Still, I am sharing the issue here because we need to ensure libui works in the newest Ruby 3.3 too (which was released last christmas of 2023). The issue was encountered on Linux, but it might be an issue on Mac and Windows too.

Hello, I've done installing the gem using this command gem install glimmer-dsl-libui and after running glimmer, i see this errors in my terminal

internal:/home/philip/.rbenv/versions/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:127:in require': cannot load such file -- fiddle/import (LoadError) from <internal:/home/philip/.rbenv/versions/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in require' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/libui-0.1.2.pre/lib/libui/ffi.rb:1:in <top (required)>' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/libui-0.1.2.pre/lib/libui.rb:20:in require_relative' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/libui-0.1.2.pre/lib/libui.rb:20:in ' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/libui-0.1.2.pre/lib/libui.rb:5:in <top (required)>' from internal:/home/philip/.rbenv/versions/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:127:in require' from <internal:/home/philip/.rbenv/versions/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in require' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/glimmer-dsl-libui-0.11.8/lib/glimmer-dsl-libui.rb:34:in <top (required)>' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/glimmer-dsl-libui-0.11.8/bin/glimmer:24:in require_relative' from /home/philip/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/glimmer-dsl-libui-0.11.8/bin/glimmer:24:in <top (required)>' from /home/philip/.rbenv/versions/3.3.0/bin/glimmer:25:in load' from /home/philip/.rbenv/versions/3.3.0/bin/glimmer:25:in `

' I'm using linux mint

System: Kernel: 5.15.0-101-generic x86_64 bits: 64 compiler: gcc v: 11.4.0 Desktop: Cinnamon 6.0.4 tk: GTK 3.24.33 wm: muffin vt: 7 dm: LightDM 1.30.0 Distro: Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy

I don't know much about these as I've only used linux for a week I also have this processor Intel© Core™ i5-7200U CPU @ 2.50GHz × 2

kojix2 commented 7 months ago

I could not reproduce this issue. This is a general problem with Fiddle and Ruby-FFI installations and can probably be resolved by properly installing libffi and rebuilding ruby or reinstalling fiddle. Thank you for your report.

rubyFeedback commented 7 months ago

I also did not run into the above issue. I compile everything from source (libffi, ruby too etc...).

My gtk+ version is 3.24.41 - not sure if 3.24.33 may be too old.

From the error message, e. g.

cannot load such file -- fiddle/import

perhaps the fiddle he is using is incomplete? Not sure if that is an issue, but debian-based systems tend to split things up a lot. It's a bit strange setup he uses since he also uses rbenv, so it is not a pure linuxmint system anymore, so I think we can not even assume that it may not NOT work on linuxmint by default, but perhaps his fiddle was incomplete, so the rbenv variant he uses may also not work because of that, in regards to add-on code.

libffi is usually easy to compile from source too by the way:

https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz

So he could give it a try to compile it into /usr/ or /usr/local/ (and moving /usr/local/lib as first entry in /etc/ld.so.conf) and then re-install rbenv. (I don't know how rbenv is installed though, whether this compiles from source or installs a binary.)