Opened 8 years ago

Closed 8 years ago

#5584 closed bug (fixed)

ghc -odir is incompatible with .hs-boot files for hierarchical modules

Reported by: georgevdd Owned by:
Priority: high Milestone: 7.4.1
Component: Compiler Version: 7.0.4
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Steps to reproduce

1) Adapt the example of how to compile mutually recursive modules so that the modules involved have hierarchical names:

File S/A.hs:

module S.A where
    import S.B( TB(..) )
    newtype TA = MkTA Int
    f :: TB -> TA
    f (MkTB x) = MkTA x

File S/A.hs-boot:

module S.A where
    newtype TA = MkTA Int

File S/B.hs:

module S.B where
    import {-# SOURCE #-} S.A( TA(..) )
    data TB = MkTB !Int
    g :: TA -> TB
    g (MkTA x) = MkTB x

2) Compile as the example suggests, but with -odir:

mkdir out
ghc -odir out -c S/A.hs-boot

Expected behaviour

GHC silently creates the directory out/S and then emits the file A.o-boot in that directory.

Observed behaviour

GHC produces the error message:

touch: cannot touch `out/S/A.o-boot': No such file or directory

Note: this happens with ghc --make as well.


Create the directory out/S beforehand.

Attachments (1)

fix-5584.patch (1.8 KB) - added by georgevdd 8 years ago.
Candidate fix for this bug.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by georgevdd

Attachment: fix-5584.patch added

Candidate fix for this bug.

comment:1 Changed 8 years ago by simonmar

Milestone: 7.4.1
Priority: normalhigh

comment:2 Changed 8 years ago by marlowsd@…

commit e7b42bd4925ce91999f070d74e137a6a0ff6e3e4

Author: Simon Marlow <>
Date:   Wed Nov 16 10:27:02 2011 +0000

    Create parent directories when touching the object file (#5584)

 compiler/main/DriverPipeline.hs |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

comment:3 Changed 8 years ago by simonmar

Resolution: fixed
Status: newclosed

Thanks for a great bug report!

Note: See TracTickets for help on using tickets.