Ticket #2014 (new merge)

Opened 5 months ago

Last modified 1 day ago

getLinkDeps panic

Reported by: fons Assigned to: igloo
Priority: high Milestone: 6.8.3
Component: Compiler Version: 6.8.2
Severity: blocker Keywords:
Cc: Difficulty: Unknown
Test Case: Architecture: Unknown
Operating System: Unknown

Description

I am working on a project which uses mutually recursive modules and Template Haskell. Since "ghc --make" does not seem to figure out the dependencies properly in this case (see bug #1012) I gave Cabal's make backend a try without luck (I'm stuck again).

The compilation results in:

/usr/local/bin/ghc -package-name ForSyDe-0.1 -hide-all-packages -i -idist/build/autogen -idist/build -isrc -Idist/build -odir dist/build -hidir dist/build -stubdir dist/build -package packedstring-0.1.0.0 -package base-3.0.1.0 -package regex-posix-0.72.0.2 -package mtl-1.1.0.0 -package pretty-1.0.0.0 -package template-haskell-2.2.0.0 -O -Wall -fno-warn-name-shadowing -fno-warn-orphans -idist/build  -c src/ForSyDe/Process/SynchProc.hs -o dist/build/ForSyDe/Process/SynchProc.o  -ohi dist/build/ForSyDe/Process/SynchProc.hi
Loading package base ... linking ... done.
Loading package pretty-1.0.0.0 ... linking ... done.
Loading package array-0.1.0.0 ... linking ... done.
Loading package packedstring-0.1.0.0 ... linking ... done.
Loading package containers-0.1.0.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package mtl-1.1.0.0 ... linking ... done.
Loading package bytestring-0.9.0.1 ... linking ... done.
Loading package regex-base-0.72.0.1 ... linking ... done.
Loading package regex-posix-0.72.0.2 ... linking ... done.
ghc-6.8.2: panic! (the 'impossible' happened)
  (GHC version 6.8.2 for i386-apple-darwin):
	getLinkDeps No iface for ForSyDe-0.1:ForSyDe.System.SysDef

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

make: *** [dist/build/ForSyDe/Process/SynchProc.o] Error 1

However, the interface file is available to ghc:

$ ls -l dist/build/ForSyDe/System/SysDef.hi
-rw-r--r--  1 fons  staff  2225  2 ene 18:13 dist/build/ForSyDe/System/SysDef.hi

Sorry, but I couldn't narrow down the problem. To reproduce it, simply download my library (http://homepage.mac.com/alfonso.acosta/.Public/ForSyDe.tgz ) and build using Cabal's make backend:

$ tar -xvzf ForSyDe.tgz; cd ForSyDe; ./Setup.hs configure; ./Setup.hs makefile; make

Curiously enough, building the library itself does not work but loading a test in ghci, works perfectly well and builds the whole library without problems:

$ cd ForSyDe/examples/ ; ghci -i../src ParAddFour.hs
GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
... (vompilation skipped)
Ok, modules loaded: ForSyDe, ParAddFour, ForSyDe.AbsentExt, Language.Haskell.TH.Lift, ForSyDe.Vector, ForSyDe.Backend, ForSyDe.Backend.Simulate, Language.Haskell.TH.TypeLib, ForSyDe.Process, ForSyDe.Process.ProcVal, ForSyDe.ForSyDeErr, ForSyDe.ForSyDeErr, ForSyDe.Netlist, ForSyDe.Process.ProcFun, ForSyDe.Process.ProcFun, Language.Haskell.TH.LiftInstances, ForSyDe.System, ForSyDe.System.SysDef, ForSyDe.System.SysDef, ForSyDe.OSharing, ForSyDe.OSharing.UDynamic, ForSyDe.System.SysFun, ForSyDe.Signal, ForSyDe.Netlist.Traverse, ForSyDe.System.Instantiate, ForSyDe.Process.SynchProc.
*ParAddFour> 

It is a major blocker for the project (I have been stuck for days). I hope you find appropiate that I tagged it as such.

Change History

02/16/08 09:49:17 changed by igloo

  • priority changed from normal to high.
  • milestone set to 6.8.3.

Thanks for the report; I can reproduce it.

02/18/08 03:07:09 changed by simonmar

Presumably it is possible to work around this by adding extra imports (see #1012), does that work?

(clearly there is a bug here, we just want to establish whether there is a workaround).

03/30/08 14:35:03 changed by igloo

I hit #2188 a lot while trying to make a minimal test case for this. Giving up for now.

05/13/08 05:56:55 changed by igloo

Here's a small testcase:

A.hs-boot:

module A where

A.hs:

module A where

B.hs:

module B where

import {-# SOURCE #-} A ()
import Language.Haskell.TH

expQ :: ExpQ
expQ = [| () |]

C.hs:

module C where

import B

foo :: a
foo = undefined
  where second = $( expQ )

Gives:

ghc -Wall -fglasgow-exts -fth -c A.hs-boot
ghc -Wall -fglasgow-exts -fth -c A.hs
ghc -Wall -fglasgow-exts -fth -c B.hs
ghc -Wall -fglasgow-exts -fth -c C.hs
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
ghc-6.9.20080511: panic! (the 'impossible' happened)
  (GHC version 6.9.20080511 for i386-unknown-linux):
        getLinkDeps No iface for main:A

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

05/16/08 04:26:44 changed by simonmar

  • owner set to igloo.
  • type changed from bug to merge.

To merge:

Thu May 15 06:45:15 PDT 2008  Simon Marlow <marlowsd@gmail.com>
  * FIX #2014: Template Haskell w/ mutually recursive modules