libraries/binary does not compile with ghc-7.7

Hi all,
when bootstrapping with GHC-7.7 I get
HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Get.o
libraries/binary/src/Data/Binary/Get.hs:101:1: Warning:
The import of `GHC.Int' is redundant
except perhaps to import instances from `GHC.Int'
To import instances alone, use: import GHC.Int()
libraries/binary/src/Data/Binary/Get.hs:371:15: Warning:
In the use of `unsafeInterleaveST'
(imported from Control.Monad.ST):
Deprecated: "Please import from Control.Monad.ST.Unsafe instead;
This will be removed in the next release"
libraries/binary/src/Data/Binary/Get.hs:383:44: Warning:
In the use of `unsafeInterleaveST'
(imported from Control.Monad.ST):
Deprecated: "Please import from Control.Monad.ST.Unsafe instead;
This will be removed in the next release"
HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o
libraries/binary/src/Data/Binary/Builder/Base.hs:180:22:
Ambiguous occurrence `unsafePerformIO'
It could refer to either `Foreign.unsafePerformIO',
imported from `Foreign' at
libraries/binary/src/Data/Binary/Builder/Base.hs:69:1-14
or `System.IO.Unsafe.unsafePerformIO',
imported from `System.IO.Unsafe' at
libraries/binary/src/Data/Binary/Builder/Base.hs:71:1-23
(and originally defined in `GHC.IO')
make[1]: *** [libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o]
Error 1
I have two commits to fix this:
$ git show ded894cd6abb209406e2ce16361acbb7111774d0
commit ded894cd6abb209406e2ce16361acbb7111774d0
Author: Gabor Greif

OOPS, these are the wrong patches I included,
I have to go hunting for them...
Here they are:
$git show cb5d1d88bd338f96e044609c84d11a004d7147d8
commit cb5d1d88bd338f96e044609c84d11a004d7147d8
Author: Gabor Greif
Hi all,
when bootstrapping with GHC-7.7 I get
HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Get.o
libraries/binary/src/Data/Binary/Get.hs:101:1: Warning: The import of `GHC.Int' is redundant except perhaps to import instances from `GHC.Int' To import instances alone, use: import GHC.Int()
libraries/binary/src/Data/Binary/Get.hs:371:15: Warning: In the use of `unsafeInterleaveST' (imported from Control.Monad.ST): Deprecated: "Please import from Control.Monad.ST.Unsafe instead; This will be removed in the next release"
libraries/binary/src/Data/Binary/Get.hs:383:44: Warning: In the use of `unsafeInterleaveST' (imported from Control.Monad.ST): Deprecated: "Please import from Control.Monad.ST.Unsafe instead; This will be removed in the next release" HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o
libraries/binary/src/Data/Binary/Builder/Base.hs:180:22: Ambiguous occurrence `unsafePerformIO' It could refer to either `Foreign.unsafePerformIO', imported from `Foreign' at libraries/binary/src/Data/Binary/Builder/Base.hs:69:1-14 or `System.IO.Unsafe.unsafePerformIO', imported from `System.IO.Unsafe' at libraries/binary/src/Data/Binary/Builder/Base.hs:71:1-23 (and originally defined in `GHC.IO') make[1]: *** [libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o] Error 1
I have two commits to fix this:
$ git show ded894cd6abb209406e2ce16361acbb7111774d0 commit ded894cd6abb209406e2ce16361acbb7111774d0 Author: Gabor Greif
Date: Thu Oct 25 12:59:53 2012 +0200 fix import warnings
diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs index 7134217..eaba669 100644 --- a/src/Data/Binary/Get.hs +++ b/src/Data/Binary/Get.hs @@ -92,13 +92,13 @@ import Control.Applicative (Applicative(..)) import Foreign
-- used by splitAtST -import Control.Monad.ST +import Control.Monad.ST (ST, runST) +import Control.Monad.ST.Unsafe (unsafeInterleaveST) import Data.STRef
#if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) import GHC.Base import GHC.Word -import GHC.Int #endif
-- | The parse state
$ git show 9c8b00ab88b6b8b996e0725d242df9a225d4236e commit 9c8b00ab88b6b8b996e0725d242df9a225d4236e Author: Gabor Greif
Date: Thu Oct 25 13:39:28 2012 +0200 do not import unsafePerformIO from Foreign (eliminating warning)
diff --git a/src/Data/Binary/Builder/Base.hs b/src/Data/Binary/Builder/Base.hs index 8124f65..31b5115 100644 --- a/src/Data/Binary/Builder/Base.hs +++ b/src/Data/Binary/Builder/Base.hs @@ -67,6 +67,7 @@ import qualified Data.ByteString.Lazy as L import Data.Monoid import Data.Word import Foreign +import System.IO.Unsafe (unsafePerformIO)
#ifdef BYTESTRING_IN_BASE import Data.ByteString.Base (inlinePerformIO) @@ -174,7 +175,7 @@ data Buffer = Buffer {-# UNPACK #-} !(ForeignPtr Word8) -- the lazy 'L.ByteString' is demanded. -- toLazyByteString :: Builder -> L.ByteString -toLazyByteString m = unsafePerformIO $ do +toLazyByteString m = System.IO.Unsafe.unsafePerformIO $ do buf <- newBuffer defaultSize runBuilder (m `append` flush) (const (return L.Empty)) buf {-# INLINE toLazyByteString #-}
Okay to push to master?
Cheers,
Gabor

On Wed, Feb 20, 2013 at 04:57:25PM +0100, Gabor Greif wrote:
when bootstrapping with GHC-7.7 I get
Note that if you want to use HEAD to build HEAD, then the only supported version is the one that you are building (e.g. you can use today's HEAD to build today's HEAD, but not to build tomorrow's HEAD).
Okay to push to master?
As long as it would still build with 7.4, sure. But actually, GHC back at least as far as 7.4 shipped with binary, so I don't think we need to build it with the bootstrapping compiler any more. Does the build go through if you just remove binary from "PKGS_THAT_BUILD_WITH_STAGE0" in ghc.mk instead? Thanks Ian

On 2/20/13, Ian Lynagh
On Wed, Feb 20, 2013 at 04:57:25PM +0100, Gabor Greif wrote:
when bootstrapping with GHC-7.7 I get
Note that if you want to use HEAD to build HEAD, then the only supported version is the one that you are building (e.g. you can use today's HEAD to build today's HEAD, but not to build tomorrow's HEAD).
Hi Ian, this is interesting, I built with a week old 7.7, with today's one there was no error.
Okay to push to master?
As long as it would still build with 7.4, sure.
It does with ghc-7.4.2, so I pushed it to ghc-head. I think a submodule update is in order, which I'll try to perform and come bad whining if it does not work out :-) The second patch needs a rework, I get this with 7.4.2: HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o libraries/binary/src/Data/Binary/Builder/Base.hs:69:1: Warning: In the use of `unsafePerformIO' (imported from Foreign): Deprecated: "Use System.IO.Unsafe.unsafePerformIO instead; This function will be removed in the next release" So possibly a common fix for >=7.4 is possible. I try to come up with one.
But actually, GHC back at least as far as 7.4 shipped with binary, so I don't think we need to build it with the bootstrapping compiler any more. Does the build go through if you just remove binary from "PKGS_THAT_BUILD_WITH_STAGE0" in ghc.mk instead?
Yeah, looks like binary is not needed (tried with a HEAD bootstrap). Will confirm with ghc-7.4.2 and push when ok. Thanks for the tips, Gabor
Thanks Ian
participants (2)
-
Gabor Greif
-
Ian Lynagh