Getting GUI for ruby for Linux running (QT or wxWidget)?

Hi,

I'm trying to evaluate GUI development with Ruby on Linux and Windows
and currently I decided to try QT and wxWdigets.

Seems it's not my weekend, I really tried for hours, various attempts
and I could get neither running. I started with Ubuntu 10.10 64bit off
first, not yet settled on the Windows side.

QT:
First struggled to realized there's not gem for it. Downloaded the
sources from
http://rubyforge.org/frs/download.php/71843/qt4-qtruby-2.1.0.tar.gz and
now I'm sitting there and I've no idea what to do. The included INSTALL
refers to http://techbase.kde.org/Getting_Started/Build/KDE4 which has
no mentions of ruby whatsoever. The README in contrast gave some
insights and "Install examples", ultimatively I figured I just need to
run "cmake .". However it quit with "Could not find Ruby" but ruby is
installed (1.9.1p378 via rvm). I gave up (no idea how to work this out
with cmake, never used it).

wxWidgets:
With joy I started because I saw wxruby gem, installation goes fine but
fails with

`require': libwx_gtk2u_media-2.8.so.0: cannot open shared object file:
No such file or directory

After some googling I came to the conclusion that I'm out of luck as the
wxwidgets provided by Ubuntu seem to miss this feature. No idea I
thought, I can role my own wxwidgets, no? So I downloaded latest source,
but couldn't compile it because it requires swig 1.3.38 but Ubuntu ships
with 1.3.40. Downloaded and tried to compile swig 1.3.38 but it failed with:

Modules/swigmod.h:20: error: redeclaration of C++ built-in type ‘bool’

No idea how something like this can happen, so I stopped here. I thought
maybe Ubuntu 10.10 is too new (it's still beta after all) so I installed
10.04 and I could compile swig 1.3.38 there but failed at compiling
wxwidgets right before the final linking stage (I was almost there!):

/usr/bin/ld: cannot find -lgtk-x11-2.0

No idea why it requires a file not being there or where this file could
be (no result from "apt-cache search" or packages.debian.org ) ->
another dead end.

So what I started out as "must be a piece of cake" turned out to be
hours of hours trying various things without outcome. What are you using
when you say you've QT or wxWidgets questions? Which distributions and
which Ruby versions are you running?

I'm thankful for any advice for the aforementioned problems.

thx,
- Markus

There's a slight but important to note error here: of course I didn't
try to compile wxwidgets (there's a ready package from Ubuntu there
already!) but wxruby which failed at the end.

- Markus

···

On 20.09.2010 01:14, Markus Fischer wrote:

10.04 and I could compile swig 1.3.38 there but failed at compiling
wxwidgets right before the final linking stage (I was almost there!):

/usr/bin/ld: cannot find -lgtk-x11-2.0

I finally was able to figure out that one too: I was missing the
libgtk2.0-dev package and dependencies. Now it's crystal clear I need
those -dev packages but what was puzzling is that it seemed the whole
compilation process worked but only during the final linking stage it
didn't. And since there was (!) a similar file named
/usr/lib/libgtk-x11-2.0.so.0.2000.1 .

It was necessary for me to compile my own wxruby because the one
installable from gem didn't include opengl for some reason. Maybe it's
the difference in version number, wxruby 2.0.0 vs. 2.0.1:

wxruby-ruby19 (2.0.1 x86-darwin-9 x86-linux x86-mingw32, 2.0.0 x86_64-linux)

- Markus

···

On 20.09.2010 01:14, Markus Fischer wrote:

No idea how something like this can happen, so I stopped here. I thought
maybe Ubuntu 10.10 is too new (it's still beta after all) so I installed
10.04 and I could compile swig 1.3.38 there but failed at compiling
wxwidgets right before the final linking stage (I was almost there!):

/usr/bin/ld: cannot find -lgtk-x11-2.0

try FXRuby

···

On Mon, Sep 20, 2010 at 4:48 AM, Markus Fischer <markus@fischer.name> wrote:

On 20.09.2010 01:14, Markus Fischer wrote:
> 10.04 and I could compile swig 1.3.38 there but failed at compiling
> wxwidgets right before the final linking stage (I was almost there!):
>
> /usr/bin/ld: cannot find -lgtk-x11-2.0

There's a slight but important to note error here: of course I didn't
try to compile wxwidgets (there's a ready package from Ubuntu there
already!) but wxruby which failed at the end.

- Markus

--
Rashad

Hi,

The following link may help you :
http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages

Markus Fischer wrote:

···

On 20.09.2010 01:14, Markus Fischer wrote:

10.04 and I could compile swig 1.3.38 there but failed at compiling
wxwidgets right before the final linking stage (I was almost there!):

/usr/bin/ld: cannot find -lgtk-x11-2.0

There's a slight but important to note error here: of course I didn't
try to compile wxwidgets (there's a ready package from Ubuntu there
already!) but wxruby which failed at the end.

Chauk-Mean.
--
Posted via http://www.ruby-forum.com/\.

wxRuby doesn't work out of the box with Ubuntu 9.10 and newer, because
Ubuntu switched to GCC 4 I think. There are build instruction available
at
http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages
which work quite well for me, because I already compile all my Ruby
installations myself. Adding an extra switch to Ruby's ./configure was
not _that_ hard therefore, but I'm not sure if the Ruby provided in the
Ubuntu repositories was compiled with --enable-shared.
  However, I'm working on another GUI project that uses wxRuby, and
published compiled wxRubies for 32 and 64 bit for use with Ruby
1.9.2-p0. They're available from
http://github.com/Quintus/OpenRubyRMK/downloads . However, they're
untested, so I'd be glad if you could report wheather they work or don't.

Vale,
Marvin

···

Am 20.09.2010 01:18, schrieb Markus Fischer:

On 20.09.2010 01:14, Markus Fischer wrote:

10.04 and I could compile swig 1.3.38 there but failed at compiling
wxwidgets right before the final linking stage (I was almost there!):

/usr/bin/ld: cannot find -lgtk-x11-2.0

There's a slight but important to note error here: of course I didn't
try to compile wxwidgets (there's a ready package from Ubuntu there
already!) but wxruby which failed at the end.

- Markus

qt does have a new gem I put together:
gem install qtbindings

See the github page and make sure you have all the dependencies before
installing:

···

On Mon, Sep 20, 2010 at 8:47 AM, Quintus <sutniuq@gmx.net> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 20.09.2010 01:18, schrieb Markus Fischer:
> On 20.09.2010 01:14, Markus Fischer wrote:
>> 10.04 and I could compile swig 1.3.38 there but failed at compiling
>> wxwidgets right before the final linking stage (I was almost there!):
>>
>> /usr/bin/ld: cannot find -lgtk-x11-2.0
>
> There's a slight but important to note error here: of course I didn't
> try to compile wxwidgets (there's a ready package from Ubuntu there
> already!) but wxruby which failed at the end.
>
> - Markus
>
>
wxRuby doesn't work out of the box with Ubuntu 9.10 and newer, because
Ubuntu switched to GCC 4 I think. There are build instruction available
at
http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages
which work quite well for me, because I already compile all my Ruby
installations myself. Adding an extra switch to Ruby's ./configure was
not _that_ hard therefore, but I'm not sure if the Ruby provided in the
Ubuntu repositories was compiled with --enable-shared.
However, I'm working on another GUI project that uses wxRuby, and
published compiled wxRubies for 32 and 64 bit for use with Ruby
1.9.2-p0. They're available from
http://github.com/Quintus/OpenRubyRMK/downloads . However, they're
untested, so I'd be glad if you could report wheather they work or don't.

Vale,
Marvin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyXdAoACgkQDYShvwAbcNkprACfS3yD2J1d5HIMSewb8JI8Ly8W
EUwAnAlSsJxRwwtTmny4UnG7LQ0HPGma
=/M54
-----END PGP SIGNATURE-----

Hi,

wxRuby doesn't work out of the box with Ubuntu 9.10 and newer, because
Ubuntu switched to GCC 4 I think.

Finally I got it working on Ubuntu 10.04 64bit!

Your post indirectly helped me, because I simply didn't realized there
was an wxruby-ruby19 package and I *am* using ruby 1.9.something.

I tried one of the examples and it instantly worked.

wxruby requires "libwx_gtk2u_media-2.8.so.0" which is available on 10.04
but *not* on 10.10 (which I initially tried, leave alone I tried the
wrong version).

I'm wondering why the gem did let me install a version it doesn't work
it, i.e. some kind of ruby version dependency.

thanks for the help!
- Markus

···

On 20.09.2010 16:47, Quintus wrote:

That sounds great, I'll test that for sure when I'm home later. Thanks in advance!

- Markus

···

On 21.09.2010 05:41, Ryan Melton wrote:

qt does have a new gem I put together:
gem install qtbindings

See the github page and make sure you have all the dependencies before
installing:
GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt

qt does have a new gem I put together:
gem install qtbindings

See the github page and make sure you have all the dependencies before
installing:
GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt

Yeah, that's quite cool.
But you absolutely need the MacPorts Qt (as recommended) (Homebrew or
binary did not work for me).

I'm trying to evaluate GUI development with Ruby on Linux and Windows
and currently I decided to try QT and wxWdigets.

The QtRuby API is really nice, so I would recommend you Qt.

I finally was able to install QtRuby a few days ago, and I'm really enjoying it.
I installed on OSX, so I do not know about other platforms, but I
believe the instructions from the qtbindings gem, so it should be
relatively easy.

Regards,
B.D.

···

On 21 September 2010 05:41, Ryan Melton <ryanmelt@gmail.com> wrote:

Hi,

qt does have a new gem I put together:
gem install qtbindings

See the github page and make sure you have all the dependencies before
installing:
GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt

Works great! Once I figured all packages I needed it worked out of the
bugs in Ubuntu 10.04 64bit, minus the KNOWN_ISSUES.txt things.

On Ubuntu 10.10 64b it stops with this error:

cp: cannot stat `ext/build/smoke/qtmultimedia/libsmokeqtmultimedia.*':
No such file or directory
make: *** [install] Error 1

thanks,
- Markus

···

On 21.09.2010 05:41, Ryan Melton wrote:

Same on Windows 7 Pro 64bit, worked out of the box with Ruby191 .

I must say I'm really impressed how flawless this worked, compared to
anything I tried during the weekend. It's exactly what I hoped for,
because e.g. I was looking at python qt bindings before last weekend and
it was also like a breeze to install and I just wished this would be
available for ruby too ... now it is.

thanks again,
- Markus

···

On 21.09.2010 18:48, Markus Fischer wrote:

On 21.09.2010 05:41, Ryan Melton wrote:

qt does have a new gem I put together:
gem install qtbindings

See the github page and make sure you have all the dependencies before
installing:
GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt

Works great! Once I figured all packages I needed it worked out of the
bugs in Ubuntu 10.04 64bit, minus the KNOWN_ISSUES.txt things.

Thanks for the feedback. I'll work on the issues with Ubuntu 10.10 once it
gets out of beta. For now I'm working on killing all the bugs in
KNOWN_ISSUES.txt.
Ryan

···

On Tue, Sep 21, 2010 at 10:48 AM, Markus Fischer <markus@fischer.name>wrote:

Hi,

On 21.09.2010 05:41, Ryan Melton wrote:
> qt does have a new gem I put together:
> gem install qtbindings
>
> See the github page and make sure you have all the dependencies before
> installing:
> GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt

Works great! Once I figured all packages I needed it worked out of the
bugs in Ubuntu 10.04 64bit, minus the KNOWN_ISSUES.txt things.

On Ubuntu 10.10 64b it stops with this error:

cp: cannot stat `ext/build/smoke/qtmultimedia/libsmokeqtmultimedia.*':
No such file or directory
make: *** [install] Error 1

thanks,
- Markus

Same on Windows 7 Pro 64bit, worked out of the box with Ruby191 .

Beautiful! I've missed the Qt bindings ever since I made the shift to 1.9

I must say I'm really impressed how flawless this worked, compared to
anything I tried during the weekend. It's exactly what I hoped for,
because e.g. I was looking at python qt bindings before last weekend and
it was also like a breeze to install and I just wished this would be
available for ruby too ... now it is.

Seconded. Excellent work, Ryan. Will see if I can get it running on
the N900 too.

martin

···

On Tue, Sep 21, 2010 at 11:11 PM, Markus Fischer <markus@fischer.name> wrote:

Thanks for the feedback guys. I'll update the examples tonight to handle
the current directory not being in the path on 1.9.2.
Ryan

···

On Tue, Sep 21, 2010 at 11:41 AM, Markus Fischer <markus@fischer.name>wrote:

On 21.09.2010 18:48, Markus Fischer wrote:
> On 21.09.2010 05:41, Ryan Melton wrote:
>> qt does have a new gem I put together:
>> gem install qtbindings
>>
>> See the github page and make sure you have all the dependencies before
>> installing:
>> GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt
>
> Works great! Once I figured all packages I needed it worked out of the
> bugs in Ubuntu 10.04 64bit, minus the KNOWN_ISSUES.txt things.

Same on Windows 7 Pro 64bit, worked out of the box with Ruby191 .

I must say I'm really impressed how flawless this worked, compared to
anything I tried during the weekend. It's exactly what I hoped for,
because e.g. I was looking at python qt bindings before last weekend and
it was also like a breeze to install and I just wished this would be
available for ruby too ... now it is.

thanks again,
- Markus

Hi Ryan,

Some examples failed to run due to a few syntax errors so I fixed some of
them. I send you a pull request.

Best Regards,

Diego

···

On Tue, Sep 21, 2010 at 10:32 PM, Ryan Melton <ryanmelt@gmail.com> wrote:

Thanks for the feedback. I'll work on the issues with Ubuntu 10.10 once it
gets out of beta. For now I'm working on killing all the bugs in
KNOWN_ISSUES.txt.
Ryan

On Tue, Sep 21, 2010 at 10:48 AM, Markus Fischer <markus@fischer.name > >wrote:

> Hi,
>
> On 21.09.2010 05:41, Ryan Melton wrote:
> > qt does have a new gem I put together:
> > gem install qtbindings
> >
> > See the github page and make sure you have all the dependencies before
> > installing:
> > GitHub - ryanmelt/qtbindings: An easy to install gem version of the Ruby bindings to Qt
>
> Works great! Once I figured all packages I needed it worked out of the
> bugs in Ubuntu 10.04 64bit, minus the KNOWN_ISSUES.txt things.
>
> On Ubuntu 10.10 64b it stops with this error:
>
> cp: cannot stat `ext/build/smoke/qtmultimedia/libsmokeqtmultimedia.*':
> No such file or directory
> make: *** [install] Error 1
>
> thanks,
> - Markus
>
>

Hi,

···

On 22.09.2010 04:32, Ryan Melton wrote:

Thanks for the feedback. I'll work on the issues with Ubuntu 10.10 once it
gets out of beta.

Yeah, I figured that too. No idea why I reasoned to use 10.10 in the
first place, that was a lesson. I actually don't care about 10.04 or
10.10, things simply have to work. Thanks :slight_smile:

- Markus

Me too!

···

On 21 September 2010 21:52, Martin DeMello <martindemello@gmail.com> wrote:

On Tue, Sep 21, 2010 at 11:11 PM, Markus Fischer <markus@fischer.name> wrote:

Same on Windows 7 Pro 64bit, worked out of the box with Ruby191 .

Beautiful! I've missed the Qt bindings ever since I made the shift to 1.9

I got this working on the N900 as follows:

1. Install kaspernj's optified ruby packages from here:

2. Compile the qtbindings gem on the scratchbox

apt-get install cmake
apt-get install libqt4-dev
gem install rake
gem install qtbindings
cd /opt/ruby/lib/ruby/gems/1.8/gems/qtbindings-4.6.3.0/
rake gemnative

3. Copy the generated qtbindings-4.6.3.0-arm-linux.gem to the N900 and install

4. Add /opt/ruby/lib/ruby/gems/1.8/gems/qtbindings-4.6.3.0-arm-linux/lib/1.8
to /etc/ld.so.conf and run ldconfig

Most of the examples work, though the desktop qt widgets aren't too
usable (does smoke generate qtmobility bindings too?). One oddity I
noted was that the gem copies rather than symlinking libraries, e.g.

$ ls -al .rvm/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9/gems/qtbindings-4.6.3.0/lib/1.9/
...
-rwxr-xr-x 1 martin martin 958109 2010-09-23 14:16 libsmokeqtuitools.so
-rwxr-xr-x 1 martin martin 958109 2010-09-23 14:16 libsmokeqtuitools.so.3
-rwxr-xr-x 1 martin martin 958109 2010-09-23 14:16 libsmokeqtuitools.so.3.0.0

martin

···

On Wed, Sep 22, 2010 at 1:19 AM, Martin DeMello <martindemello@gmail.com> wrote:

Seconded. Excellent work, Ryan. Will see if I can get it running on
the N900 too.

I tried this but I get some require errors with Ruby 1.9.2. It works if I
modify the requires with a ./ at the front.

···

On Tue, Sep 21, 2010 at 4:03 PM, Benoit Daloze <eregontp@gmail.com> wrote:

On 21 September 2010 21:52, Martin DeMello <martindemello@gmail.com> > wrote:
> On Tue, Sep 21, 2010 at 11:11 PM, Markus Fischer <markus@fischer.name> > wrote:
>>
>> Same on Windows 7 Pro 64bit, worked out of the box with Ruby191 .
>
> Beautiful! I've missed the Qt bindings ever since I made the shift to 1.9

Me too!