13

Let's suppose I have no the HsColour program installed and I install QuickCheck

$ cd /tmp/
$ cabal get QuickCheck
$ cd QuickCheck
$ cabal install
...
[ 1 of 15] Compiling Test.QuickCheck.Random 
...
[15 of 15] Compiling Test.QuickCheck
...
Installed QuickCheck-2.7.6

If I install QuickCheck again, it is not recompiled, that is, I don't see the lines

[ 1 of 15] Compiling Test.QuickCheck.Random 
...
[15 of 15] Compiling Test.QuickCheck

but if I install HsColour current version (1.20.3) and I install QuickCheck again, QuickCheck is recompiled.

QuickCheck is also recompiled if

  1. I install HsColour,
  2. I install QuickCheck,
  3. I removed the HsColour binary and
  4. I install QuickCheck.

I tested this behaviour with GHC 7.8.3, Cabal 1.20.0.2 and cabal-install 1.20.0.3, and the development versions of Cabal and cabal-install (using https://github.com/haskell/cabal/commit/5ef7d84bb25cc5d53ad124978922f2c96bedb7d4).

3
  • Strange. Do you have library-documentation turned on? Nov 7, 2014 at 6:38
  • No, I have no this option turned on.
    – asr
    Nov 7, 2014 at 12:39
  • I can duplicate this behaviour with "cabal install --disable-documentation" within a sandbox. Furthermore, I can also duplicate this with plain old "runhaskell Setup.lhs configure --user && runhaskell Setup.lhs" (so enabling/disabling documentation doesn't really come into it); my best guess is that because the configuration changes, it wants to re-build everything.
    – ivanm
    Nov 18, 2014 at 12:50

1 Answer 1

2
+50

I'm not an expert, but I believe cabal configures all build tools he is aware of and is able to find. When building, cabal generates cabal_macros.h file with a macro to test build tool version. If CPP extension is enabled, then the file is included everywhere, and everything is rebuilt on any change in cabal_macros.h.

3
  • Note: you're getting the bounty because you seem to have some clue and have made an effort, and I wouldn't want the bounty to go to waste. I have no idea if the answer is actually correct.
    – dfeuer
    Nov 18, 2014 at 18:04
  • One way to test: get the cabal-macros.h file, re-configure, diff the new vs old and see if replacing the new one with the old one still causes a rebuild.
    – ivanm
    Nov 19, 2014 at 3:05
  • @ivanm changing cabal-macros.h definitely triggers recompilation of modules with CPP enables. I see that every day (and I try to minimize CPP usage for that reason.) I'm not sure why cabal configures all build tools though. Probably there is a reason, but I don't know one.
    – Yuras
    Nov 19, 2014 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.