Nikolaos Bezirgiannis | 5 Apr 16:41 2013
Picon

Error when building executable with profiling enabled


Hello,

i have an executable where i want to run profiling on.

I do:

ghc --make -prof -auto-all -fth Custom.hs

but it does not built and the output is:

bench\HLogo\Custom\Custom.hs:1:1:
    Dynamic linking required, but this is a non-standard build (eg. prof).
    You need to build the program twice: once the normal way, and then
    in the desired way using -osuf to set the object file suffix.

I tried googling on the error with no success. What can I do to
compile this file for profiling?

Cheers,
Nikos
Krzysztof Skrzętnicki | 5 Apr 16:57 2013
Picon

Re: Error when building executable with profiling enabled

You are using TemplateHaskell (-fth switch) which can be tricky. Please see this documentation on profiling with TH: http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/template-haskell.html#id624714 . Other than following the documentation I would recommend using Cabal which handles the necessary flags and double-compilation process itself.

Best regards,
Krzysztof Skrzętnicki


On Fri, Apr 5, 2013 at 4:41 PM, Nikolaos Bezirgiannis <bezirg <at> gmail.com> wrote:

Hello,

i have an executable where i want to run profiling on.

I do:

ghc --make -prof -auto-all -fth Custom.hs

but it does not built and the output is:

bench\HLogo\Custom\Custom.hs:1:1:
    Dynamic linking required, but this is a non-standard build (eg. prof).
    You need to build the program twice: once the normal way, and then
    in the desired way using -osuf to set the object file suffix.

I tried googling on the error with no success. What can I do to
compile this file for profiling?

Cheers,
Nikos

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Nikolaos Bezirgiannis | 6 Apr 18:02 2013
Picon

Re: Error when building executable with profiling enabled


I switched to profiling through Cabal as you suggested, but now I have
the error:

bench\HLogo\Custom\Custom.hs:1:1:
    cannot find normal object file `dist\build\custom\custom-tmp\Framework\Keyword.o'
    while linking an interpreted expression

So, I removed managing the executables directly from Cabal
(--enable-executable-profiling) , and only enabled library profiling.  

Then I manually compiled each executable twice as:

ghc --make Custom.hs
ghc --make -prof -osuf p_o  Custom.hs

Profiling now works. Thank you.

Regards,
Nikos
Johannes Waldmann | 7 Apr 15:17 2013
Picon

Re: Error when building executable with profiling enabled

Krzysztof Skrzętnicki <gtener <at> gmail.com> writes:

> see this documentation on profiling with TH:
http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/template-haskell.html#id624714

"GHC cannot load the profiled object code 
and use it when executing the splices."

That means I do not get profiling information 
for the code that gets spliced in? 
Or for the code that is producing the splice?

What's the work-around for the first case?
(short of -ddump-splices, which seems somewhat problematic,
according to   http://hackage.haskell.org/trac/ghc/ticket/5016 )

- J.W.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane