tags:

views:

840

answers:

3
+2  A: 

You have a mixed setup.

The Gtk in /opt/local/var/macports did not come from Mono's installer for OSX, you probably got it earlier from macports. The Mono installer places its files under /Library/Frameworks/Mono.framework/

Chances are, you have something else on your path, since it works out of the box after I installed the Mono.Framework from the Mono web site (with the command line example that you have above).

miguel.de.icaza
Thanks Miguel, I'll report back if I resolve this or have other questions. (+1 para vos, por supuesto)
Yar
Sorry, do you mean "path" as in echo $PATH or... what environment vars should I be looking at?
Yar
Miguel, I've edited the question again after your comments, if you get a chance to look at it.
Yar
+2  A: 

Using MonoDevelop might make things easier, but here is how it references gtk# while compiling (note that it references the assembly straight from the GAC):

gmcs test.cs -r:/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll

You'll usually also need to include references to gdk-sharp and pango-sharp and glib-sharp, btw.

Note in the path that the framework version is "Current", which makes the command a little more future-proof.

Sandy
Thanks for that, Sandy, and good luck here on SO. I'll be checking that out shortly, although it seems like my favorite Mono strategy -- waiting -- is a good one as the whole thing advances.
Yar
+4  A: 

Quick and dirty solution:

cd /usr/local/bin
sudo ln -s /Library/Frameworks/Mono.framework/Commands/pkg-config ./pkg-config

Now your gmcs -pkg:... command will work.

Background: I hit this exact problem on a new Mac and a fresh install of Mono. Left me scratching my head for a few days until I took a close look at the error message:

error CS8027: Couldn't run pkg-config: ApplicationName='pkg-config', CommandLine='--libs gtk-sharp-2.0', CurrentDirectory=''

It's saying it couldn't run the program, so I did a

which pkg-config

That came up blank, so I thought probably it couldn't run it because it wasn't in the path. And that turned out to be it.

Yawar
Thanks Yawar. I'll mark this as best answer for now, and in the next month (it's December 2009) I'll give this a shot and see if it works for me. Problem is I haven't touched this stuff in a few months (been using pure Winforms). Sure looks right.
Yar