FXRuby 1.2.6 using rubygems

I have some problems using FXRuby on my Computer (using Ubuntu Linux, with Ruby v1.8.2 and RubyGems v0.8.10).

I installed the Fox Toolkit (v1.2.16) and the latest FXRuby-gem (v1.2.6). The installation worked withouth any errors (*), but I cannot use FXRuby in my scripts.

Here's what happens when I start irb:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'fxruby'
=> true
irb(main):003:0> include Fox
NameError: uninitialized constant Fox
         from (irb):3

As you can see, the include (and therefore everything else using FXRuby) does not work. Does anybody have a suggestion on which error I am making?

Unfortunately, I did not find any information about this problem in the newsgroup or the net. I only found one thread which said that FXRuby version 1.2 was not stable enough for being used, yet -- but I suppose it is by now? (Since I did not find any information on the homepage that the users should stick to version 1.0.)

Thanks a lot in advance!
I would be grateful for any help I can get :slight_smile:

Redge

···

---------
(*) Although during the installation of the gem, I got hundreds of warnings of the kind

warning: `void free_FXTreeListBox(FX::FXTreeListBox*)'
    defined but not used

and so on - but nothing critical, as far as I could see.

Daniel Sperl wrote:

I have some problems using FXRuby on my Computer (using Ubuntu Linux, with Ruby v1.8.2 and RubyGems v0.8.10).

I installed the Fox Toolkit (v1.2.16) and the latest FXRuby-gem (v1.2.6). The installation worked withouth any errors (*), but I cannot use FXRuby in my scripts.

Here's what happens when I start irb:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'fxruby'
=> true
irb(main):003:0> include Fox
NameError: uninitialized constant Fox
        from (irb):3

As you can see, the include (and therefore everything else using FXRuby) does not work. Does anybody have a suggestion on which error I am making?

You probably want

require_gem 'fox12'

or something similar. I don't usually use the gem version of FXRuby, so normally it is just

IMHO, Fox 1.2 is probably a better choice than Fox 1.0 at this point. It seems quite stable and has some nice new features.

I have some problems using FXRuby on my Computer (using Ubuntu Linux,
with Ruby v1.8.2 and RubyGems v0.8.10).

I installed the Fox Toolkit (v1.2.16) and the latest FXRuby-gem
(v1.2.6). The installation worked withouth any errors (*), but I cannot
use FXRuby in my scripts.

Here's what happens when I start irb:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'fxruby'
=> true
irb(main):003:0> include Fox
NameError: uninitialized constant Fox
         from (irb):3

As you can see, the include (and therefore everything else using FXRuby)
does not work. Does anybody have a suggestion on which error I am making?

I would expect that to work, but what happens if you instead do this
(as shown in the FXRuby User's Guide):

    require 'rubygems'
    require 'fox12'

That is, replace the require_gem line with this require.

Unfortunately, I did not find any information about this problem in the
newsgroup or the net. I only found one thread which said that FXRuby
version 1.2 was not stable enough for being used, yet -- but I suppose
it is by now?

Yes, FXRuby 1.2 is considered the stable version these days.

···

On 5/2/05, Daniel Sperl <redgeREM0VETHIS@incognitek.com> wrote:

I don't think that's going to work. The name of the gem is "fxruby",
and that's what you'd need to pass to require_gem(). In contrast, the
library name is "fox12", and that's what you'd pass to require().

···

On 5/2/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

You probably want

require_gem 'fox12'

or something similar.

Lyle Johnson wrote:

···

On 5/2/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

You probably want

require_gem 'fox12'

or something similar.

I don't think that's going to work. The name of the gem is "fxruby",
and that's what you'd need to pass to require_gem(). In contrast, the
library name is "fox12", and that's what you'd pass to require().

Oh, ok. Does that mean (asking just out of idle curiosity) that you cannot have gems of 1.0 and 1.2 side by side?

Thanks for your quick supply!!!

Unfortunately, the "require 'fox12'"-call does not work either.

Here is the output of irb:
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'fox12'
=> false
irb(main):003:0> include Fox
NameError: uninitialized constant Fox
         from (irb):3

As you can see, 'require' now returns false! Which, unfortunately, does not tell me anything about *which* error was encountered.

The structure of my 'gems'-directory is the following (if that helps):

/usr/lib/ruby/gems/1.8/gems/fxruby-1.2.5/
   doc
   examples
   ext
   lib
     fox12
   rdoc-sources
   tests
   web

I have installed other gems which seem to be installed in a similar directory-structure, so I suppose that's correct (although the other plugins are simpler, meaning they contain only native Ruby code).

Is it possible that it has something to do with the huge amount of "declared but not used"-warnings I got during installation/compilation?
(I can send you the logfile of the installation, if that would be helpful.)

Oh, and I just spottet the following lines at the end of the installation output:

···

--------------------------------
[... compilation ...]
creating Makefile

make
gcc -fPIC -Wall -g -O2 -fPIC -O0 [...]
[...]

make install
make: Nothing to be done for `install'.
Successfully installed fxruby-1.2.6
--------------------------------

"Nothing to be done for `install'."?? Can that be?

If there's any other hint you can give me, it would be great!

Anyway: thanks a lot for your help so far!
Greetings,
Redge

Lyle Johnson wrote:

On 5/2/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

You probably want

require_gem 'fox12'

or something similar.

I don't think that's going to work. The name of the gem is "fxruby",
and that's what you'd need to pass to require_gem(). In contrast, the
library name is "fox12", and that's what you'd pass to require().

That should be OK. If you wanted to load, say, FXRuby 1.0, you'd do
something like this:

    require 'rubygems'
    require 'fox'

or:

    require 'rubygems'
    require_gem 'fxruby', '1.0.26'

... or at least, I think that's the right syntax for the two-argument
version of require_gem(). Similarly, to load FXRuby 1.2, you'd do
something like this:

    require 'rubygems'
    require 'fox12'

or:

    require 'rubygems'
    require_gem 'fxruby', '1.2.6'

Hope this helps,

Lyle

···

On 5/2/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

Oh, ok. Does that mean (asking just out of idle curiosity) that you
cannot have gems of 1.0 and 1.2 side by side?

Unfortunately, the "require 'fox12'"-call does not work either.

OK.

Here is the output of irb:
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'fox12'
=> false
irb(main):003:0> include Fox
NameError: uninitialized constant Fox
         from (irb):3

As you can see, 'require' now returns false! Which, unfortunately, does
not tell me anything about *which* error was encountered.

Right. For that matter, I just did a clean install of FXRuby 1.2.6
from the gem, and I get a "false" response after I require 'fox12',
even though it *successfully* loaded the library! (Which seems to
indicate a RubyGems bug, but I digress).

The structure of my 'gems'-directory is the following (if that helps):

/usr/lib/ruby/gems/1.8/gems/fxruby-1.2.5/
   doc
   examples
   ext
   lib
     fox12
   rdoc-sources
   tests
   web

This may just have been an oversight on your part, but do you not also
have this directory:

    /usr/lib/ruby/gems/1.8/gems/fxruby-1.2.5/ext/fox12

?

You should have that one, and (more importantly) it should contain a
file named "fox12.so"; that's what Ruby should be trying to load when
you do the require "fox12".

If that file is there -- and I'm guessing that it is -- it's possible
that Ruby can't load "fox12" because it depends on the FOX library
(libFOX-1.2.so) and the FOX library is in some directory that's not in
your path for dynamically-loadable libraries. For some information on
how to fix that, please see the section titled "Things That Can Go
Wrong", near the bottom of this page from the FXRuby User's Guide:

    http://www.fxruby.org/doc/gems.html

I have a strong hunch that this is the source of the problem.

Is it possible that it has something to do with the huge amount of
"declared but not used"-warnings I got during installation/compilation?
(I can send you the logfile of the installation, if that would be helpful.)

It's possible, but that's not my first suspicion. Let's hold off on
your sending me the build log until we eliminate the previously
mentioned possibility...

···

On 5/3/05, Daniel Sperl <redgeREM0VETHIS@incognitek.com> wrote:

Lyle Johnson wrote:

···

On 5/2/05, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

Oh, ok. Does that mean (asking just out of idle curiosity) that you
cannot have gems of 1.0 and 1.2 side by side?

That should be OK. If you wanted to load, say, FXRuby 1.0, you'd do
something like this:

    require 'rubygems'
    require 'fox'

or:

    require 'rubygems'
    require_gem 'fxruby', '1.0.26'

... or at least, I think that's the right syntax for the two-argument
version of require_gem(). Similarly, to load FXRuby 1.2, you'd do
something like this:

    require 'rubygems'
    require 'fox12'

or:

    require 'rubygems'
    require_gem 'fxruby', '1.2.6'

Hope this helps,

Lyle

Oh, yeah, I forgot one of the main reasons why rubygems is so cool!

Shame on me ...

You were absolute right!
Naturally, I did read the 'things that can go wrong'-section, but since the error looked completely different than what happened on my system, I did not try that out. I should have, of course. There is the solution, right in front of my nose, and I'm ignoring it ...

I'm really sorry to have bothered you with that!
Anyway, thanks a lot for your help! I wished that some commercial libraries would provide such a quick and patient support ...!

Greetings,
Redge

Naturally, I did read the 'things that can go wrong'-section, but since
the error looked completely different than what happened on my system, I
did not try that out. I should have, of course. There is the solution,
right in front of my nose, and I'm ignoring it ...

Well, no, as you said, the RubyGems implementation of require() was
suppressing that error message and so I can understand why you
wouldn't have recognized what was going on. I'm just glad we were able
to track it down.

I'm really sorry to have bothered you with that!
Anyway, thanks a lot for your help! I wished that some commercial
libraries would provide such a quick and patient support ...!

No need to apologize!

Good luck with the rest of your work,

Lyle

···

On 5/3/05, Daniel Sperl <redgeREM0VETHIS@incognitek.com> wrote: