Search code examples
monomonodevelopmonomac

Merging Mono Runtime 3.0.4 with MonoDevelop 3.x fails


I'm trying to merge the Mono Runtime (v 3.0.4) with a MonoMac application, but since the upgrade to 3.0.4 (from 2.10.11) this fails with the following error:

Merging Mono Runtime into app bundle
/Applications/MonoDevelop-old.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/mmp 
-nolink "-minos=10.6.6" 
-o "/Users/ted/Documents/XCode/Mac/StageTimer/StageTimer/bin/Release" 
-n "StageTimer" 
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Xml.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Core.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Xml.Linq.dll"
-a "/Library/Frameworks/Mono.framework/Versions/3.0.4/lib/mono/4.0/System.Drawing.dll"
-a "/Applications/MonoDevelop-old.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/MonoMac.dll"
"/Users/ted/Documents/XCode/Mac/StageTimer/StageTimer/bin/Release/StageTimer.exe"

Process exited with code 1, command:
pkg-config --variable=prefix mono-2

Unhandled Exception: System.IO.DirectoryNotFoundException: Directory '/lib/mono/4.0' not found.

Even if I configure MonoDevelop to use Mono 2.10.11 instead of 3.0.4 it fails with the same error (and path: '/lib/mono/4.0'). Next I also tried modifying the symlink in /Library/Frameworks/Mono.framework/Versions/Current to point to 2.10.11 but still the same error & path.

Anyone with mono & pkg-config skills that knows how to configure this?


Solution

  • Similar issue happened to F# compiler when one tried to run it alongside Mono 3.0.4 (instead of 3.0.3). The issue boils down to a bugfix in Mono that prevents conflicting the homebrew pkg-config set up. The workaround that was adopted in F# sources was to hardcode the path to Mono's pkg-config.

    You could probably get the same result as this by just overriding the environment variable PKG_CONFIG_PATH when launching MonoDevelop, this way:

    PKG_CONFIG_PATH=/path/were/mono/pc/files/are/in/Mac:$PKG_CONFIG_PATH monodevelop
    

    The exact path must be somewhere underneath /Library/Frameworks/Mono.framework/Versions/Current/ , just look out for files with .pc extension.