<div dir="ltr">On Wed, Jun 10, 2015 at 12:18 AM, Ranjit Jhala <span dir="ltr"><<a href="mailto:jhala@cs.ucsd.edu" target="_blank">jhala@cs.ucsd.edu</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace">Hi all,</div><div style="font-family:'courier new',monospace"><br></div><div style="font-family:'courier new',monospace">I cannot build 'vector' (or 'cmdargs') with profiling on. </div></div></blockquote><div><br></div><div>The short answer is: Never use --ghc-options="-prof". Cabal knows to use -prof to build profiling libraries and profiled executables, and will handle everything correctly automatically. If you remove the "-prof" part from the --ghc-options in your original command, vector will build with profiling correctly.<br><br></div><div>The longer explanation is:<br><br></div><div>vector uses Template Haskell which can only load the dynamic, unprofiled version of a library. In order to build vector in any configuration, its dependencies therefore need to have been built in at least the dynamic & unprofiled configuration. vector itself must also be built in the dynamic & unprofiled configuration, in case one module in vector runs a Template Haskell containing identifiers defined in another module in vector.<br><br></div><div>Cabal is capable of building both the dynamic & unprofiled and static & profiled configurations of vector and its dependencies simultaneously by default. However, if you explicitly add --ghc-options=-prof, then you defeat Cabal's attempt to build the dynamic & unprofiled configuration.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace">specifically when I run:</div><div style="font-family:'courier new',monospace"><br></div><div style="font-family:'courier new',monospace">    $ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector<br></div><div style="font-family:'courier new',monospace"><div><br></div><div><br></div><div>I get the message:</div><div><br></div><div><div>    Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’</div></div></div></div></blockquote><div><br></div><div>Right, by default ghc does not ship with dynamic & profiled libraries, so this will fail very quickly when Cabal tries to build a dynamic & unprofiled library, but you told it to also pass -prof to ghc.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'courier new',monospace">Per some advice I tried to add the '--disable-shared' <div><br></div><div><br></div><div>    $ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector<br></div><div><br></div><div><div>but then I get this:</div><div><br></div></div><div>    Loading package primitive-0.6 ... <command line>: can't load .so/.DLL for: libHSprimitive-0.6.dylib (dlopen(libHSprimitive-0.6.dylib, 9): image not found)<br></div></div></div></blockquote><div><br></div><div>This can't work because you need dynamic versions of vector's dependencies for Template Haskell, but you disabled building them with --disable-shared.<br><br></div><div>Regards,<br></div><div>Reid Barton<br></div></div><br></div></div>