
Hi all, I cannot build 'vector' (or 'cmdargs') with profiling on. specifically when I run: $ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector I get the message: Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’ https://ghc.haskell.org/trac/ghc/ticket/8677 Per some advice I tried to add the '--disable-shared' $ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector but then I get this: 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) Any idea whats going on or for any work arounds? Pretty stumped! Thanks in advance! Ranjit.

What ghc version and how was it built?
On Wednesday, June 10, 2015, Ranjit Jhala
Hi all,
I cannot build 'vector' (or 'cmdargs') with profiling on.
specifically when I run:
$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
I get the message:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
https://ghc.haskell.org/trac/ghc/ticket/8677
Per some advice I tried to add the '--disable-shared'
$ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
but then I get this:
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)
Any idea whats going on or for any work arounds? Pretty stumped! Thanks in advance!
Ranjit.

ah, my bad I thought I'd included that -- this is ghc 7.8.3, on MacOS, installed from https://ghcformacosx.github.io ... Should I just move to 7.10? On Wed, Jun 10, 2015 at 4:59 AM, Carter Schonwald < carter.schonwald@gmail.com> wrote:
What ghc version and how was it built?
On Wednesday, June 10, 2015, Ranjit Jhala
wrote: Hi all,
I cannot build 'vector' (or 'cmdargs') with profiling on.
specifically when I run:
$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
I get the message:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
https://ghc.haskell.org/trac/ghc/ticket/8677
Per some advice I tried to add the '--disable-shared'
$ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
but then I get this:
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)
Any idea whats going on or for any work arounds? Pretty stumped! Thanks in advance!
Ranjit.
-- Ranjit.

why were you trying to build profiling dylibs? i thought we only support
static linked profiling libs? (i could be wrong though)
On Wed, Jun 10, 2015 at 9:26 AM, Ranjit Jhala
ah, my bad I thought I'd included that -- this is ghc 7.8.3, on MacOS, installed from https://ghcformacosx.github.io ...
Should I just move to 7.10?
On Wed, Jun 10, 2015 at 4:59 AM, Carter Schonwald < carter.schonwald@gmail.com> wrote:
What ghc version and how was it built?
On Wednesday, June 10, 2015, Ranjit Jhala
wrote: Hi all,
I cannot build 'vector' (or 'cmdargs') with profiling on.
specifically when I run:
$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
I get the message:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
https://ghc.haskell.org/trac/ghc/ticket/8677
Per some advice I tried to add the '--disable-shared'
$ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
but then I get this:
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)
Any idea whats going on or for any work arounds? Pretty stumped! Thanks in advance!
Ranjit.
-- Ranjit.

Hi Carter, Are you referring to the '--disable-shared' flag? If so -- I added it because otherwise I got a bunch of errors about: Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’ Or were you referring to some other flag? Thanks! Ranjit. On Wed, Jun 10, 2015 at 9:41 PM, Carter Schonwald < carter.schonwald@gmail.com> wrote:
why were you trying to build profiling dylibs? i thought we only support static linked profiling libs? (i could be wrong though)
On Wed, Jun 10, 2015 at 9:26 AM, Ranjit Jhala
wrote: ah, my bad I thought I'd included that -- this is ghc 7.8.3, on MacOS, installed from https://ghcformacosx.github.io ...
Should I just move to 7.10?
On Wed, Jun 10, 2015 at 4:59 AM, Carter Schonwald < carter.schonwald@gmail.com> wrote:
What ghc version and how was it built?
On Wednesday, June 10, 2015, Ranjit Jhala
wrote: Hi all,
I cannot build 'vector' (or 'cmdargs') with profiling on.
specifically when I run:
$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
I get the message:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
https://ghc.haskell.org/trac/ghc/ticket/8677
Per some advice I tried to add the '--disable-shared'
$ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
but then I get this:
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)
Any idea whats going on or for any work arounds? Pretty stumped! Thanks in advance!
Ranjit.
-- Ranjit.
-- Ranjit.

Please share the exact way you're doing things.
Vector does build fine as a static profiled lib on Mac, so the challege
lies in understanding where your local configuration is broken. Please
share more info. Or reinstall stuff
On Jun 11, 2015 12:51 AM, "Ranjit Jhala"
Hi Carter,
Are you referring to the '--disable-shared' flag?
If so -- I added it because otherwise I got a bunch of errors about:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
Or were you referring to some other flag?
Thanks!
Ranjit.
On Wed, Jun 10, 2015 at 9:41 PM, Carter Schonwald < carter.schonwald@gmail.com> wrote:
why were you trying to build profiling dylibs? i thought we only support static linked profiling libs? (i could be wrong though)
On Wed, Jun 10, 2015 at 9:26 AM, Ranjit Jhala
wrote: ah, my bad I thought I'd included that -- this is ghc 7.8.3, on MacOS, installed from https://ghcformacosx.github.io ...
Should I just move to 7.10?
On Wed, Jun 10, 2015 at 4:59 AM, Carter Schonwald < carter.schonwald@gmail.com> wrote:
What ghc version and how was it built?
On Wednesday, June 10, 2015, Ranjit Jhala
wrote: Hi all,
I cannot build 'vector' (or 'cmdargs') with profiling on.
specifically when I run:
$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
I get the message:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
https://ghc.haskell.org/trac/ghc/ticket/8677
Per some advice I tried to add the '--disable-shared'
$ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
but then I get this:
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)
Any idea whats going on or for any work arounds? Pretty stumped! Thanks in advance!
Ranjit.
-- Ranjit.
-- Ranjit.

Hi Carter, OK, here's the full info (see log below), this is on an MBP, running ghc 7.8.3 (From ghcformac). In a new directory, I create a FRESH cabal sandbox, and then do: $ cabal install --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector In doing so I get errors about unable to build 'primitive' because Failed to load interface for ‘GHC.Integer.Type’ Perhaps you haven't installed the "p_dyn" libraries for package ‘integer-gmp’? Use -v to see a list of the files searched for. Googling the above takes me to https://ghc.haskell.org/trac/ghc/ticket/8677 But unfortunately I can't from the above tell exactly how to proceed. 1. Can you tell me how to get a profiling version of vector built in a new sandbox? i.e. what options are you using? 2. Is there any other information you need? I'm assuming since its in a sandbox I needn't nuke my global cabal directory but happy to if needed. Thanks! (log below) -- Ranjit. rjhala@borscht ~/r/l/tmp> mkdir vector-build rjhala@borscht ~/r/l/tmp> cd vector-build/ rjhala@borscht ~/r/l/t/vector-build> cabal sandbox init Writing a default package environment file to /Users/rjhala/research/liquid/tmp/vector-build/cabal.sandbox.config Creating a new sandbox at /Users/rjhala/research/liquid/tmp/vector-build/.cabal-sandbox rjhala@borscht ~/r/l/t/vector-build> cabal install --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector Resolving dependencies... Notice: installing into a sandbox located at /Users/rjhala/research/liquid/tmp/vector-build/.cabal-sandbox Configuring primitive-0.6... Building primitive-0.6... Failed to install primitive-0.6 Last 10 lines of the build log ( /Users/rjhala/research/liquid/tmp/vector-build/.cabal-sandbox/logs/primitive-0.6.log ): Configuring primitive-0.6... Building primitive-0.6... Preprocessing library primitive-0.6... [ 1 of 10] Compiling Data.Primitive.Internal.Compat ( Data/Primitive/Internal/Compat.hs, dist/dist-sandbox-34ea82/build/Data/Primitive/Internal/Compat.o ) Top level: Failed to load interface for ‘GHC.Integer.Type’ Perhaps you haven't installed the "p_dyn" libraries for package ‘integer-gmp’? Use -v to see a list of the files searched for. cabal: Error: some packages failed to install: primitive-0.6 failed during the building phase. The exception was: ExitFailure 1 vector-0.10.12.3 depends on primitive-0.6 which failed to install. rjhala@borscht ~/r/l/t/vector-build [1]> which ghc /Applications/ghc-7.8.3.app/Contents/bin/ghc

Remove the prof flag and it will work. GHC is trying to do dylib with
profiling
On Jun 11, 2015 11:12 AM, "Ranjit Jhala"
Hi Carter,
OK, here's the full info (see log below), this is on an MBP, running ghc 7.8.3 (From ghcformac).
In a new directory, I create a FRESH cabal sandbox, and then do:
$ cabal install --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
In doing so I get errors about unable to build 'primitive' because
Failed to load interface for ‘GHC.Integer.Type’ Perhaps you haven't installed the "p_dyn" libraries for package ‘integer-gmp’? Use -v to see a list of the files searched for.
Googling the above takes me to
https://ghc.haskell.org/trac/ghc/ticket/8677
But unfortunately I can't from the above tell exactly how to proceed.
1. Can you tell me how to get a profiling version of vector built in a new sandbox? i.e. what options are you using?
2. Is there any other information you need? I'm assuming since its in a sandbox I needn't nuke my global cabal directory but happy to if needed.
Thanks! (log below)
-- Ranjit.
rjhala@borscht ~/r/l/tmp> mkdir vector-build rjhala@borscht ~/r/l/tmp> cd vector-build/ rjhala@borscht ~/r/l/t/vector-build> cabal sandbox init Writing a default package environment file to /Users/rjhala/research/liquid/tmp/vector-build/cabal.sandbox.config Creating a new sandbox at /Users/rjhala/research/liquid/tmp/vector-build/.cabal-sandbox rjhala@borscht ~/r/l/t/vector-build> cabal install --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector Resolving dependencies... Notice: installing into a sandbox located at /Users/rjhala/research/liquid/tmp/vector-build/.cabal-sandbox Configuring primitive-0.6... Building primitive-0.6... Failed to install primitive-0.6 Last 10 lines of the build log ( /Users/rjhala/research/liquid/tmp/vector-build/.cabal-sandbox/logs/primitive-0.6.log ): Configuring primitive-0.6... Building primitive-0.6... Preprocessing library primitive-0.6... [ 1 of 10] Compiling Data.Primitive.Internal.Compat ( Data/Primitive/Internal/Compat.hs, dist/dist-sandbox-34ea82/build/Data/Primitive/Internal/Compat.o )
Top level: Failed to load interface for ‘GHC.Integer.Type’ Perhaps you haven't installed the "p_dyn" libraries for package ‘integer-gmp’? Use -v to see a list of the files searched for. cabal: Error: some packages failed to install: primitive-0.6 failed during the building phase. The exception was: ExitFailure 1 vector-0.10.12.3 depends on primitive-0.6 which failed to install. rjhala@borscht ~/r/l/t/vector-build [1]> which ghc /Applications/ghc-7.8.3.app/Contents/bin/ghc

On Wed, Jun 10, 2015 at 12:18 AM, Ranjit Jhala
Hi all,
I cannot build 'vector' (or 'cmdargs') with profiling on.
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. The longer explanation is: 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. 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.
specifically when I run:
$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
I get the message:
Perhaps you haven't installed the "p_dyn" libraries for package ‛integer-gmp’
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.
Per some advice I tried to add the '--disable-shared'
$ cabal install --disable-shared --enable-executable-profiling --enable-library-profiling --ghc-options="-O2 -rtsopts -prof -auto-all -caf-all" vector
but then I get this:
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)
This can't work because you need dynamic versions of vector's dependencies for Template Haskell, but you disabled building them with --disable-shared. Regards, Reid Barton

Thanks Carter and Reid! (I suspect I'd copied those options from somewhere a long time ago when they worked...) Things seem to be building now! Thanks a bunch!

I just always set profiling to True in ~/.cabal/config and then call it a
day :)
I believe cabal or something has a notion of profiling ghc options that are
only supplied when building profiling libs, but I don't remember precisely
where they are or if they are a thing
On Thursday, June 11, 2015, Ranjit Jhala
Thanks Carter and Reid! (I suspect I'd copied those options from somewhere a long time ago when they worked...) Things seem to be building now! Thanks a bunch!
participants (3)
-
Carter Schonwald
-
Ranjit Jhala
-
Reid Barton