Ticket #230 (new defect)
Opened 4 months ago
Make dynamically linked executables work out-of-the box on OS X
|Reported by:||blitzcode||Owned by:||dons|
I can't talk about other platforms, but on OS X I wasn't able to make dynamic linking work with the current 2013.2.0.0 release.
- While the GHC distributed with the HP has shared versions build for all the core libraries, the HP packages do not. This is especially annoying because even with Cabal 1.18's sandbox feature there is no easy / automatic way to re-install such packages with '--enable-shared'. For instance, creating a sandbox and compiling shared libraries for all dependencies with 'cabal install --enable-shared --dependencies-only', you'll get an error like this:
Control/Monad/Morph.hs:90:8: Could not find module Data.Functor.Identity' Perhaps you haven't installed the "dyn" libraries for packagetransformers-0.3.0.0'? Use -v to see a list of the files searched for.
and will have to do a 'cabal install transformers --enable-shared --reinstall' equivalent for every HP package you need shared libraries for.
- GHC's core libraries don't seem to set their install name correctly. They all seem to point to a location like this:
Which does not exist. Even fixing that with a symlink, dependencies like these pop up:
dyld: Library not loaded: /Users/ian/zz32/ghc-7.6.3/libffi/build/inst/lib/libffi.6.dylib Referenced from: /usr/local/lib/ghc-7.6.3/libHSrts-ghc7.6.3.dylib
it seems this is fixed with http://ghc.haskell.org/trac/ghc/ticket/8266, though!
- Cabal's default configuration has '-- shared: False'
With static linking, GHC has often 10sec+ link times on every single build, even for simple programs. This is a total productivity train during development. Dynamic linking seems like a good fix. I think it would be a good idea to have the HP support this way of building out-of-the-box!