[Ironruby-core] IronRuby + Mono + WinForms issue

Ivan Porto Carrero ivan at flanders.co.nz
Thu Nov 26 06:48:29 EST 2009


k

I used to set those env. variables but the only one you really need is the
PKG_CONFIG_PATH one if that is the only mono version on your system and it's
installed in a non standard location (outside /usr or /usr/local)

On ubuntu there is a package on launchpad called monoxide which has the
2.4.2.3 release as a .deb package.. might be easier to get going.
https://launchpad.net/~directhex/+archive/monoxide

Here's the script I use to build mono from trunk on both ubuntu and debian.

ivan at debian-stage:~/src/mono
» cat ./update_mono
#!/usr/bin/env bash
#svn co svn://
anonsvn.mono-project.com/source/trunk/{cecil,debugger,gtk-sharp,libgdiplus,mcs,mod_mono,mono,mono-addins,mono-basic,mono-tools,monodevelop,moon,olive,rocks,winforms,winforms-tools,xbuild,xsp,gnome-sharp,gnome-desktop-sharp,gluezilla,monodevelop-visualizers,monocov}

svn up
{cecil,debugger,gtk-sharp,libgdiplus,mcs,mod_mono,mono,mono-addins,mono-basic,mono-tools,monodevelop,moon,olive,rocks,winforms,winforms-tools,xbuild,xsp,gnome-sharp,gnome-desktop-sharp,gluezilla,monodevelop-visualizers,monocov}

cd mono
make distclean
./autogen.sh --prefix=/usr/local/mono --with-moonlight=yes
--with-libgdiplus=sibling --with-profile4=yes
make
sudo make install
cd ..

#... build script for the extra libs like gtk-sharp, gnome-sharp etc. all
the way to monodevelop

---
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:36 PM, Andrew S. Townley <ast at atownley.org>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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091126/1548dda6/attachment-0001.html>


More information about the Ironruby-core mailing list