Template Haskell does not respect -package and -hide constraints
|Reported by:||guest||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
(I am using 6.8.2-2ubuntu1, packaged for Ubuntu Hardy Heron, on amd64.)
Recently sjanssen added some patches to the Lambdabot darcs repository which replace a preprocessor, BotPP, with some Template Haskell. This seems to work well, however I ran into a problem with it - everytime TH was called, it would error out with a message about Bytestring 0.9.1.0.
This is far from the first time I've run into this problem, but it was not fixed by forcibly removing 0.9.1.0 & recompiling affected packages against bytestring 09.0.1!
After even more debugging, I finally figured it out:
The module TH was erroring out on has an 'import Text.Regex'. Text.Regex is installed by the regex-compat package. I had two regex-compats installed. regex-compat-0.91 was linked against bytestring0.9.0.1. regex-compat-0.92 was linked against (the removed) bytestring-0.9.1.0.
Now, normally Cabal detects that using 0.92 would lead to errors, and it selects 0.91, and it adds to the GHC options '-hide-all-package -package regex-compat-0.91', and everything compiles fine and the user is happy.
But! in this case, Template Haskell ignores the flags, and it uses the most recent regex-compat. And it is this that breaks the build. I ultimately resolved this issue by removing regex-compat-0.92 and reinstalling and linking it against 0.9.0.1, although I fear this may yet lead to bugs in the future.
Short summary: Cabal is smarter than TH and picks better package versions to compile against, and yet TH ignores Cabal's picks. This leads to unnecessary & difficult to figure out compile failures.
Change History (17)
comment:6 follow-up: ↓ 8 Changed 7 years ago by simonmar
- Component changed from Compiler to Template Haskell
comment:10 Changed 5 years ago by igloo
- Milestone changed from 6.12.3 to 6.14.1
- Priority changed from normal to low
comment:14 Changed 4 years ago by igloo
- Milestone changed from 7.4.1 to 7.6.1
- Priority changed from low to lowest