Opened 5 years ago

Closed 5 years ago

#7027 closed bug (fixed)

Lots of unnecessary recompilation

Reported by: selinger Owned by:
Priority: normal Milestone: 7.4.2
Component: Compiler Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The release notes for 7.4 state:

"The recompilation checker now takes into account what flags were used when compiling. For example, if you first run ghc -c Foo.hs, and then ghc -DBAR -c Foo.hs, then GHC will now recompile Foo.hs."

This has some undesired side effects. For example, I have a project with over 100 source files. Sometimes I like to try a different main function with -main-is, just for testing. This worked fine with 7.2, but ghc 7.4, in this situation, recompiles the whole world - including the 99 source files that are unaffected by this option.

Since this new behavior involves a - sometimes substantial - tradeoff between safety and efficiency, can there please be a command line option to turn it off? At least until someone figures out a way to do it smartly.

To reproduce: recompile any already compiled multi-module program with -main-is. Thanks, -- Peter

Change History (3)

comment:1 Changed 5 years ago by selinger

There is also a related problem regarding -i options. For example, I have a general-purpose module in a directory /tmp/foo/, and I compile it there:

cd /tmp/foo/; ghc Module1.hs

I have another module in a directory /tmp/bar/, and it imports Module1, so I compile it with:

cd /tmp/bar/; ghc -i../foo Module2.hs

At this point, GHC 7.2.2 did the correct thing, namely compiled only Module2 and linked it against the already-compiled Module1.

GHC 7.4, on the other hand, will recompile both modules. Presumably this is because the -i option has changed. But this is absurd! One of the purposes of -i options is precisely to be able to link against modules not rooted in the current directory. Re-compiling them each time defeats this purpose. In my opinion, this rises to the level of a bug, not just a badly thought out feature.

comment:2 Changed 5 years ago by simonmar

difficulty: Unknown

Could you clarify exactly which version of GHC you're using? We made some improvements in 7.4.2 in this regard: see #5878 and c624d2857809f02b29b9089a9526387d4662cb81.

comment:3 Changed 5 years ago by simonmar

Milestone: 7.4.2
Resolution: fixed
Status: newclosed

In fact, I'm going to close this ticket as fixed in 7.4.2, since both the issues you mention (-main-is and -i) are both addressed. If you still find problems in 7.4.2, please re-open the ticket.

Note: See TracTickets for help on using tickets.