Why can't cabal build mighttpd2 dynamically?

2019-05-15 08:54发布

问题:

GHC is too slow when it links my executable statically, so I want to test using "-dynamic" options. The following two commands cause the same error although cabal install mighttpd2 is ok.

$cabal install --ghc-options=-dynamic mighttpd2
$cabal install --enable-executable-dynamic mighttpd2

Linking dist/build/mkindex/mkindex ...
Preprocessing executable 'mightyctl' for mighttpd2-2.7.1...
Process.hs:11:8:
    Could not find module `Data.Conduit.Process'
    Perhaps you haven't installed the "dyn" libraries for package `process conduit-0.5.0.2'?
    Use Perhaps you haven't installed the "dyn" libraries for package `process-conduit-0.5.0.2'?
    Use -v to see a list of the files searched for.
    cabal: Error: some packages failed to install:
    mighttpd2-2.7.1 failed during the building phase. The exception was:ExitFailure 1

回答1:

You need to install the dynamic version of all the libraries that mighttpd2 depends on. cabal-install is rightly complaining that the dynamic version of process-conduit is not available. You will have to reinstall mighttpd2's entire dependency tree with --enable-shared --enable-executable-dynamic passed to cabal-install.