Network.URI - MIN_VERSION_base problem, or finger-trouble?

Graham Klyne GK at ninebynine.org
Sat Dec 29 19:25:45 CET 2012


A couple of problems with Network.URI have been brought to my attention, so I 
thought I'd have a go at seeing if I could fix them.  It's been a while (years) 
since I used the Haskell toolchain in anger, so I'm a bit out of touch with how 
thinks are working now.

So far, I have:

1. Installed Haskell platform (64-bit version for MacOS).
2. Checked out the 'network' project from https://github.com/haskell/network
3. cabal install test-framework
4. cabal install test-framework-hunit
5. changed to the 'test' directory of the checked out 'network' project

Then when I try to run GHC, I get this error:
[[
conina:tests graham$ ghc -v -XDeriveDataTypeable ../Network/URI.hs uri001.hs
Glasgow Haskell Compiler, Version 7.4.2, stage 2 booted by GHC version 7.0.4
Using binary package database: 
/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/package.conf.d/package.cache
Using binary package database: 
/Users/graham/.ghc/x86_64-darwin-7.4.2/package.conf.d/package.cache
wired-in package ghc-prim mapped to 
ghc-prim-0.2.0.0-7d3c2c69a5e8257a04b2c679c40e2fa7
wired-in package integer-gmp mapped to 
integer-gmp-0.4.0.0-af3a28fdc4138858e0c7c5ecc2a64f43
wired-in package base mapped to base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to 
template-haskell-2.7.0.0-29110cc89a711d6ab3e7ee0e0a8ee949
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: *../Network/URI.hs,*uri001.hs
Created temporary directory: /tmp/ghc65140_0
*** C pre-processor:
'/usr/bin/gcc' '-E' '-undef' '-traditional' '-m64' '-fno-stack-protector' '-m64' 
'-I' 
'/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/base-4.5.1.0/include' 
'-I' 
'/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/include' 
'-D__GLASGOW_HASKELL__=704' '-Ddarwin_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' 
'-Ddarwin_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' '-U __PIC__' '-D__PIC__' '-x' 'c' 
'../Network/URI.hs' '-o' '/tmp/ghc65140_0/ghc65140_0.hscpp'

../Network/URI.hs:135:0:
      error: missing binary operator before token "("
*** Deleting temp files:
Deleting: /tmp/ghc65140_0/ghc65140_0.hscpp
Warning: deleting non-existent /tmp/ghc65140_0/ghc65140_0.hscpp
*** Deleting temp dirs:
Deleting: /tmp/ghc65140_0
]]

The problem seems to be with the following lines in URI.hs (starting at line 135):
[[
# if MIN_VERSION_base(4,0,0)
import Data.Data (Data)
# else
import Data.Generics (Data)
# endif
]]

If I remove these lines, and just leave
[[
import Data.Generics (Data)
]]

I can compile and run the test suite just fine:
[[
          Test Cases    Total
  Passed  319           319
  Failed  0             0
  Total   319           319
]]

I'm _guessing_ the problem here is something to do with 
"MIN_VERSION_base(4,0,0)" - not being familiar with the current build 
environment setup, I'm not sure where it is or should be defined, or what it is 
intended to mean.

I did find these:
  * http://www.haskell.org/pipermail/haskell-cafe/2012-August/102787.html
  * http://stackoverflow.com/questions/8961413/zlib-build-error-with-ghc
but they didn't help me.

It seems there's a fix that involves using __GLASGOW_HASKELL__ instead of 
MIN_VERSION_base(4,0,0), but I'm not sure exactly how that would play out - or 
indeed if that's the correct approach for a permanent fix.

Is there something else I should be doing to set up the development and test 
environment for this library module?

Thanks for any pointers.

#g
--




More information about the Libraries mailing list