swt icon indicating copy to clipboard operation
swt copied to clipboard

Gem doesn't seem to install properly on Linux/ARM (Debian ARM HF based distro)

Open PeterWAWood opened this issue 11 years ago • 2 comments

I am trying to install Ruby/Shoes4 on Raspberry Pi. ( I believe that Ruby/Shoes is a great medium for children to learn programming). Shoes4 does not run because of what seems to be an issue with the SWT gem.

I have de-installed the Shoes 4 gem from my Jruby installation on the machine (which runs Raspbian - a Debian based distro - and has an ARM Hard Float processor) to try an isolate the issue. I am fairly certain that SWT runs on Raspberry Pi as people use Eclipse on the machine.

The message I'm getting seems to indicate an issue with libswt-gtk-4427.so.

Please let me know if I have made an error or what I can do to better identify the problem beyond the following console output:

pi@raspberrypi:~/raspberryruby/shoes$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)
pi@raspberrypi:~/raspberryruby/shoes$ ruby -v
jruby 1.7.13 (1.9.3p392) 2014-06-24 43f133c on Java HotSpot(TM) Client VM 1.7.0_40-b43 [linux-arm]
pi@raspberrypi:~/raspberryruby/shoes$ jruby -S gem install swt
Java HotSpot(TM) Client VM warning: You have loaded library /home/pi/.rbenv/versions/jruby-1.7.13/lib/jni/x86_64-Linux/libjffi-1.2.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Fetching: swt-4.4.gem (100%)
Successfully installed swt-4.4
1 gem installed
pi@raspberrypi:~/raspberryruby/shoes$ jirb
Java HotSpot(TM) Client VM warning: You have loaded library /home/pi/.rbenv/versions/jruby-1.7.13/lib/jni/x86_64-Linux/libjffi-1.2.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
irb(main):001:0> require 'java'
=> false
irb(main):002:0> require 'swt'
NameError: missing class or uppercase package name (`org.eclipse.swt.widgets.Display'), caused by (NameError) cannot link Java class org.eclipse.swt.widgets.Display, probable missing dependency: Could not load SWT library. Reasons: 
    no swt-gtk-4427 in java.library.path
    no swt-gtk in java.library.path
    Can't load library: /home/pi/.swt/lib/linux/arm/libswt-gtk-4427.so
    Can't load library: /home/pi/.swt/lib/linux/arm/libswt-gtk.so
    /home/pi/.swt/lib/linux/arm/libswt-gtk-4427.so: /home/pi/.swt/lib/linux/arm/libswt-gtk-4427.so: cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)

    from org/jruby/javasupport/JavaUtilities.java:54:in `get_proxy_or_package_under_package'
    from file:/home/pi/.rbenv/versions/jruby-1.7.13/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14:in `method_missing'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/gems/shared/gems/swt-4.4/lib/swt/minimal.rb:12:in `Widgets'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/gems/shared/gems/swt-4.4/lib/swt/minimal.rb:11:in `Swt'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/gems/shared/gems/swt-4.4/lib/swt/minimal.rb:6:in `(root)'
    from org/jruby/RubyKernel.java:1065:in `require'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1:in `(root)'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    from org/jruby/RubyKernel.java:1065:in `require'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/gems/shared/gems/swt-4.4/lib/swt.rb:2:in `(root)'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1:in `(root)'
    from org/jruby/RubyKernel.java:1101:in `eval'
    from /home/pi/.rbenv/versions/jruby-1.7.13/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:135:in `require'
    from (irb):2:in `evaluate'
    from org/jruby/RubyKernel.java:1501:in `loop'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from /home/pi/.rbenv/versions/jruby-1.7.13/bin/jirb:13:in `(root)'irb(main):003:0> 

PeterWAWood avatar Sep 17 '14 09:09 PeterWAWood

There at least is no arm version on the downloads page.

There are only x86/x86_64 versions. We'd need an ARM version of SWT and add it to the gem. I can't seem to find one or a guide sadly. This is what we'd need but it is not officially supported.

What people seem to do to run SWT applications on the Pi is install a special debian SWT package that is compiled for ARM and point their applications to use that. I don't think we could do that... or well we could build a "local SWT detection" if no supplied version matches. That would be a major amount of work and I'm actually unsure if it'd work. Thoughts @danlucraft @wasnotrice @jasonrclark ?

PragTob avatar Sep 17 '14 10:09 PragTob

I think a reasonable workaround for this would be to be able to specify a path for the swt.jar necessary for a given platform.

This is causing me woes on FreeBSD, where SWT is packaged very differently.

rtyler avatar Nov 10 '14 04:11 rtyler