GHC 6.12 + zlib + Mac OS 10.6

Hello folks, Everything has been going beautifully with the latest versions of GHC 6.12, except that anything involving zlib dies at run-time. In ghci:
:m Codec.Compression.Zlib :m +Data.ByteString.Lazy.Char8 :s -XOverloadedStrings compress "hello"
*** Exception: user error (Codec.Compression.Zlib: incompatible zlib version) I'm running OS X 10.6 on a 64-bit machine. I've heard of folks running into this with GHC 6.10 on OS X 10.6, who got rid of it by removing mac-ports. I tried that and it didn't change anything. My mac-ports install should have all been universal binaries anyway. I imagine I'm somehow building against a 64-bit version of the zlib library, but I'm not sure at what step I'm supposed to do things different, or what precisely I'm supposed to do different. Thanks, Antoine

I think you installed zlib without proper flags to link with 32-bit
libraries. configuring with ./Setup configure
--with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' should do the tricks.
See also http://hackage.haskell.org/trac/ghc/ticket/3681.
HTH
-~nwn
On Sun, Nov 29, 2009 at 6:01 AM, Antoine Latter
Hello folks,
Everything has been going beautifully with the latest versions of GHC 6.12, except that anything involving zlib dies at run-time. In ghci:
:m Codec.Compression.Zlib :m +Data.ByteString.Lazy.Char8 :s -XOverloadedStrings compress "hello"
*** Exception: user error (Codec.Compression.Zlib: incompatible zlib version)
I'm running OS X 10.6 on a 64-bit machine.
I've heard of folks running into this with GHC 6.10 on OS X 10.6, who got rid of it by removing mac-ports. I tried that and it didn't change anything. My mac-ports install should have all been universal binaries anyway.
I imagine I'm somehow building against a 64-bit version of the zlib library, but I'm not sure at what step I'm supposed to do things different, or what precisely I'm supposed to do different.
Thanks, Antoine _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Sat, Nov 28, 2009 at 3:54 PM, Yusaku Hashimoto
I think you installed zlib without proper flags to link with 32-bit libraries. configuring with ./Setup configure --with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' should do the tricks.
See also http://hackage.haskell.org/trac/ghc/ticket/3681.
HTH -~nwn
The following worked like a charm: cabal install --hsc2hs-options='--cc-flag=-m32 --ld-flag=-m32' Thanks for the tip. Antoine

Antoine Latter
On Sat, Nov 28, 2009 at 3:54 PM, Yusaku Hashimoto
wrote: I think you installed zlib without proper flags to link with 32-bit libraries. configuring with ./Setup configure --with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' should do the tricks.
See also http://hackage.haskell.org/trac/ghc/ticket/3681.
HTH -~nwn
The following worked like a charm:
cabal install --hsc2hs-options='--cc-flag=-m32 --ld-flag=-m32'
You can also patch your hsc2hs wrapper to read:
...
exec /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/hsc2hs $tflag $HSC2HS_EXTRA --cflag="-m32" --lflag="-m32" ${1+"$@"} "$Iflag"
G
--
Gregory Collins

I had wrote last mail without verifications, so ./Setup configure
--hsc2hs-options='--cflag=-m32 --lflag=-m32' is correct.
But I'm glad to know you got working fine with zlib :)
~-nwn
On Sun, Nov 29, 2009 at 8:00 AM, Antoine Latter
On Sat, Nov 28, 2009 at 3:54 PM, Yusaku Hashimoto
wrote: I think you installed zlib without proper flags to link with 32-bit libraries. configuring with ./Setup configure --with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' should do the tricks.
See also http://hackage.haskell.org/trac/ghc/ticket/3681.
HTH -~nwn
The following worked like a charm:
cabal install --hsc2hs-options='--cc-flag=-m32 --ld-flag=-m32'
Thanks for the tip.
Antoine

Antoine Latter:
On Sat, Nov 28, 2009 at 3:54 PM, Yusaku Hashimoto
wrote: I think you installed zlib without proper flags to link with 32-bit libraries. configuring with ./Setup configure --with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' should do the tricks.
See also http://hackage.haskell.org/trac/ghc/ticket/3681.
HTH -~nwn
The following worked like a charm:
cabal install --hsc2hs-options='--cc-flag=-m32 --ld-flag=-m32'
Which version of 6.12 are you running? These options or manually patching the hsc2hs wrapper should not be necessary with 6.12 anymore. (They are only a temporary workaround to use the old 6.10 release on Snow Leopard.) Manuel

On Sun, Nov 29, 2009 at 9:08 PM, Manuel M T Chakravarty
Which version of 6.12 are you running? These options or manually patching the hsc2hs wrapper should not be necessary with 6.12 anymore. (They are only a temporary workaround to use the old 6.10 release on Snow Leopard.)
Manuel
I built it within the past few days, I'm not sure why the version number says 1120. $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.0.20091120 Installed from darcs via "configre --prefix=${HOME}/usr && make && make install" and such. Could an unpatched hsc2hs wrapper have been left around by my old GHC 6.10 installation? Antoine

This was reproduced on rc2, too. I installed ghc-6.12 rc2 by the installer.
As the ticket I mentioned[1] says, The problem is the flags to build
32-bit binaries is not passed to the hsc2hs executable when the hsc2hs
wrapper get any --cc parameter. Cabal passes --cc parameter to the
wrapper to tell where gcc is. So when building a package with Cabal,
hsc2hs goes wrong.
[1]: http://hackage.haskell.org/trac/ghc/ticket/3681
--nwn
On Mon, Nov 30, 2009 at 1:49 PM, Antoine Latter
On Sun, Nov 29, 2009 at 9:08 PM, Manuel M T Chakravarty
wrote: Which version of 6.12 are you running? These options or manually patching the hsc2hs wrapper should not be necessary with 6.12 anymore. (They are only a temporary workaround to use the old 6.10 release on Snow Leopard.)
Manuel
I built it within the past few days, I'm not sure why the version number says 1120.
$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.0.20091120
Installed from darcs via "configre --prefix=${HOME}/usr && make && make install" and such.
Could an unpatched hsc2hs wrapper have been left around by my old GHC 6.10 installation?
Antoine

Should this go in a FAQ? For GHC? Or for a particular architecture?
Simon
| -----Original Message-----
| From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-
| bounces@haskell.org] On Behalf Of Antoine Latter
| Sent: 28 November 2009 23:01
| To: Yusaku Hashimoto
| Cc: glasgow-haskell-users@haskell.org; Haskell Libraries
| Subject: Re: GHC 6.12 + zlib + Mac OS 10.6
|
| On Sat, Nov 28, 2009 at 3:54 PM, Yusaku Hashimoto

I think this is a problem for architectures in which can only build
32-bit binaries.
On such architectures, hsc2hs should ensure to work for 32-bit
binaries as possible. So I think hsc2hs wrapper should be fixed to
give the flags if gcc is used.
--nwn
On Mon, Nov 30, 2009 at 5:44 PM, Simon Peyton-Jones
Should this go in a FAQ? For GHC? Or for a particular architecture?
Simon
| -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users- | bounces@haskell.org] On Behalf Of Antoine Latter | Sent: 28 November 2009 23:01 | To: Yusaku Hashimoto | Cc: glasgow-haskell-users@haskell.org; Haskell Libraries | Subject: Re: GHC 6.12 + zlib + Mac OS 10.6 | | On Sat, Nov 28, 2009 at 3:54 PM, Yusaku Hashimoto
wrote: | > I think you installed zlib without proper flags to link with 32-bit | > libraries. configuring with ./Setup configure | > --with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' should do the tricks. | > | > See also http://hackage.haskell.org/trac/ghc/ticket/3681. | > | > HTH | > -~nwn | | The following worked like a charm: | | cabal install --hsc2hs-options='--cc-flag=-m32 --ld-flag=-m32' | | Thanks for the tip. | | Antoine | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Mon, 2009-11-30 at 08:44 +0000, Simon Peyton-Jones wrote:
Should this go in a FAQ? For GHC? Or for a particular architecture?
For ghc-6.10, yes. It'd should be a section "GHC on OSX 10.6 (Snow Leopard)" and should describe the changes required to the shell script wrappers of ghc and hsc2hs. It should also note that none of this is necessary for ghc-6.12+. For ghc-6.12, we should just fix ticket #3681. http://hackage.haskell.org/trac/ghc/ticket/3681 Duncan

| For ghc-6.12, we should just fix ticket #3681. OK, good. But who is "we"? Simon | -----Original Message----- | From: libraries-bounces@haskell.org [mailto:libraries-bounces@haskell.org] On Behalf | Of Duncan Coutts | Sent: 30 November 2009 10:41 | To: Simon Peyton-Jones | Cc: glasgow-haskell-users@haskell.org; Haskell Libraries | Subject: RE: GHC 6.12 + zlib + Mac OS 10.6 | | On Mon, 2009-11-30 at 08:44 +0000, Simon Peyton-Jones wrote: | > Should this go in a FAQ? For GHC? Or for a particular architecture? | | For ghc-6.10, yes. It'd should be a section "GHC on OSX 10.6 (Snow | Leopard)" and should describe the changes required to the shell script | wrappers of ghc and hsc2hs. It should also note that none of this is | necessary for ghc-6.12+. | | For ghc-6.12, we should just fix ticket #3681. | | http://hackage.haskell.org/trac/ghc/ticket/3681 | | | Duncan | | _______________________________________________ | Libraries mailing list | Libraries@haskell.org | http://www.haskell.org/mailman/listinfo/libraries

On Mon, 2009-11-30 at 12:20 +0000, Simon Peyton-Jones wrote:
| For ghc-6.12, we should just fix ticket #3681.
OK, good. But who is "we"?
I think the short-term fix is just to change the hsc2hs wrapper script. So that'd be Ian. Longer term we might want to do it differently to allow a single hsc2hs instance to be used to target either 32 or 64bit ABIs on the same platform. Duncan
participants (6)
-
Antoine Latter
-
Duncan Coutts
-
Gregory Collins
-
Manuel M T Chakravarty
-
Simon Peyton-Jones
-
Yusaku Hashimoto