Forum: Ruby-Gnome 2 What's happening with Ruby-Gtk+?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
74f7b4679cfe88d76faedf5ee3aa7c6e?d=identicon&s=25 Torli Birnbauer (rubinx)
on 2008-12-27 18:31
In June I have started to play with {{ Ruby Gtk+ }} on Ubuntu Hardy. It
was not too hard to install required pieces of software and libraries.
After downloading the {{ ruby-gnome2-0.17.0-rc1 }} the README file
helped me enough, to get it done in less than a few hours. The first
order of business  was to figure out that you needed Ruby1.9 for
installation to work, otherwise the first installation command {{ ruby
extconf.rb }} would fail. But a more challenging task was to find out
why the {{ gtk2 }} library didn't get created. I discovered a rather
dubious program error in {{ gtk/src/rbgtkbuilder.c }}. I was almost
certain that by fixing the problem something else will be broken.
However, to my surprise my {{ helloworld.rb }} worked. Throughout my
first few Ruby Gtk+ lessons all was well. It was only when I started to
use the glade that things got a bit harry. However, a rather elaborate
example from the web tutorial worked flawlessly, and I believed the next
release will most likely fix most of the problems. Of course I was eager
to see the  {{ gtk/src/rbgtkbuilder.c }} bug do be squashed. But things
got worse half a year later, after for an unrelated problem elsewhere I
had to reinstall my OS. Of course I lost all my Ruby setups and
additional instalations in the process and by the time I got around to
reinstall it all again, a new release of ruby-gnome2 {{ 0.18.1 }} became
available. In the meantime, while investigating different options to
implement "Rapid Development Techniques", I have also learnt about some
disturbing facts in the areas related to Ruby GUI, in particular in the
area of "canvas" which happens to be of particular interest to my
projects. I often encountered statements like the following:

  +-------------- ( http://diacanvas.sourceforge.net/ )  ---------------
+
  | Time has passed by and DiaCanvas has had it's time in place. Current
|
  | development on GTK+ (mainly the integration of the Cairo library and
|
  | the deprecation of the GnomeCanvas library) has made this library
|
  | quite out-of-date. For most people this library has become an
|
  | installation nightmare.
|
  |
|
  | Gaphor, the foremost application that uses DiaCanvas, has abandoned
|
  | this library in favor of it's own, Python based,library. Libraries
|
  | like goocanvas and crcanvas have taken the place of DiaCanvas.
|
  +----------------------------------------------------------------------+

Indeed, I was eager to learn more from the GNOME and Gtk+ sources about
these issues, however, not very much or better, next to nothing, is
available for general public on the Internet. As I already mentioned, my
expectations that the new Ruby-GNOME2 release would be better were
dashed after I installed the last  {{ ruby-gnome2-all-0.18.1 }}. Not
only did the previous {{ gtk/src/rbgtkbuilder.c }} bug persist, new
unrecoverable problems with Pango and Cairo libraries cropped up. After
my latest experiences and indeed all the early warnings that something
in the areas of gdk, canvas and rendering is not quite right I was not
as much surprised as disappointed that my worst fears materialized and
left me dead on my tracks.

Does anybody know anything more about these issues, and perhaps a
solution to the problems they created ;(
C838db9af1d90a87a828ecad8556b804?d=identicon&s=25 Guillaume Cottenceau (Guest)
on 2008-12-27 23:28
(Received via mailing list)
> extconf.rb }} would fail. But a more challenging task was to find out
> why the {{ gtk2 }} library didn't get created. I discovered a rather
> dubious program error in {{ gtk/src/rbgtkbuilder.c }}. I was almost
> certain that by fixing the problem something else will be broken.
> However, to my surprise my {{ helloworld.rb }} worked. Throughout my

So you've fixed gtk/src/rbgtkbuilder.c? Can you show us the diff?

[...]

> available for general public on the Internet. As I already mentioned, my
> expectations that the new Ruby-GNOME2 release would be better were
> dashed after I installed the last  {{ ruby-gnome2-all-0.18.1 }}. Not
> only did the previous {{ gtk/src/rbgtkbuilder.c }} bug persist, new

It's bad to know some bug or even to fix them, and not talk with the
project people about it. Then no surprise the "bug" might persist in
subsequent releases.

> unrecoverable problems with Pango and Cairo libraries cropped up. After

Can you show us what are the problems? We cannot guess.

Cheers.

--
Guillaume Cottenceau - http://zarb.org/~gc/
74f7b4679cfe88d76faedf5ee3aa7c6e?d=identicon&s=25 Torli Birnbauer (rubinx)
on 2008-12-28 05:15
Guillaume Cottenceau wrote:
>> extconf.rb }} would fail. But a more challenging task was to find out
>> why the {{ gtk2 }} library didn't get created. I discovered a rather
>> dubious program error in {{ gtk/src/rbgtkbuilder.c }}. I was almost
>> certain that by fixing the problem something else will be broken.
>> However, to my surprise my {{ helloworld.rb }} worked. Throughout my
>
> So you've fixed gtk/src/rbgtkbuilder.c? Can you show us the diff?
>

If it is any good, there is a call to a function {{ rb_reg_new() }}
using one too many arguments. The function or the macro in question
which is invoked with three arguments is obviously defined only with
two parameters. I doubt very much that this is showing up only on
certain systems or platforms ;)

>
>> available for general public on the Internet. As I already mentioned, my
>> expectations that the new Ruby-GNOME2 release would be better were
>> dashed after I installed the last  {{ ruby-gnome2-all-0.18.1 }}. Not
>> only did the previous {{ gtk/src/rbgtkbuilder.c }} bug persist, new
>
> It's bad to know some bug or even to fix them, and not talk with the
> project people about it. Then no surprise the "bug" might persist in
> subsequent releases.

When the bug is so obvious as this one, it is hard to imagine the
project people didn't see it. I started to think there is a reason
the bug exists. Namely if you d not know how to figure that out you
perhaps shouldn't be messing around with the code on that level. But
even more precious reason for its existence may be the obfuscation
of a much larger problem, namely like the one got stuck in.

>> unrecoverable problems with Pango and Cairo libraries cropped up. After
>
> Can you show us what are the problems? We cannot guess.

Again if this can help you understand where {{ ruby-gnome2-all-0.18.1 }}
installation needs a fix, by all means have a look at the enigma.
Testing the outcome of Ruby-GNOME2 installation, I got the following:
  +-----------------------------------------------------+
  | $ ruby HelloWorld.rb                                |
  |  /usr/local/lib/site_ruby/ \                        |
  |    1.9.0/pango.rb:11:in `require': uninitialized \  |
  |      constant Cairo::Color (NameError)              |
  |  from /usr/local/lib/site_ruby/ \                   |
  |     1.9.0/pango.rb:11:in `<top (required)>'         |
  |     1.9.0/gtk2/base.rb:14:in `require'              |
  |     1.9.0/gtk2/base.rb:14:in `<top (required)>'     |
  |     1.9.0/gtk2.rb:11:in `require'                   |
  |     1.9.0/gtk2.rb:11:in `<top (required)>'          |
  |  from HelloWorld.rb:3:in `require'                  |
  |  from HelloWorld.rb:3:in `<main>'                   |
  | $                                                   |
  +-----------------------------------------------------+
When I tweaked the {{ /usr/local/lib/site_ruby/1.9.0/pango.rb:11: }}
by commenting out the "LoadError" in the following code on line 12
  +----------------------+
  |10 begin              |
  |11  require 'cairo'   |
  |12 rescue # LoadError |
  |13 end                |
  |14 require 'pango.so' |
  +----------------------+
line 14 produces segment fault!

The above doesn't make any sense to me. Namely, it first appears there
is an error in {{ cairo.rb }} when loading {{ require 'cairo/color' }},
indicative of a problem in the way Ruby1.9.0 handles {{ inquire }}.
Again, all this really is just a guess work on my part and I believe
things like that should not just happen to us regular users, who on
top of that are most likely new to either Ruby, Ruby-Gtk+ or both.

Thank you for your interest.
Cheers
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2008-12-28 06:15
(Received via mailing list)
Hi,

In <66a76f54b1ca7c7e2f14fea3d4544317@ruby-forum.com>
  "Re: [ruby-gnome2-devel-en] What's happening with Ruby-Gtk+?" on Sun,
28 Dec 2008 05:15:16 +0100,
  Torli Birnbauer <ruby-forum-incoming@andreas-s.net> wrote:

>   |     1.9.0/gtk2/base.rb:14:in `require'              |
>   |     1.9.0/gtk2/base.rb:14:in `<top (required)>'     |
>   |     1.9.0/gtk2.rb:11:in `require'                   |
>   |     1.9.0/gtk2.rb:11:in `<top (required)>'          |
>   |  from HelloWorld.rb:3:in `require'                  |
>   |  from HelloWorld.rb:3:in `<main>'                   |
>   | $                                                   |
>   +-----------------------------------------------------+

raciro can work with Ruby 1.9.x but Ruby-GNOME2 including
Ruby/Pango cannot.

>
> The above doesn't make any sense to me. Namely, it first appears there
> is an error in {{ cairo.rb }} when loading {{ require 'cairo/color' }},
> indicative of a problem in the way Ruby1.9.0 handles {{ inquire }}.
> Again, all this really is just a guess work on my part and I believe
> things like that should not just happen to us regular users, who on
> top of that are most likely new to either Ruby, Ruby-Gtk+ or both.

It seems that your rcairo installation was failed.
What about the result of the following code?

  % ruby 'require "cairo"'

If the result is none and ruby exits successfully, rcairo
installation was completed successfully.


Thanks,
--
kou
8616a8bf5c9ac0db67ac26f89d3b06b6?d=identicon&s=25 Mike Charlton (Guest)
on 2008-12-28 07:48
(Received via mailing list)
On Sun, Dec 28, 2008 at 2:14 PM, Kouhei Sutou <kou@cozmixng.org> wrote:
> raciro can work with Ruby 1.9.x but Ruby-GNOME2 including
> Ruby/Pango cannot.

OK... I'm confused, so please bear with me.  Does the current version
of Ruby-GNOME2 work with Ruby 1.9.x at all?  I was under the impression
that it doesn't (or if it does, it's just coincidence).  Is it possible
that all of Toril's problems are related to using Ruby 1.9.x when
only 1.8.7 is supported?

If 1.9.x is supported, then I'll be happy to hear it because I've been
waiting to port my code over.  But if not, I suggest that new users
trying to learn stick to 1.8.7.

Actually, looking at the README, I can't see any mention of what version
of ruby is supported.  As 1.9.x is the "official" (in a confusing way)
version
of Ruby, if it isn't supported the README should say so explicitly.

       MikeC
Ee6ffca720cc428d70247dcd7377dd48?d=identicon&s=25 Kouhei Sutou (Guest)
on 2008-12-28 09:16
(Received via mailing list)
Hi,

In <a500a83c0812272248h612b180dh72a7d8eae1a1fa13@mail.gmail.com>
  "Re: [ruby-gnome2-devel-en] What's happening with Ruby-Gtk+?" on Sun,
28 Dec 2008 15:48:22 +0900,
  "Mike Charlton" <mikekchar@gmail.com> wrote:

> On Sun, Dec 28, 2008 at 2:14 PM, Kouhei Sutou <kou@cozmixng.org> wrote:
> > raciro can work with Ruby 1.9.x but Ruby-GNOME2 including
> > Ruby/Pango cannot.
>
> OK... I'm confused, so please bear with me.  Does the current version
> of Ruby-GNOME2 work with Ruby 1.9.x at all?  I was under the impression
> that it doesn't (or if it does, it's just coincidence).  Is it possible
> that all of Toril's problems are related to using Ruby 1.9.x when
> only 1.8.7 is supported?

I think so. Ruby-GNOME2 doesn't work with Ruby 1.9.x (1.9.0
and 1.9.1 preview X) at all. You can see that all unit tests
aren't passed if Ruby-GNOME2 can be built.

> Actually, looking at the README, I can't see any mention of what version
> of ruby is supported.  As 1.9.x is the "official" (in a confusing way) version
> of Ruby, if it isn't supported the README should say so explicitly.

There isn't the "official stable" Ruby 1.9.x. It will be
released at 2009/01.

README will say supported Ruby version at the time.


Thanks,
--
kou
74f7b4679cfe88d76faedf5ee3aa7c6e?d=identicon&s=25 Torli Birnbauer (rubinx)
on 2008-12-28 19:01
Mike Charlton wrote:

> If 1.9.x is supported, then I'll be happy to hear it because I've been
> waiting to port my code over.  But if not, I suggest that new users
> trying to learn stick to 1.8.7.

Thank you Mike, Ruby1.8 actually works! It never crossed my mind to
test 1.8 out since before my system crash I only got gtk2 library to
work with Ruby1.9 and, one could never get to install Ruby-GNOME2 with
1.8. To my surprise there exists  {{ /usr/lib/ruby/1.8/gtk2.rb }}.
Running {{ ruby1.8 HelloWorld.rb }} and all other examples from
tutorials work fine with ruby1.8.



Kouhei Sutou wrote:

> It seems that your rcairo installation was failed.
> What about the result of the following code?

Kouhei, I believe you are wrong, at the end nothing failed when
I built Gtk, and other GNOME libraries. There is no {{ rcairo }}
either, only {{ cairo }}. The trouble really seems to be 1.9
Ruby related.

Anyway, guys thank you all again, I can live with this for a while
and hopefully the new Ruby 1.9.x stable will solve most of these
problems. But I also think, I will wait for a new "Linux distro"
to fix "Ruby - GNOME/Gtk" dependencies, which are another rather
disappointing and time consuming feature in Ruby-GNOME2 installation.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2009-01-02 23:13
> The trouble really seems to be 1.9 Ruby related.

I myself am having some trouble with ruby 1.9.1rc1

Most annoying is the US ASCII encoding problem. I do not
have a solution for that yet, but for the time being
I will stick to ruby 1.8.7x

One advantage is - ruby-gnome works nicely with it.

:-)
This topic is locked and can not be replied to.