MacOS X (10.2.2) standalone ghc app

Wolfgang Thaller
Mon, 2 Dec 2002 23:47:41 +0100

> I'm trying to deliver a self contained app that I developed with ghc 
> 5.04.1 on Mac OS X (10.2.2). It all works well if ghc is installed on 
> the machine, but on a user-machine w/o ghc, the following file is 
> needed:
> HaskellSupport.framework/Versions/A/HaskellSupport

> Could someone explain why this is needed on OSX?  It seems OS 
> specific, for I don't have any of these issues on Windows and Linux.

GHC requires the GNU MP library (libgmp) and, on Mac OS X, also a small 
compatibility layer for dlopen() and friends. On Linux, GHC simply 
relies on libgmp to be installed, and most of the time, this is the 
For Windows, GHC currently statically links libgmp into your program, 
but this might violate the Lesser GNU General Public License under 
which libgmp is distributed (IANAL). For this reason, I chose _not_ to 
use static linking on Mac OS X.
Normal Mac-users don't want to install a UNIX-style shared library into 
/usr/local/lib (after all, /usr is not visible in the Finder). The 
HaskellSupport.framework can be installed much more conveniently.

> Any hint about how to do the linking statically on OSX would be 
> greatly appreciated.

1) Distribute HaskellSupport.framework along with your app, with 
instructions on how to install it or with an installer.
It should go into /Libraries/Frameworks/

2) If you already have a MacOS X-Style .app-package for your 
application, you can put HaskellSupport.framework into Unfortunately, .app-packages 
aren't very useful for non-graphical applications.

3) Forcing static linking is not as easy as it could be. Make sure you 
have static versions of libgmp and dlcompat (you can get sources at and respectively). Then use ghc -v for 
linking and copy the linker command line passed to Apple's linker. Then 
run Apple's linker directly but replace "-framework HaskellSupport" by 
the absolute paths to the static versions of the libraries (if you use 
-l, the linker will use dynamic libs if present). I'd say it's not 
worth the effort, especially as the LGPL places some requirements on 
your program that you might not be aware of. If you want to do it 
anyway and you need more assistance, just yell.


Wolfgang Thaller