Ticket #5584 (closed bug: fixed)

Opened 19 months ago

Last modified 19 months ago

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 Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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.

Workaround

Create the directory out/S beforehand.

Attachments

fix-5584.patch Download (1.8 KB) - added by georgevdd 19 months ago.
Candidate fix for this bug.

Change History

Changed 19 months ago by georgevdd

Candidate fix for this bug.

Changed 19 months ago by simonmar

  • priority changed from normal to high
  • milestone set to 7.4.1

Changed 19 months ago by marlowsd@…

commit e7b42bd4925ce91999f070d74e137a6a0ff6e3e4

Author: Simon Marlow <marlowsd@gmail.com>
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(-)

Changed 19 months ago by simonmar

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

Thanks for a great bug report!

Note: See TracTickets for help on using tickets.