Template Haskell + Profiling

Hi I'm trying to build some modules that use TH with profiling enabled. The normal build works: $ ghc -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main [1 of 8] Compiling Text.XML.Expat.FormatCustom ( Text/XML/Expat/FormatCustom.hs, Text/XML/Expat/FormatCustom.o ) [2 of 8] Compiling DataStructures ( DataStructures.hs, DataStructures.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package syb ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package packedstring-0.1.0.1 ... linking ... done. Loading package containers-0.2.0.1 ... linking ... done. Loading package pretty-1.0.1.0 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package filepath-1.1.0.2 ... linking ... done. Loading package old-locale-1.0.0.1 ... linking ... done. Loading package old-time-1.0.0.2 ... linking ... done. Loading package unix-2.3.2.0 ... linking ... done. Loading package directory-1.0.0.3 ... linking ... done. Loading package process-1.0.1.1 ... linking ... done. Loading package random-1.0.0.1 ... linking ... done. Loading package derive-0.1.4 ... linking ... done. [3 of 8] Compiling Utils ( Utils.hs, Utils.o ) [4 of 8] Compiling Semantics.Pure ( Semantics/Pure.hs, Semantics/Pure.o ) [5 of 8] Compiling Database ( Database.hs, Database.o ) [6 of 8] Compiling XPathDSL ( XPathDSL.hs, XPathDSL.o ) [7 of 8] Compiling QueryParse ( QueryParse.hs, QueryParse.o ) [8 of 8] Compiling Main ( Main.hs, Main.o ) Linking Main ... But profiling one fails: $ ghc -prof -auto -auto-all -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main [1 of 8] Compiling Text.XML.Expat.FormatCustom ( Text/XML/Expat/FormatCustom.hs, Text/XML/Expat/FormatCustom.o ) [2 of 8] Compiling DataStructures ( DataStructures.hs, DataStructures.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. DataStructures.hs:1:0: 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. The error message is somewhat cryptic to me. Does anyone know how to perform profiling build when using TH? Regards Christopher Skrzętnicki

Do your profiling builds with "-osuf p_o -hisuf p_hi", and then run a non-profiling build first. This means that both sets of object/hi files are available which placates TH. Ganesh ________________________________ From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Krzysztof Skrzetnicki Sent: 24 April 2009 16:28 To: Haskell Cafe Subject: [Haskell-cafe] Template Haskell + Profiling Hi I'm trying to build some modules that use TH with profiling enabled. The normal build works: $ ghc -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main [1 of 8] Compiling Text.XML.Expat.FormatCustom ( Text/XML/Expat/FormatCustom.hs, Text/XML/Expat/FormatCustom.o ) [2 of 8] Compiling DataStructures ( DataStructures.hs, DataStructures.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package syb ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package packedstring-0.1.0.1 ... linking ... done. Loading package containers-0.2.0.1 ... linking ... done. Loading package pretty-1.0.1.0 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package filepath-1.1.0.2 ... linking ... done. Loading package old-locale-1.0.0.1 ... linking ... done. Loading package old-time-1.0.0.2 ... linking ... done. Loading package unix-2.3.2.0 ... linking ... done. Loading package directory-1.0.0.3 ... linking ... done. Loading package process-1.0.1.1 ... linking ... done. Loading package random-1.0.0.1 ... linking ... done. Loading package derive-0.1.4 ... linking ... done. [3 of 8] Compiling Utils ( Utils.hs, Utils.o ) [4 of 8] Compiling Semantics.Pure ( Semantics/Pure.hs, Semantics/Pure.o ) [5 of 8] Compiling Database ( Database.hs, Database.o ) [6 of 8] Compiling XPathDSL ( XPathDSL.hs, XPathDSL.o ) [7 of 8] Compiling QueryParse ( QueryParse.hs, QueryParse.o ) [8 of 8] Compiling Main ( Main.hs, Main.o ) Linking Main ... But profiling one fails: $ ghc -prof -auto -auto-all -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main [1 of 8] Compiling Text.XML.Expat.FormatCustom ( Text/XML/Expat/FormatCustom.hs, Text/XML/Expat/FormatCustom.o ) [2 of 8] Compiling DataStructures ( DataStructures.hs, DataStructures.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. DataStructures.hs:1:0: 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. The error message is somewhat cryptic to me. Does anyone know how to perform profiling build when using TH? Regards Christopher Skrzętnicki =============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ===============================================================================

Lame me, I found the answer here:
http://haskell.org/ghc/docs/6.10.2/html/users_guide/template-haskell.html
ghc -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main
ghc -osuf p_o -prof -auto -auto-all -fforce-recomp --make -cpp -O
-DXQUERY2_TEST Main
Regards
Christopher Skrzętnicki
2009/4/24 Krzysztof Skrzętnicki
Hi
I'm trying to build some modules that use TH with profiling enabled.
The normal build works:
$ ghc -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main [1 of 8] Compiling Text.XML.Expat.FormatCustom ( Text/XML/Expat/FormatCustom.hs, Text/XML/Expat/FormatCustom.o ) [2 of 8] Compiling DataStructures ( DataStructures.hs, DataStructures.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package syb ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package packedstring-0.1.0.1 ... linking ... done. Loading package containers-0.2.0.1 ... linking ... done. Loading package pretty-1.0.1.0 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package filepath-1.1.0.2 ... linking ... done. Loading package old-locale-1.0.0.1 ... linking ... done. Loading package old-time-1.0.0.2 ... linking ... done. Loading package unix-2.3.2.0 ... linking ... done. Loading package directory-1.0.0.3 ... linking ... done. Loading package process-1.0.1.1 ... linking ... done. Loading package random-1.0.0.1 ... linking ... done. Loading package derive-0.1.4 ... linking ... done. [3 of 8] Compiling Utils ( Utils.hs, Utils.o ) [4 of 8] Compiling Semantics.Pure ( Semantics/Pure.hs, Semantics/Pure.o ) [5 of 8] Compiling Database ( Database.hs, Database.o ) [6 of 8] Compiling XPathDSL ( XPathDSL.hs, XPathDSL.o ) [7 of 8] Compiling QueryParse ( QueryParse.hs, QueryParse.o ) [8 of 8] Compiling Main ( Main.hs, Main.o ) Linking Main ...
But profiling one fails:
$ ghc -prof -auto -auto-all -fforce-recomp --make -cpp -O -DXQUERY2_TEST Main [1 of 8] Compiling Text.XML.Expat.FormatCustom ( Text/XML/Expat/FormatCustom.hs, Text/XML/Expat/FormatCustom.o ) [2 of 8] Compiling DataStructures ( DataStructures.hs, DataStructures.o ) Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. DataStructures.hs:1:0: 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.
The error message is somewhat cryptic to me. Does anyone know how to perform profiling build when using TH?
Regards
Christopher Skrzętnicki
participants (2)
-
Krzysztof Skrzętnicki
-
Sittampalam, Ganesh