MacOS X (10.2.2) standalone ghc app

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 The error message is: idc_Darwin can't open library: HaskellSupport.framework/Versions/A/HaskellSupport (No such file or directory, errno = 2) Trace/BPT trap 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. Any hint about how to do the linking statically on OSX would be greatly appreciated. Thanks, - Reto

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 case. 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 MyApplication.app/Contents/Frameworks/. 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 www.gnu.org and fink.sourceforge.net 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. Regards, Wolfgang Thaller

On Mon, Dec 02, 2002 at 11:47:41PM +0100, Wolfgang Thaller wrote:
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
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 MyApplication.app/Contents/Frameworks/. Unfortunately, .app-packages aren't very useful for non-graphical applications.
If you don't have a .app-style package for your program, bundle
the HaskellSupport.framework file with your tarball and use
a shell script launcher to tell dyld(1) where the framework is.
e.g. if you install your package to /opt/MyHaskellProgram, dump
the HaskellSupport.framework directory in
/opt/MyHaskellProgram/Frameworks and use something like this:
#!/bin/sh
DYLD_FRAMEWORK_PATH=/opt/MyHaskellProgram/Frameworks
export DYLD_FRAMEWORK_PATH
exec /opt/MyHaskellProgram/bin/MyHaskellProgram "$@"
"man dyld" for other fun experiences in linking :)
--
#ozone/algorithm

Reto Kramer wrote:
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
Yes. It's briefly mentioned in the README that you saw in the installer :-)
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.
The HaskellSupport.framework contains two required support libraries, libgmp and dlcompat. Libgmp is distributed under the GNU Lesser General Public License (LGPL), which means that statically linking to it places special requirements on your program. Therefore static linking is not really an option in this case. I've packaged the two required libraries as one "framework" because that's easier to install for end-users than unix-style dynamic libraries. Programs compiled using GHC for Linux just expect libgmp to be installed (which is often the case on Linux). On Windows, libgmp is statically linked, which means that you should at least read the LGPL before distributing your program.
Any hint about how to do the linking statically on OSX would be greatly appreciated.
Just don't. Instead, read section 6 of the LGPL (somewhere at www.gnu.org) for the complete list of conditions you would have to fulfill, and then think about how easy and convenient dynamic linking is :-). Happy New Year, Wolfgang
participants (3)
-
Andre Pang
-
Reto Kramer
-
Wolfgang Thaller