2

Is it possible to change cabal or GHC settings so that cabal install generates dynamic binaries and libraries by default?

I'm using GHC 8.2.2, installed using apt-get in Ubuntu (16.04) without Haskell Platform or stack. Searching around, I found the SO question Why can't cabal build mighttpd2 dynamically? . The answers/comments there said something about adding --enable-shared --enable-executable-dynamic when cabal install. And this can be done manually for all dependency libraries (which would be a pain).

In Small Haskell program compiled with GHC into huge binary, the accepted answer says that one needs to:

cabal install some_package --enable-shared --reinstall 

The option -dynamic is also mentioned.

My question is:

Is it possible to change the options in the cabal configuration file (~/.cabal/config) from the very beginning so that all binaries and their dependency libraries use dynamic linkage (i.e. with --enable-shared --enable-executable-dynamic or -dynamic by default)?

duplode
  • 33,731
  • 7
  • 79
  • 150
thor
  • 21,418
  • 31
  • 87
  • 173

1 Answers1

0

Indeed, you can alter your ~/.cabal/config file to have the following lines:

shared: True
executable-dynamic: True
sclv
  • 38,665
  • 7
  • 99
  • 204