Ticket #3542 (closed bug: fixed)
ghc-cabal deadlocks
| Reported by: | igloo | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 6.12.1 |
| Component: | Build System | Version: | 6.10.4 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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?
