Circular dependency between the compiler and TH?

Joel Reymont joelr1 at gmail.com
Sat Aug 19 14:56:23 EDT 2006


On Aug 19, 2006, at 7:30 PM, Simon Peyton-Jones wrote:
> I can't tell just what you are doing, but somehow you seem to be
> building a stage-2 compiler in stage1.
>


Well, I'm on Mac Intel so I can only build ghc 6.5 using ghc 6.5. The  
one in /usr/local was built a few weeks ago and worked at the time.  
It's more than just the indices issue, this one can be solved by  
unpulling the patch.

There are other issues with TH.Syntax.pkgString which I don't have  
in /usr/local and there are issues with another bit of TH. I don't  
think I'm doing anything wrong. I think it's a stage1 compiler too.

/usr/local/bin/ghc -H16m -O  -istage1/utils  -istage1/basicTypes  - 
istage1/types  -istage1/hsSyn  -istage1/prelude  -istage1/rename  - 
istage1/typecheck  -istage1/deSugar  -istage1/coreSyn  -istage1/ 
specialise  -istage1/simplCore  -istage1/stranal  -istage1/stgSyn  - 
istage1/simplStg  -istage1/codeGen  -istage1/main  -istage1/ 
profiling  -istage1/parser  -istage1/cprAnalysis  -istage1/ 
ndpFlatten  -istage1/iface  -istage1/cmm  -istage1/nativeGen  - 
istage1/ghci -Istage1 -DGHCI -DBREAKPOINT -package template-haskell - 
threaded -package readline -DUSE_READLINE -cpp -fglasgow-exts -fno- 
generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -package  
unix -ignore-package lang -recomp -Rghc-timing  -H16M '-#include  
"cutils.h"' -i../compat -ignore-package Cabal    -c hsSyn/Convert.lhs  
-o stage1/hsSyn/Convert.o  -ohi stage1/hsSyn/Convert.hi
/usr/local/bin/ghc -H16m -O  -istage1/utils  -istage1/basicTypes  - 
istage1/types  -istage1/hsSyn  -istage1/prelude  -istage1/rename  - 
istage1/typecheck  -istage1/deSugar  -istage1/coreSyn  -istage1/ 
specialise  -istage1/simplCore  -istage1/stranal  -istage1/stgSyn  - 
istage1/simplStg  -istage1/codeGen  -istage1/main  -istage1/ 
profiling  -istage1/parser  -istage1/cprAnalysis  -istage1/ 
ndpFlatten  -istage1/iface  -istage1/cmm  -istage1/nativeGen  - 
istage1/ghci -Istage1 -DGHCI -DBREAKPOINT -package template-haskell - 
threaded -package readline -DUSE_READLINE -cpp -fglasgow-exts -fno- 
generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -package  
unix -ignore-package lang -recomp -Rghc-timing  -H16M '-#include  
"cutils.h"' -i../compat -ignore-package Cabal    -c typecheck/ 
TcMType.lhs -o stage1/typecheck/TcMType.o  -ohi stage1/typecheck/ 
TcMType.hi
/usr/local/bin/ghc -H16m -O  -istage1/utils  -istage1/basicTypes  - 
istage1/types  -istage1/hsSyn  -istage1/prelude  -istage1/rename  - 
istage1/typecheck  -istage1/deSugar  -istage1/coreSyn  -istage1/ 
specialise  -istage1/simplCore  -istage1/stranal  -istage1/stgSyn  - 
istage1/simplStg  -istage1/codeGen  -istage1/main  -istage1/ 
profiling  -istage1/parser  -istage1/cprAnalysis  -istage1/ 
ndpFlatten  -istage1/iface  -istage1/cmm  -istage1/nativeGen  - 
istage1/ghci -Istage1 -DGHCI -DBREAKPOINT -package template-haskell - 
threaded -package readline -DUSE_READLINE -cpp -fglasgow-exts -fno- 
generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -package  
unix -ignore-package lang -recomp -Rghc-timing  -H16M '-#include  
"cutils.h"' -i../compat -ignore-package Cabal    -c main/TidyPgm.lhs - 
o stage1/main/TidyPgm.o  -ohi stage1/main/TidyPgm.hi

hsSyn/Convert.lhs:625:32: Not in scope: `TH.pkgString'
<<ghc: 49771588 bytes, 8 GCs, 2578002/5045464 avg/max bytes residency  
(2 samples), 18M in use, 0.00 INIT (0.00 elapsed), 0.10 MUT (0.27  
elapsed), 0.08 GC (0.13 elapsed) :ghc>>

So I fix this line to use unpackPS instead of pkgString, after  
adjusting imports:

mk_pkg pkg = stringToPackageId (TH.pkgString pkg)

Now I get:

hsSyn/Convert.lhs:574:23:
     Constructor `NameG' should have 2 arguments, but has been given 3
     In the pattern: NameG th_ns pkg mod
     In the definition of `thRdrName':
         thRdrName ctxt_ns occ (NameG th_ns pkg mod)
                     = (mkOrig $! (mkModule (mk_pkg pkg) (mk_mod mod)))
                       $! (mk_occ (mk_ghc_ns th_ns) occ)


--
http://wagerlabs.com/







More information about the Glasgow-haskell-users mailing list