Ticket #135 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

haddock stomps on existing .o and .hi files, breaking package builds

Reported by: duncan Owned by:
Priority: major Milestone:
Version: 2.6.0 Keywords:


For packages using TemplateHaskell? haddock generates .o and .hi files. Unfortunately this overwrites existing files produced by the build system and breaks packages. This currently affects several packages that use TemplateHaskell? and Cabal.

Cabal can be modified to workaround this problem by telling haddock to use a separate directory for its temp files. A better solution would be for haddock to do this always and automatically. It should never overwrite the user's existing .o and .hi files. It is very surprising behaviour from a documentation tool. (Yes, I know the technical reasons why it does it at the moment, but it is still very surprising).

Related: comments in ticket #101.

Change History

Changed 7 years ago by simonmar

We worked around this in GHC:

Tue Jan 12 22:58:53 GMT 2010  Simon Marlow <marlowsd@gmail.com>
  * Do some recompilation avoidance in GHC.loadModule
  GHC.loadModule compiles a module after it has been parsed and
  typechecked explicity. If we are compiling to object code and there is
  a valid object file already on disk, then we can skip the compilation
  step. This is useful in Haddock, when processing a package that uses
  Template Haskell and hence needs actual compilation, and the package
  has already been compiled.
  As usual, the recomp avoidance can be disabled with -fforce-recomp.

So Haddock now doesn't overwrite the .o and .hi files if they are up to date. It would therefore be better if Cabal did not work around the problem by pointing Haddock at a separate directory, because then Haddock will rebuild everything.

We didn't pull this into the 6.12 branch, but maybe we should?

Changed 7 years ago by waern

  • status changed from new to closed
  • resolution set to fixed

I've fixed this in Haddock now as well:

Fri May 14 19:55:17 CEST 2010  David Waern <david.waern@gmail.com>
  * Re-direct compilation output to a temporary directory
  Also add a flag --no-tmp-comp-dir that can be used to get the old behavior of
  writing compilation files to GHC's output directory (default ".").

So the GHC build system should be able to use --no-tmp-comp-dir to pick up already created output files.


Changed 5 years ago by anonymous

  • milestone 2.7.0 deleted

Milestone 2.7.0 deleted

Note: See TracTickets for help on using tickets.