[Haskell] cabal and ghcconfigure.h

Isaac Jones ijones at syntaxpolice.org
Mon Dec 5 22:31:04 EST 2005


"Robert" <robdockins at fastmail.fm> writes:

> On Dec 1, 2005, at 10:18 AM, Duncan Coutts wrote:
>> On Wed, 2005-11-30 at 22:48 -0500, Robert Dockins wrote:
>>> I've just run across a problem with my cabal build system -- I'm not yet sure
>>> if this is a cabal problem or a system configuration problem.

Is this a public darcs repository so I can try this out on my own?

(snip)

> $ runhaskell Setup.hs build -v
> Preprocessing library Cmm-0.1...
> /usr/bin/alex -g -o src/Language/Cmm/Parser/CmmLex.hs
> src/Language/Cmm/Parser/CmmLex.x
> /usr/bin/happy -agc -o src/Language/Cmm/Parser/CmmParser.hs
> src/Language/Cmm/Parser/CmmParser.y
> Preprocessing executables for Cmm-0.1...
> Building Cmm-0.1...
> /usr/bin/ghc -package-name Cmm -odir dist/build -hidir dist/build
> -hide-all-packages --make -i -isrc Language.Cmm.Frontend

It looks like you're not listing CPP as an extension, and therefore
Cabal is not doing anything whatsoever wrt cpp.  It's not adding the
-cpp argument to ghc, and it's not preprocessing the sources
beforehand...

(snip)
> Chasing modules from:
> Language.Cmm.Frontend,Language.Cmm.Datatypes,Language.Cmm.Parser,Language.Cmm.Lint,Language.Cmm.Messages,Language.Cmm.Messages.EN,Language.Cmm.Parser.CmmLex,Language.Cmm.Parser.CmmParser,Language.Cmm.Parser.PPrSyntax,Language.Cmm.Parser.Syntax,Language.Cmm.Parser.Tokens,Language.Cmm.Parser.ParseMonad,Language.Cmm.Parser.ParserUtils,Language.Cmm.Parser.LexUtils,Language.Cmm.Lint.SymbolTable,Language.Cmm.Lint.BuildTables,Language.Cmm.Lint.LintMonad,Language.Cmm.Lint.Typecheck,Language.Cmm.Lint.LintProc,Language.Cmm.Lint.LintConstants,Language.Cmm.Lint.LintTop
> src/Language/Cmm/Parser/CmmLex.hs:19: ghcconfig.h: No such file or
> directory

There's the error...

> The offending file has the same opening, which looks like:
> -------------------------------------------------------------------------------------
>
> {-# OPTIONS -fglasgow-exts -cpp #-}

So you are listing extensions in the source files rather than the
.cabal file, which should be OK (except that it's non-portable, of
course).  So cabal really shouldn't have anything to do with it.  So
it _should_ be all about how cabal is calling GHC... The question is,
if the cpp flag is getting to ghc, why isn't ghc itself looking for
the ghcconfig.h file?  Looks like the difference is here:

WORKING VERSION:
>  /opt/local/bin/ghc -package-name Cmm -odir dist/build/src -hidir
>dist/build/src --make -isrc Language.Cmm.Frontend Language.Cmm.Datatypes
 (...)

BROKEN VERSION:
>  /usr/bin/ghc -package-name Cmm -odir dist/build -hidir dist/build
>-hide-all-packages --make -i -isrc Language.Cmm.Frontend
 (...)

But either way, it seems to work for me on my simple test cases, so I
can't reproduce it with cabal-head (1.1.4) or 1.1.3.  Can you either
let me see your code or create a small test case that fails?

Another option is to try to construct a ghc command line which will
work on both machines.  If you paste the working version onto the
command line on the broken machine, does it still not work?

Same versions of alex?

BTW, does cpphs do anything with ghcconfig.h?  Should cabal be adding
that include path somewhere in the cases where it uses cpphs?


peace,

  isaac


More information about the Haskell mailing list