I have JackOSX installed on my computer, which provides the JACK client libraries only as a dynamic library. I want to build Sonke Hahn and Henning Theilmann's Haskell bindings to the JACK library, but GHC doesn't come build with dynamic library support for OS X x86_64 in the Haskell Platform. I grabbed the GHC 7.0.3 sources and discovered the following steps to get a GHC install with dynamic library support. (You must have a working 64-bit GHC installed, I used 7.0.2 from HP 2011.2.)
-
Install libgmp (I used Homebrew). Though the GHC sources include libgmp, it doesn't build libgmp as a shared library, which causes problems linking integer-gmp later on. Installing libgmp through homebrew or macports will build libgmp as a shared library.
In the build tree, copy "mk/build.mk.sample" to "mk/build.mk".
Edit the "mk/config.mk" file, and find the line that says "PlatformSupportsSharedLibs = ..."
In the platform list on this line, add "x86_64-apple-darwin"
Run the configure script, making sure to use "--with-gmp-includes" and "--with-gmp-libraries" to tell configure where to find your preinstalled libgmp headers and libraries.
make && sudo make install
Disclaimer: I take no responsibility for any damage caused by following these instructions. Building OS X 64 bit shared library code is obviously not officially supported by GHC, and I'm not sure it works for anything other than the simplest programs.
Edit: Don Stewart commented that a release of the Haskell Platform with support for dynamic libraries on OS X is due in early April 2011.
Note that a revision of the Haskell Platform to include new support for dynamic libs on Mac OSX is due in early April 2011.
ReplyDeleteDoes that include support for shared libraries under x86_64 OS X?
ReplyDeleteAlso, since Cabal won't build just a dynamic library, this didn't actually solve my problem.
ReplyDelete