lol

haskell-users-guide.md: document static linking

+21
+21
doc/haskell-users-guide.md
··· 666 666 The same thing applies to `cabal configure`, of course, if you're 667 667 building with `cabal-install` instead of Stack. 668 668 669 + ## Creating statically linked binaries 670 + 671 + There are two levels of static linking. The first option is to configure the 672 + build with the Cabal flag `--disable-executable-dynamic`. In Nix expressions, 673 + this can be achieved by setting the attribute: 674 + 675 + enableSharedExecutables = false; 676 + 677 + That gives you a binary with statically linked Haskell libraries and 678 + dynamically linked system libraries. 679 + 680 + To link both Haskell libraries and system libraries statically, the additional 681 + flags `--ghc-option=-optl=-static --ghc-option=-optl=-pthread` need to be used. 682 + In Nix, this is accomplished with: 683 + 684 + configureFlags = [ "--ghc-option=-optl=-static" "--ghc-option=-optl=-pthread" ]; 685 + 686 + It's important to realize, however, that most system libraries in Nix are built 687 + as shared libraries only, i.e. there is just no static library available that 688 + Cabal could link! 689 + 669 690 670 691 # Other resources 671 692