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

Raspberry PI 4 support #23

Open
map7 opened this issue Mar 21, 2022 · 7 comments
Open

Raspberry PI 4 support #23

map7 opened this issue Mar 21, 2022 · 7 comments

Comments

@map7
Copy link

map7 commented Mar 21, 2022

Error when running on Raspberry PI 4 with debian buster and ruby 2.5.5 with the following example;

Code

#!/usr/bin/env ruby
require 'glimmer-dsl-libui'
include Glimmer
window('hello world').show

Error

/usr/lib/ruby/2.5.0/fiddle/import.rb:89:in `rescue in block in dlload': can't load /var/lib/gems/2.5.0/gems/libui-0.0.15/vendor/libui.so (Fiddle::DLError)
	from /usr/lib/ruby/2.5.0/fiddle/import.rb:86:in `block in dlload'
	from /usr/lib/ruby/2.5.0/fiddle/import.rb:77:in `collect'
	from /usr/lib/ruby/2.5.0/fiddle/import.rb:77:in `dlload'
	from /var/lib/gems/2.5.0/gems/libui-0.0.15/lib/libui/ffi.rb:10:in `<module:FFI>'
	from /var/lib/gems/2.5.0/gems/libui-0.0.15/lib/libui/ffi.rb:5:in `<module:LibUI>'
	from /var/lib/gems/2.5.0/gems/libui-0.0.15/lib/libui/ffi.rb:4:in `<top (required)>'
	from /var/lib/gems/2.5.0/gems/libui-0.0.15/lib/libui.rb:20:in `require_relative'
	from /var/lib/gems/2.5.0/gems/libui-0.0.15/lib/libui.rb:20:in `<module:LibUI>'
	from /var/lib/gems/2.5.0/gems/libui-0.0.15/lib/libui.rb:5:in `<top (required)>'
	from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	from /var/lib/gems/2.5.0/gems/glimmer-dsl-libui-0.5.5/lib/glimmer-dsl-libui.rb:36:in `<top (required)>'
	from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
	from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
	from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	from ./test_glimmer_hello.rb:7:in `<main>'
@kojix2
Copy link
Contributor

kojix2 commented Mar 21, 2022

Hello. @map7

I'm kojix2 and I'm working on LibUI backend for glimmer-dsl-libui.
Maybe you have to recompile C libui if you want to use Raspberry PI, because the shared libraries for ARM on Linux are not included in the LibUI gem.

So you need to get either andlabs/libui or libui-ng/libui-ng yourself.
I know C libui for Linux uses GTK internally, but I believe GTK worked on Raspbian.

kojix2/LibUI#46 (comment)

@AndyObtiva
Copy link
Owner

AndyObtiva commented Mar 21, 2022

@map7 Raspberry PI 4 uses an ARM processor on Linux. Currently, like @kojix2 mentioned, the LibUI backend only includes support for Mac ARM/x64 and Linux x86_64 out of the box (and Win x64 of course), but not Linux ARM (aka AARCH64). I linked this issue to a LibUI backend issue regarding AARCH64 support. Once it is addressed, you will be notified. In the meantime, you can use @kojix2 's workaround of compiling C libui for Linux ARM (AARCH64) manually if you don't want to wait.

@kojix2
Copy link
Contributor

kojix2 commented Mar 23, 2022

@map7
I have a Raspberry Pi 3. But I just bought it and haven't used it for a long time. This time I will compile libui-ng and make sure glimmer-dsl-libui works.

First I installed meson and libgtk-3-dev with the apt command. This time I also installed Ruby with apt, Ruby 2.5. It is a little bit old. I created a symbolic link libui.so to libui.so.0, set the environment variable LIBUIDIR, cloned the glimmer-dsl-libui repository and launched Meta-Example.

image

I launched many windows!
Hey, it's much more than I expected. Raspberry Pi is quite a powerful computer!

image

@AndyObtiva
Actually, I had no plans to add Linux ARM. So I was fine with this issue being closed. There are a lot of people using M1 Macs, and there will be more in the future. Ruby users tend to use Macs. So it's important to support M1 Macs. But I didn't think there were many people using Linux ARM. But yes, the Raspberry Pi is ARM. If we get enough requests, then, I will consider adding it.

@AndyObtiva
Copy link
Owner

@kojix2 I disagree with your statement about not many people using Linux ARM. It has become a standard offering in most Linux distributions and I know many libraries supporting Linux ARM (AARCH64) like SWT. Linux ARM is now a first-class citizen and must be supported out of the box in any library claiming to be cross-platform.

It is important to provide a good programming experience to Linux ARM (AARCH64) users just like any other platform users.

And, by the way, there are many users of Ruby who run on Linux in addition to Mac and Windows. I encounter such users regularly in my open-source project issues. Ruby in fact runs on Linux better than Windows, so it is very important to support completely in Ruby libraries.

@map7
Copy link
Author

map7 commented Mar 23, 2022

@kojix2 I think glimmer-dsl-libui is a great project and would love to see it work easily on the Raspberry PI 4. Thanks for the documentation I'll try and install it on my Raspberry PIs.

I have a few Raspberry PIs in which I use ruby on with GUIs, some where using the GTK old library and another uses Shoes, both of which are unmaintained or hard to use. I like using glimmer as it's much lighter and easier to use. I think it would benefit the project to be easily accessible on the PI.

@AndyObtiva
Copy link
Owner

AndyObtiva commented May 14, 2023

I know it's been a while, but better late than never! I forgot to mention that @kojix2 did eventually support the Raspberry PI several months ago.

I don't have a Raspberry PI, so I cannot test the support at the moment, but I will look into finding an environment where I could test it.

Still, I'd say try the latest glimmer-dsl-libui in case the newly included libui (0.1.2.pre , updated relatively recently) works with Raspeberry PI on Aarch64 on Linux out of the box (I am not sure if @kojix2 included that support in the latest libui gem by default).

If that doesn't work, then pull @kojix2 's project: https://github.com/kojix2/LibUI

Afterwards, enter the project and bundle

Finally, if you run rake -T, it will mention an option to download the binaries for Raspberry PI (rake vendor:kojix2:raspbian_64).

Run the Raspberry PI rake task and it should download the right binaries for it.

If you install glimmer-dsl-libui on top of there, it should use those binaries.

If this works for you, please let us know.

@kojix2
Copy link
Contributor

kojix2 commented May 15, 2023

Thanks for your comments.
I have not yet merged the PR to support Raspberry Pi.
So, as Andy said, we need to execute the following command.

rake vendor:kojix2:raspbian_64
rake install

It downloads binaries created with GitHub Actions using pguyot/arm-runner-action.

However, this is not something that has been tested on an actual device, so it may be better to build libuii-ng yourself, as shown below.

rake vendor:libui-ng:build
rake install

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

3 participants