-fhpc assumes original sources relative to the current directory
For the most part, ghc can be invoked in a manner that is independent of the current directory by suitable use of -i options.
With -fhpc it appears that the hpc bits always look in the current directory to find original source files.
Consider the following file layout:
Codec/Compression/Zlib/Stream.hsc
dist/build/Codec/Compression/Zlib/Stream.hs
examples/gunzip.hs
Now if we cd to examples and run:
ghc --make gunzip.hs -lz -i../ -i../dist/build
then it works fine. It finds Codec/Compression/Zlib/Stream.hs in ../dist/build and it never bothers to look for the original source of course.
Now in -fhpc mode it has to also find the original sources so that it can match things back to them. However just adding -fhpc to the above command fails:
ghc --make gunzip.hs -lz -i../ -i../dist/build -fhpc
[1 of 4] Compiling Codec.Compression.Zlib.Stream ( ../dist/build/Codec/Compression/Zlib/Stream.hs, ../dist/build/Codec/Compression/Zlib/Stream.o )
Codec/Compression/Zlib/Stream.hsc: getModificationTime: does not exist (No such file or directory)
So it's clearly not looking in the directory given by -i.. for the original sources. Also, the failure mode is a bit unfriendly.
Cabal sometimes takes advantage of the fact that ghc can be invoked in a manner that is independent of the current directory, and we would like to add hpc support into Cabal.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |