You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.
When trying to build documentation for a library that uses Template Haskell (for example, traverse-with-class) with GHC HEAD, I get the following error:
$ cabal configure -w ~/bin/ghc-head/bin/ghc
Resolving dependencies...Configuringtraverse-with-class-0.1...$ cabal haddock --with-haddock ~/bin/ghc-head/bin/haddock RunningHaddock for traverse-with-class-0.1...Preprocessing library traverse-with-class-0.1...Haddock coverage:0% ( 0/2) in 'Data.Generics.Traversable.Core'100% ( 3/3) in 'Data.Generics.Traversable.TH'
dist/build/tmp-5360/Data/Generics/Traversable/Instances.hs:1:1:
cannot find normal object file ‛/tmp/.haddock-5369/Data/Generics/Traversable/Core.dyn_o’
while linking an interpreted expression
However, everything works fine with GHC 7.6.
The error is due to the fact that GHCi in GHC HEAD uses the system linker and so it requires the TH modules to be .dyn_o instead of .o (otherwise they can't be loaded because of the ABI mismatch). So the issue can be worked around by passing --optghc=-dynamic-too to cabal haddock:
$ cabal haddock --with-haddock ~/bin/ghc-head/bin/haddock --haddock-options="--optghc=-dynamic-too" RunningHaddock for traverse-with-class-0.1...Preprocessing library traverse-with-class-0.1...Haddock coverage:0% ( 0/2) in 'Data.Generics.Traversable.Core'100% ( 3/3) in 'Data.Generics.Traversable.TH'100% ( 1/1) in 'Data.Generics.Traversable.Instances'93% ( 13/14) in 'Data.Generics.Traversable'Documentation created: dist/doc/html/traverse-with-class/index.html
We can work around this in Cabal, but I think that the right place to fix this issue is Haddock itself (since it also happens when Haddock is run in standalone mode - i.e. not being driven by cabal haddock).
To do this, you should do the equivalent of parsing the output of ghc --info and invoking GHC with the -dynamic option (or -dynamic-too if it's supported) when the output contains a ("GHC Dynamic","YES") tuple. I'm not quite sure how to implement this using GHC API, but it should be possible.
The text was updated successfully, but these errors were encountered:
Original reporter: the.dead.shall.rise@
This was initially reported as a Cabal bug, but I'm now convinced that it's better to solve this issue on the Haddock side.
When trying to build documentation for a library that uses Template Haskell (for example,
traverse-with-class
) with GHC HEAD, I get the following error:However, everything works fine with GHC 7.6.
The error is due to the fact that GHCi in GHC HEAD uses the system linker and so it requires the TH modules to be
.dyn_o
instead of.o
(otherwise they can't be loaded because of the ABI mismatch). So the issue can be worked around by passing--optghc=-dynamic-too
tocabal haddock
:We can work around this in Cabal, but I think that the right place to fix this issue is Haddock itself (since it also happens when Haddock is run in standalone mode - i.e. not being driven by
cabal haddock
).To do this, you should do the equivalent of parsing the output of
ghc --info
and invoking GHC with the-dynamic
option (or-dynamic-too
if it's supported) when the output contains a("GHC Dynamic","YES")
tuple. I'm not quite sure how to implement this using GHC API, but it should be possible.The text was updated successfully, but these errors were encountered: