I want to distribute a wxHaskell application on Mac OS X. How do I go about creating a Mac OS X app which can be used standalone without the user having to install any extra libraries?
I noticed the cabal-macosx project which makes .app
bundles for Mac OS X. When I built the example wxHello application, the app bundle worked fine on my machine (after adding extra-lib-dirs: /usr/lib
to the .cabal
file). But when I tried it on another machine, I got the error: Dyld Error Message: Library not loaded: /Users/binil/.cabal/lib/wxc-0.90.0.3/ghc-7.0.4/libwxc.dylib
.
You can place the required dylibs in the
Contents/Resources
folder within your app bundle, as that is part of the search path for dylibs. You can automate this using the project's copy files build phase.Technically (though this does not always work for all dylibs), you should be able to pull it off "correctly" by converting the dylib to a Framework, then linking against it in your XCode project. There is a conversion script available [note: download].