wxRuby problem on Ubuntu

R

RaW

Hello,

I've just wanted to test wxRuby and have a problem.

I use UbuntuLinux Hoary 5.04 and following
http://wxruby.rubyforge.org/wiki/wiki.pl?Installation
I have installed packages for Debian:

ruby1.8-dev
libwxbase2.4-dev
libwxbase2.4
libwxgtk2.4-contrib-dev

Everything seems to go right but the sample code from
http://wxruby.rubyforge.org/wiki/wiki.pl?Getting_Started
generates an error:

$ ruby1.8 wxruby.rb
../wxruby.rb:2: uninitialized constant Wx (NameError)
from wxruby.rb:1:in `require'
from wxruby.rb:1

This is the code:
<code>
require "wxruby"
include Wx

class MinimalApp < App
def on_init
Frame.new(nil, -1, "The Bare Minimum").show()
end
end


MinimalApp.new.main_loop
</code>

I am new in ruby so anyone can help me solve this problem ?
Thanks in advance.
 
D

Daniel Lewis

I have Ubuntu-hoary and have Ruby 1.8 installed (with WxRuby), I have
managed to get it all up and running,

I am not 100% sure what the problem is. So:

Can you run a program that looks a little bit like this:
<code>
require 'wxruby'
include Wx

puts "hello world"
</code>

and do your $PATH settings point to WxRuby?

It took me a while to find what was going wrong with my Wx
installations on Ubuntu... i had lots of problems and errors. My
WxRuby programs now work completely fine on both Windows (XP) and
Ubuntu. I am yet to test it on my iBook.

Hope to help further,

Daniel.
 
R

RaW

Daniel Lewis napisa³(a):
I have Ubuntu-hoary and have Ruby 1.8 installed (with WxRuby), I have
managed to get it all up and running,

I am not 100% sure what the problem is. So:

Can you run a program that looks a little bit like this:
<code>
require 'wxruby'
include Wx

puts "hello world"
</code>

and do your $PATH settings point to WxRuby?
Shame on me but I don't know what is the right path to WxRuby :(

I was trying with many solutions but... no efect :(
 
R

RaW

Daniel Lewis napisa³(a):
Oh yes, I just remembered. Do you have WxWidgets installed as well as
WxRuby? - You need WxWidgets 2.4 (It will not work with 2.5). You can
get it from the apt-get / Synaptic Package Manager.
It's not so easy as it seems.

$ apt-cache search wx
libwxbase2.4 - wxBase library (runtime) - non-GUI support classes of
wxWindows toolkit
libwxbase2.4-dbg - wxBase library (debug) - non-GUI support classes of
wxWindows toolkit
libwxbase2.4-dev - wxBase library (development) - non-GUI support
classes of wxWindows toolkit
libwxgtk2.4 - wxWindows Cross-platform C++ GUI toolkit (GTK+ runtime)
libwxgtk2.4-contrib - wxWindows Cross-platform C++ GUI toolkit (runtime
contrib libs)
libwxgtk2.4-contrib-dev - wxWindows Cross-platform C++ GUI toolkit
(development contrib libs)
libwxgtk2.4-dbg - wxWindows Cross-platform C++ GUI toolkit (GTK+
development)
libwxgtk2.4-dev - wxWindows Cross-platform C++ GUI toolkit (GTK+
development)
libwxgtk2.4-python - wxWindows Cross-platform C++ GUI toolkit (wxPython
binding)libwxgtk2.5-dbg - wxWidgets Cross-platform C++ GUI toolkit (GTK+
development)
libwxgtk2.5-dev - wxWidgets Cross-platform C++ GUI toolkit (GTK+
development)
libwxgtk2.5.3 - wxWidgets Cross-platform C++ GUI toolkit (GTK+ runtime)
wx2.5-common - wxWidgets Cross-platform C++ GUI toolkit (common support
files)
wx2.5-doc - wxWidgets Cross-platform C++ GUI toolkit (documentation)
wx2.5-examples - wxWidgets Cross-platform C++ GUI toolkit (examples)
wx2.5-headers - wxWidgets Cross-platform C++ GUI toolkit (header files)
wx2.5-i18n - wxWidgets Cross-platform C++ GUI toolkit (i18n support)
wxwin2.4-doc - wxWindows Cross-platform C++ GUI toolkit (documentation)
wxwin2.4-examples - wxWindows Cross-platform C++ GUI toolkit (examples)
wxwin2.4-headers - wxWindows Cross-platform C++ GUI toolkit (header files)
wxwin2.4-i18n - wxWindows Cross-platform C++ GUI toolkit (i18n support)

Which one is the (as You've wrote) 'wxWidgets2.4'?
I have installed packages:

$ dpkg -l |grep wx
ii libwxbase2.4 2.4.2.6ubuntu1 wxBase library (runtime) - non-GUI
support c
ii libwxbase2.4-d 2.4.2.6ubuntu1 wxBase library (development) - non-GUI
suppo
ii libwxgtk2.4 2.4.2.6ubuntu1 wxWindows Cross-platform C++ GUI
toolkit (GT
ii libwxgtk2.4-co 2.4.2.6ubuntu1 wxWindows Cross-platform C++ GUI
toolkit (ru
ii libwxgtk2.4-co 2.4.2.6ubuntu1 wxWindows Cross-platform C++ GUI
toolkit (de
ii libwxgtk2.4-de 2.4.2.6ubuntu1 wxWindows Cross-platform C++ GUI
toolkit (GT
ii wxwin2.4-heade 2.4.2.6ubuntu1 wxWindows Cross-platform C++ GUI
toolkit (he
ii wxwin2.4-i18n 2.4.2.6ubuntu1 wxWindows Cross-platform C++ GUI
toolkit (i1

And I can't see anything else to install for wxWidget2.4.
It won't work with WxWidgets 2.5! - You must get 2.4.
I had installed wxwidgets2.5 and it didn't worked also.
 
D

Daniel Lewis

Its probably best if you use the synaptic manager (as i did [I have
only been using Ubuntu for about a month]).

You'll have to uninstall WxWidgets 2.5, so that you only have
WxWidgets 2.4 (try installing all of the 2.4 packages you listed,
probably best).

I know, this is really annoying to get your program working. WxRuby is
really nice though, and well worth the trouble of finding the right
installation components. (However I am thinking about changing to GTK,
and I like the look of the GTK Gui builder [Glade] --- seems very
nice)

Daniel.
 
T

ts

R> I have installed packages for Debian:

R> ruby1.8-dev
R> libwxbase2.4-dev
R> libwxbase2.4
R> libwxgtk2.4-contrib-dev

Well it worked for me (kubuntu)

uln% cat wxruby.rb
require "wxruby"
include Wx

class MinimalApp < App
def on_init
Frame.new(nil, -1, "The Bare Minimum").show()
end
end


MinimalApp.new.main_loop
uln%

uln% ruby wxruby.rb
uln%


I've made only one modification, in wxruby-0.6-src/src

uln% cat install.rb
require 'ftools'
require 'rbconfig'
include Config

if /powerpc-darwin/ =~ RUBY_PLATFORM
File::install('wxruby.bundle', CONFIG['archdir'], 0755, true)
else
# File::install('wxmsw240.dll', CONFIG['bindir'], 0755, true)
File::install('wxruby.so', CONFIG['archdir'], 0755, true)
end
uln%

See # for wxmsw240.dll

then re run

sudo ruby install.rb


Guy Decoux
 
R

RaW

Daniel Lewis napisa³(a):
You'll have to uninstall WxWidgets 2.5, so that you only have
WxWidgets 2.4 (try installing all of the 2.4 packages you listed,
probably best).

Thanks but still no positive efects.
Doesn't matter - it's not a big deal that wxRuby doesnt want to work for
me - let him go to hell ;)
Thanks for really quick answers.
I know, this is really annoying to get your program working. WxRuby is
really nice though, and well worth the trouble of finding the right
installation components. (However I am thinking about changing to GTK,
and I like the look of the GTK Gui builder [Glade] --- seems very
nice)
I tested tk and GTK2 and both work fine with ruby. As about GLADE i was
using it with C and it was working good on FedoraCore2. Now I have
Ubuntu and have some problems with it. Hmmm, is this possible that the
same aplication works so much different on various linux distro?
 
D

Daniel Lewis

I tested tk and GTK2 and both work fine with ruby. As about GLADE i was
using it with C and it was working good on FedoraCore2. Now I have
Ubuntu and have some problems with it. Hmmm, is this possible that the
same aplication works so much different on various linux distro?

Soon I shall be playing with Glade on Ubuntu... Breezy Badger preview
has just been released, and the Glade website has details about how to
install on it already!... the actual Breezy Badger release will be
somepoint mid-October.

My intentions are: Install Breezy Badger (and Ruby 1.8.3 of course),
Install GTK, Glade and Ruby Gnome.
This will (almost definitely) be my set up for my dissertation.
--- who knows, Ruby 2.0 might be out by the time I start my
dissertation (which will be April 2006), but I want to start playing
and learning about it all now, so I am ready to go!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top