Generics compilation failure in combination with Data.Accessor deriving
When trying to compile (using my latest build: 6.11.20090722) a file with -XGenerics I get the following error:
"inplace/bin/ghc-stage2" -O -H64m -package-name clash-0.1 -hide-all-packages -i
-ilibraries/clash-lib/cλash/. -ilibraries/clash-lib/cλash/dist-install/build
-ilibraries/clash-lib/cλash/dist-install/build/autogen -Ilibraries/clash-lib/cλash/dist-install/build
-Ilibraries/clash-lib/cλash/dist-install/build/autogen -Ilibraries/clash-lib/cλash/.
-optP-include -optPlibraries/clash-lib/cλash/dist-install/build/autogen/cabal_macros.h
-package base-4.1.0.0 -package containers-0.2.0.1 -package data-accessor-0.2.1
-package data-accessor-template-0.2.1.1 -package filepath-1.1.0.1 -package ghc-6.11.20090722
-package haskell98-1.0.1.0 -package pretty-1.0.1.0 -package prettyclass-1.0.0.0 -package syb-0.1.0.0
-package template-haskell-2.4.0.0 -package transformers-0.1.4.0 -package vhdl-0.1 -O2 -XGenerics
-fno-warn-deprecated-flags -Wwarn -odir libraries/clash-lib/cλash/dist-install/build
-hidir libraries/clash-lib/cλash/dist-install/build -stubdir libraries/clash-lib/cλash/dist-install/build
-hisuf hi -osuf o -hcsuf hc -c libraries/clash-lib/cλash/./CLasH/VHDL/VHDLTypes.hs
-o libraries/clash-lib/cλash/dist-install/build/CLasH/VHDL/VHDLTypes.o
... Loading some packages etc etc. ...
/var/folders/wh/whtzeDfoGBCCu-65jmvmZU+++TI/-Tmp-/ghc58528_0/ghc58528_0.s:4565:0:
FATAL:Symbol _clashzm0zi1_CLasHziVHDLziVHDLTypes_zdgfromVHDLState_closure already defined.
gmake[1]: *** [libraries/clash-lib/cλash/dist-install/build/CLasH/VHDL/VHDLTypes.o] Error 1
gmake: *** [all] Error 2
Indeed, when I compile with -dcore-lint I get to see this:
*** Core Lint Errors: in result of Desugar ***
<no location info>:
Duplicate variables brought into scope
[[CLasH.VHDL.VHDLTypes.$gfromTypeState,
CLasH.VHDL.VHDLTypes.$gfromTypeState,
CLasH.VHDL.VHDLTypes.$gfromTypeState],
[CLasH.VHDL.VHDLTypes.$gtoTypeState,
CLasH.VHDL.VHDLTypes.$gtoTypeState,
CLasH.VHDL.VHDLTypes.$gtoTypeState],
[CLasH.VHDL.VHDLTypes.$gfromEntity,
CLasH.VHDL.VHDLTypes.$gfromEntity,
CLasH.VHDL.VHDLTypes.$gfromEntity],
[CLasH.VHDL.VHDLTypes.$gtoEntity, CLasH.VHDL.VHDLTypes.$gtoEntity,
CLasH.VHDL.VHDLTypes.$gtoEntity],
[CLasH.VHDL.VHDLTypes.$gfromOrdType,
CLasH.VHDL.VHDLTypes.$gfromOrdType,
CLasH.VHDL.VHDLTypes.$gfromOrdType],
[CLasH.VHDL.VHDLTypes.$gtoOrdType,
CLasH.VHDL.VHDLTypes.$gtoOrdType,
CLasH.VHDL.VHDLTypes.$gtoOrdType],
[CLasH.VHDL.VHDLTypes.$gfromHType,
CLasH.VHDL.VHDLTypes.$gfromHType,
CLasH.VHDL.VHDLTypes.$gfromHType],
[CLasH.VHDL.VHDLTypes.$gtoHType, CLasH.VHDL.VHDLTypes.$gtoHType,
CLasH.VHDL.VHDLTypes.$gtoHType],
[CLasH.VHDL.VHDLTypes.$gfromVHDLState,
CLasH.VHDL.VHDLTypes.$gfromVHDLState],
[CLasH.VHDL.VHDLTypes.$gtoVHDLState,
CLasH.VHDL.VHDLTypes.$gtoVHDLState]]
*** Offending Program ***
.. Many, Many lines of Core output ..
Note that when I compile without -XGenerics (but with -dcore-lint) I do not get any error.
I assume it has something to do with the following two lines in my sourcecode:
$( Data.Accessor.Template.deriveAccessors ''TypeState )
$( Data.Accessor.Template.deriveAccessors ''VHDLState )
As there are no errors when I remove those two TH splices (Sadly so, I need those accessors)
The implementation of Data.Accessor.Template.deriveAccessors can be found here (it's patched to work with version 2.4 of the template-haskell library): http://github.com/christiaanb/data-accessor/blob/988137e3cb152ff0c66ec97919069d765b3669c6/template/src/Data/Accessor/Template.hs
Maybe it's related to: #2456 (closed)
For me it's not such a big problem as I will just compile that file with the NoGenerics Language pragma. But I would still like to know what might be causing this bug.
Trac metadata
Trac field | Value |
---|---|
Version | 6.11 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |