Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static linking wxHaskell on Mac OS X

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.

like image 252
Binil Thomas Avatar asked May 16 '12 09:05

Binil Thomas


1 Answers

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].

like image 174
Mahmoud Al-Qudsi Avatar answered Sep 21 '22 10:09

Mahmoud Al-Qudsi