Skip to content

ghc-7.6.1 win64: internal error: R_X86_6 4_PC32: High bits are set in WSAGetLastError

While updating cabal-dev to build against ghc-7.6 and cabal 1.16, I got the following error during linking:

[ 8 of 19] Compiling Distribution.Dev.CabalInstall ( src\Distribution\Dev\CabalInstall.hs, dist\build\cabal-dev\cabal-dev-tmp\Distribution\Dev\CabalInstall.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.0 ... linking ... done.
Loading package zlib-0.5.4.0 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package Win32-2.3.0.0 ... linking ... done.
Loading package filepath-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package directory-1.2.0.0 ... linking ... done.
Loading package old-time-1.1.0.1 ... linking ... done.
Loading package tar-0.4.0.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package parsec-3.1.3 ... linking ... done.
Loading package network-2.4.0.1 ... linking ... ghc.exe: internal error: R_X86_64_PC32: High bits are set in 7fef1cec8ed for WSAGetLastError
    (GHC version 7.6.1 for x86_64_unknown_mingw32)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Failed to install cabal-dev-0.9.1
cabal.exe: Error: some packages failed to install:
cabal-dev-0.9.1 failed during the building phase. The exception was:
ExitFailure 255

At least on my system this is a reproducible crash. I'm using windows 7, 64bit with the 64bit GHC.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.1
$ cabal --version
cabal-install version 1.16.0
using version 1.16.0.1 of the Cabal library
$ cabal-dev --version
cabal-dev 0.9
built with Cabal 1.10.1.0

The command that causes the crash here is to simply run cabal-dev install on my locally modify source for cabal-dev:

The top commit in my local branch is:
commit 1a0cadb226b3a0ba65b762172e20e6d2033fc3a3
Merge: 0c5752b 6db5e32
Author: Jonathan Daugherty <jtd@galois.com>
Date:   Wed Jun 27 12:25:02 2012 -0700

    Merge pull request #61 from jonathanjouty/patch-1

    Minor typo in README.md

If you want to try reproducing this, my Git diff looks like this:

diff --git a/cabal-dev.cabal b/cabal-dev.cabal
index 5c25721..684591a 100644
--- a/cabal-dev.cabal
+++ b/cabal-dev.cabal
@@ -49,7 +49,7 @@ Bug-Reports:         http://github.com/creswick/cabal-dev/issues
 Copyright:           2010-2012 Galois, Inc.
 Category:            Development
 Build-type:          Custom
-Cabal-version:       >=1.6
+Cabal-version:       >=1.14
 Data-Files:
   admin/cabal-config.in,
   admin/00-index.tar
@@ -78,6 +78,7 @@ Executable cabal-dev
   Main-is: Main.hs
   GHC-Options: -Wall
   Extensions: TemplateHaskell
+  default-language: Haskell2010
 
   if flag(no-cabal-dev)
     Buildable: False
@@ -93,7 +94,7 @@ Executable cabal-dev
     -- avoid using it:
     if impl(ghc >= 6.12)
       Build-depends:
-        containers >= 0.3 && < 0.5
+        containers >= 0.3
 
     -- Require this specific version that came with GHC 6.10 because
     -- of packaging problems with containers-0.2
@@ -106,18 +107,18 @@ Executable cabal-dev
         containers == 0.1.0.2
 
     Build-depends:
-      bytestring >= 0.9 && < 0.10,
-      directory >= 1.0 && < 1.3,
-      filepath >= 1.1 && < 1.4,
-      Cabal >= 1.10.0.0 && < 1.15,
-      HTTP >= 4000.0.9 && < 4000.3,
-      mtl >= 1.1 && < 2.2,
-      network >= 2.2 && < 2.4,
-      pretty >= 1.0 && < 1.2,
-      process >= 1.0 && < 1.2,
-      tar >= 0.3 && < 0.4,
-      zlib >= 0.5 && < 0.6,
-      transformers >= 0.2 && < 0.4,
+      bytestring >= 0.9,
+      directory >= 1.0,
+      filepath >= 1.1,
+      Cabal >= 1.10.0.0,
+      HTTP >= 4000.0.9,
+      mtl >= 1.1,
+      network >= 2.2,
+      pretty >= 1.0,
+      process >= 1.0,
+      tar >= 0.3,
+      zlib >= 0.5,
+      transformers >= 0.2,
 
       -- Template haskell is special: the compiler will die if a
       -- version other than the one that is shipped with the compiler
@@ -126,7 +127,7 @@ Executable cabal-dev
       template-haskell
 
   if os(windows)
-     build-depends: Win32 >= 2.1  && < 2.3
+     build-depends: Win32 >= 2.1
 
   Build-tools:
     cabal >= 0.8.2
@@ -154,15 +155,17 @@ Executable ghc-pkg-6_8-compat
   Main-is: GhcPkgCompat.hs
   Build-Depends:
     base < 5,
-    Cabal >=1.2 && < 1.15
+    Cabal >=1.2
 
   GHC-Options: -Wall
   HS-Source-Dirs: src
+  default-language: Haskell2010
 
 Executable cabal-dev-test
   Main-is: RunTests.hs
   GHC-Options: -Wall
   HS-Source-Dirs: src, test
+  default-language: Haskell2010
   if flag(no-cabal-dev) || !flag(build-tests)
     Buildable: False
   else
@@ -174,17 +177,18 @@ Executable cabal-dev-test
         base >= 3 && < 4
 
     Build-depends:
-      MonadRandom >= 0.1 && < 0.2,
-      random >= 1 && < 1.1,
-      test-framework >= 0.3 && < 0.6,
+      MonadRandom >= 0.1,
+      random >= 1,
+      test-framework >= 0.3,
       test-framework-hunit >= 0.2,
-      HUnit >= 1.2 && <2
+      HUnit >= 1.2
 
   if os(windows)
-     build-depends: Win32 >= 2.1  && < 2.3
+     build-depends: Win32 >= 2.1
 
 
 Executable fake-ghc-cabal-dev
+  default-language: Haskell2010
   HS-Source-Dirs: src/
   Build-depends: base
   Main-is: FakeGhc.hs
diff --git a/src/Distribution/Dev/RewriteCabalConfig.hs b/src/Distribution/Dev/RewriteCabalConfig.hs
index d4ce0f6..e39bde4 100644
--- a/src/Distribution/Dev/RewriteCabalConfig.hs
+++ b/src/Distribution/Dev/RewriteCabalConfig.hs
@@ -18,6 +18,7 @@ module Distribution.Dev.RewriteCabalConfig
     )
 where
 
+import Control.Exception         ( catch, SomeException(SomeException) )
 import Control.Applicative       ( Applicative, pure, (<$>) )
 import Data.Maybe                ( fromMaybe )
 import Data.Traversable          ( traverse, Traversable )
@@ -39,7 +40,7 @@ readConfig s = case readFields s of
 -- XXX: we should avoid this lazy IO that leaks a file handle.
 readConfigF :: FilePath -> IO (Either String [Field])
 readConfigF fn =
-    (readConfig <$> readUTF8File fn) `catch` \e -> return $ Left $ show e
+    (readConfig <$> readUTF8File fn) `catch` \(SomeException e) -> return $ Left $ show e
 
 readConfigF_ :: FilePath -> IO [Field]
 readConfigF_ fn = either error id <$> readConfigF fn
Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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