06 March 2010

Solving the pkg-config and Mono 3.5 Profile mysteries on MacOS X 10.6 (Mono 2.6.1)

Yesterday I’ve tried to install Mono 2.6.1 on my Mac mini to do some work on my pet project MOSA. Unfortunately things didn’t work out as smoothly as I thought as nant greeted me with the following error message:

        Failed to initialize the 'Mono 3.5 Profile' (mono-3.5) target framework.

Furthermore it stated:

        'pkg-config' failed to start.

I tried all sorts of things from reinstalling, to cleaning, to trying to pull mono from Macports and even compiling Mono myself. Nothing has helped, every attempt was stopped by some error at some point.

The I started to do some digging and tried running pkg-config from Terminal - sure enough it wasn’t there. It was however in my /opt/local/bin folder, so running

        /opt/local/bin/pkg-config --modversion mono

resulted in:

        Package mono was not found in the pkg-config search path.
        Perhaps you should add the directory containing `mono.pc'
        to the PKG_CONFIG_PATH environment variable
        No package 'mono' found

Ok, so again I stumbled - looking further I found another pkg-config installed by Mono itself. So running it with the following two commands in Terminal:

        export PATH=/Library/Frameworks/Mono.framework/Versions/2.6.1/bin:$PATH
        pkg-config --modversion mono

produced:

        Package glib-2.0 was not found in the pkg-config search path.
        Perhaps you should add the directory containing `glib-2.0.pc'
        to the PKG_CONFIG_PATH environment variable
        Package 'glib-2.0', required by 'Mono', not found

Again I stumbled. Looking for glib-2.0.pc I found it in /opt/local/lib. So I added it to the PKG_CONFIG_PATH and ran it again:

        export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH
        pkg-config --modversion mono

Now I finally got the response:

        2.6.1

So I’ve finally got pkg-config to work and running nant worked too - I can now start contributing some code again...

1 comment:

Benjamin said...

Sweet thanks!