[Ironruby-core] IronRuby + Mono + WinForms issue
Andrew S. Townley
ast at atownley.org
Thu Nov 26 08:49:49 EST 2009
Wow. Yeah, I can see why that too awhile! :)
Thanks for the explanation. I understand the issue here, and I see the
difference between the two versions.
Thanks also for the build script. That will help a lot going forward.
I'm just about to set up (build) Mono 2.4 on another Ubuntu 8.04
machine, so that looks the business! Is the whole script available
somewhere? I know I could probably just finish it myself fairly
quickly, but if you've already got one that works, that'd be very
cool. ;)
I don't really use any other of the default Ubuntu mono apps, but I
didn't want to deal with dependency-hell with apt to try and remove only
what I didn't actually need. I figured it'd just be safer to build from
source, use the source script to toggle the environment and leave well
enough alone. I do the same thing to cycle between several versions of
the JDK when I'm doing that sort of thing too, so it isn't a new trick.
What I ought to do is summarize all of this nicely into a blog post, but
I've issues with my blog at the moment. At least I have the emails, and
I'll likely be going through this again after a while to set up another
machine. By then, I should have my blog sorted! :)
Thanks so much for all your help!
ast
On Thu, 2009-11-26 at 13:45 +0100, Ivan Porto Carrero wrote:
> and as to why you're seeing that there is because
>
>
> require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089'
>
>
> is the only line of content in the file
>
>
> lib/ironruby/System.Windows.Forms.rb
>
>
> because paths are case sensitive it was looking in lib/IronRuby for
> the file System.Windows.Forms.rb but couldn't find it and told you
> about it.
> The ir.exe.config file holds the initial search paths for IronRuby.
>
>
> I came across this issue when I tried to use gems it took a while
> before I got to 1 + 1 = 2
> ---
> Met vriendelijke groeten - Best regards - Salutations
> Ivan Porto Carrero
> Blog: http://flanders.co.nz
> Google Wave: portocarrero.ivan at googlewave.com
> Twitter: http://twitter.com/casualjim
> Author of IronRuby in Action (http://manning.com/carrero)
>
>
>
> On Thu, Nov 26, 2009 at 12:46 PM, Andrew S. Townley <ast at atownley.org>
> wrote:
> As an interesting side-note (and maybe a crucial point), I
> remembered I
> had a sample I used the last time I looked at IronRuby back in
> April.
> This one actually runs fine with no errors.
>
> Do you really have to specify the whole assembly information
> with each
> require?
>
> $ cat formtest.rb
> require 'mscorlib'
> require 'System.Windows.Forms, Version=2.0.0.0,
> Culture=neutral,
> PublicKeyToken=b77a5c561934e089'
> require 'System.Drawing, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a'
>
> Application = System::Windows::Forms::Application
> Form = System::Windows::Forms::Form
> MessageBox = System::Windows::Forms::MessageBox
> Button = System::Windows::Forms::Button
> Point = System::Drawing::Point
>
> class MyForm < Form
>
> def initialize
> self.text = "My .NET Form from Ruby"
>
> @button = Button.new
> @button.location = Point.new 150, 150
> @button.text = "Click Me!"
>
> my_click_handler = Proc.new {|sender, e| MessageBox.show
> 'Hello from
> Ruby!'}
> @button.click(&my_click_handler)
>
> self.controls.add @button
> end
> end
>
> my_form = MyForm.new
> Application.run my_form
>
> I'm a bit confused at this stage.... :(
>
>
> On Thu, 2009-11-26 at 11:36 +0000, Andrew S. Townley wrote:
> > On Thu, 2009-11-26 at 12:22 +0100, Ivan Porto Carrero wrote:
> > > what's the output of your pkgconfig path?
> > >
> > >
> > > ivan at debian-stage:~
> > > » pkg-config --variable=libdir mono
> > > /usr/local/mono/lib/pkgconfig/../../lib
> >
> > $ pkg-config --variable=libdir mono
> > /usr/local/mono-2.4/lib/pkgconfig/../../lib
> >
> > > ivan at debian-stage:~
> > > » echo $PKG_CONFIG_PATH
> > > /usr/local/mono/lib/pkgconfig
> >
> > $ echo $PKG_CONFIG_PATH
> > /usr/local/mono-2.4/lib/pkgconfig
> >
> > > I added these lines to my .bashrc file
> > >
> > > export PKG_CONFIG_PATH=/usr/local/mono/lib/pkgconfig:
> $PKG_CONFIG_PATH
> > > export PATH="~/bin:/usr/local/mono/bin:$PATH"
> >
> > Yeah, I have a specific mono-2.4 environment script that I
> source based
> > on notes from here:
> >
> http://www.centriment.com/2009/04/01/building-mono-24-from-source-on-ubuntu-810/
> >
> > #!/bin/bash
> > MONO_PREFIX=/usr/local/mono-2.4
> > export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
> > export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
> > #export C_INCLUDE_PATH=$MONO_PREFIX/include
> > export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
> > export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig
> > PATH=$MONO_PREFIX/bin:$PATH
> >
> > >
> > > You can find more stuff here:
> > > http://linux.die.net/man/1/mono
> >
> >
> > >
> > > Are you able to get a hello world app with C# going in
> winforms?
> >
> > Yes.
> >
> > $ cat hello.cs
> > using System;
> > using System.Drawing;
> > using System.Windows.Forms;
> >
> > public class HelloWorld : Form
> > {
> > static public void Main ()
> > {
> > Application.Run (new HelloWorld ());
> > }
> >
> > public HelloWorld ()
> > {
> > Button b = new Button ();
> > b.Text = "Click Me!";
> > b.Click += new EventHandler (Button_Click);
> > Controls.Add (b);
> > }
> >
> > private void Button_Click (object sender, EventArgs e)
> > {
> > MessageBox.Show ("Button Clicked!");
> > }
> > }
> > $ gmcs -pkg:dotnet hello.cs
> > $ which mono
> > /usr/local/mono-2.4/bin/mono
> > $ mono hello.exe
> > $
> >
> > > ---
> > > Met vriendelijke groeten - Best regards - Salutations
> > > Ivan Porto Carrero
> > > Blog: http://flanders.co.nz
> > > Google Wave: portocarrero.ivan at googlewave.com
> > > Twitter: http://twitter.com/casualjim
> > > Author of IronRuby in Action (http://manning.com/carrero)
> > >
> > >
> > >
> > > On Thu, Nov 26, 2009 at 12:10 PM, Andrew S. Townley
> <ast at atownley.org>
> > > wrote:
> > > I sent this to Thibaut, but I probably should've
> sent it to
> > > the whole
> > > list since it probably isn't directly related to
> his work
> > > (sorry
> > > Thibaut!).
> > >
> > > Thanks to Ivan's pointer to mono builds, I was
> able to get
> > > IronRuby to
> > > work as I would've expected. However, it doesn't
> seem able to
> > > find the
> > > WinForms stuff that I clearly have on my machine:
> > >
> > > $ locate System.Windows.Forms
> > > /usr/lib/mono/1.0/System.Windows.Forms.dll
> > > /usr/lib/mono/gac/System.Windows.Forms
> > >
> /usr/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089
> > >
> /usr/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089/System.Windows.Forms.dll
> > >
> /usr/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089/System.Windows.Forms.dll.config
> > >
> /usr/local/ironruby/lib/ironruby/System.Windows.Forms.rb
> > >
> /usr/local/mono-2.4/lib/mono/1.0/System.Windows.Forms.dll
> > >
> /usr/local/mono-2.4/lib/mono/2.0/System.Windows.Forms.dll
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089/System.Windows.Forms.dll
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089/System.Windows.Forms.dll.mdb
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
> > >
> /usr/local/mono-2.4/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.mdb
> > >
> > > $ which mono
> > > /usr/local/mono-2.4/bin/mono
> > >
> > > $ ir -v
> > > IronRuby 0.9.3.0 on .NET 2.0.0.0
> > >
> > > $ cat /tmp/test.rb
> > > require 'System.Windows.Forms'
> > >
> > > $ ir /tmp/test.rb
> > > :0:in `require': no such file to load --
> System.Windows.Forms
> > > (LoadError)
> > > from /tmp/test.rb:1
> > >
> > > I've even tried explicitly including the .NET 2.0
> libraries as
> > > part of
> > > the LD_LIBRARY_PATH, but that didn't work:
> > >
> > > $ echo $LD_LIBRARY_PATH
> > >
> /usr/local/mono-2.4/lib:/usr/local/mono-2.4/lib/mono/2.0
> > >
> > > Obviously, there's still a piece of the puzzle
> that I'm
> > > missing. Any
> > > ideas?
> > >
> > > Thanks in advance,
> > >
> > > ast
> > > --
> > > Andrew S. Townley <ast at atownley.org>
> > > http://atownley.org
> > >
> > > _______________________________________________
> > > Ironruby-core mailing list
> > > Ironruby-core at rubyforge.org
> > >
> http://rubyforge.org/mailman/listinfo/ironruby-core
> > >
> > >
> > > _______________________________________________
> > > Ironruby-core mailing list
> > > Ironruby-core at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/ironruby-core
> --
> Andrew S. Townley <ast at atownley.org>
> http://atownley.org
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
--
Andrew S. Townley <ast at atownley.org>
http://atownley.org
More information about the Ironruby-core
mailing list