Skip to content

ghc-cabal deadlocks

Trying to build an OS X installer is currently deadlocking when

inplace/bin/ghc-cabal install /Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925/ghc-stage2 /Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925/ghc-pkg /Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925 compiler stage2 /Users/ian/ghc/6.12-branch/val/dest /Users/ian/ghc/6.12-branch/val/inst /Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925 /Users/ian/ghc/6.12-branch/val/inst/share/doc/ghc/html/libraries

runs:

/Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925/ghc-pkg --global-conf /Users/ian/ghc/6.12-branch/val/dest/Users/ian/ghc/6.12-branch/val/inst/lib/ghc-6.12.0.20090925/package.conf.d --force update - --global

Linking ghc-cabal with -threaded fixes the problem. I believe the problem is that when we are using a DESTDIR we get a large amount of warnings (more than a buffer full) like:

ghc-6.12.0.20090925: file AsmCodeGen.hi is missing (ignoring)

so Cabal's Distribution.Simple.Utils.rawSystemStdin:

      _ <- forkIO $ do _ <- evaluate (length err); return ()
      _ <- forkIO $ do _ <- evaluate (length out); return ()

      -- push all the input
      hPutStr inh input
      hClose inh

      -- wait for the program to terminate
      exitcode <- waitForProcess pid
      unless (exitcode == ExitSuccess) (die err)

deadlocks unless it is compiled with -threaded, as the forked evaluate threads don't get a chance to run.

The simple fix is to link with -threaded, but I'm not sure that we want to assume that -threaded works - especially as it needs to work in the bootstrapping compiler.

Can we eliminate calls to this, and any other problematic, functions?

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Build System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information