wxRuby problem on Ubuntu

Discussion in 'Ruby' started by RaW, Sep 29, 2005.

  1. RaW

    RaW Guest

    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.

    --
    RaW
     
    RaW, Sep 29, 2005
    #1
    1. Advertising

  2. RaW

    Daniel Lewis Guest

    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.

    On 29/09/05, RaW <> wrote:
    > 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.
    >
    > --
    > RaW
    >
    >
     
    Daniel Lewis, Sep 29, 2005
    #2
    1. Advertising

  3. RaW

    RaW Guest

    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 :(


    --
    RaW
     
    RaW, Sep 29, 2005
    #3
  4. RaW

    RaW Guest

    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.
    --
    RaW
     
    RaW, Sep 29, 2005
    #4
  5. RaW

    Daniel Lewis Guest

    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.
     
    Daniel Lewis, Sep 29, 2005
    #5
  6. RaW

    ts Guest

    >>>>> "R" == RaW <> writes:

    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
     
    ts, Sep 29, 2005
    #6
  7. RaW

    RaW Guest

    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?

    --
    RaW
     
    RaW, Sep 30, 2005
    #7
  8. RaW

    Daniel Lewis Guest

    > 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!
     
    Daniel Lewis, Sep 30, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SPE - Stani's Python Editor
    Replies:
    1
    Views:
    477
    SPE - Stani's Python Editor
    Apr 29, 2008
  2. Andreas Schwarz
    Replies:
    5
    Views:
    114
  3. kazaam
    Replies:
    2
    Views:
    143
    Stefano Crocco
    Aug 23, 2007
  4. Victor Reyes

    Problem loading wxruby

    Victor Reyes, Apr 3, 2008, in forum: Ruby
    Replies:
    2
    Views:
    122
    Victor Reyes
    Apr 3, 2008
  5. Marvin Gülker
    Replies:
    0
    Views:
    144
    Marvin Gülker
    Apr 3, 2009
Loading...

Share This Page