On Wed, Jul 16, 2008 at 04:24:08PM +0200, Jost Berthold wrote:
> 
> > I can't reproduce this. The ghc path that I configure with is passed
> > through correctly for me:
> ...
> > hpc$ /home/ian/ghc/darcs/ghc/libraries/cabal-bin /usr/bin/ghc
> > /home/ian/ghc/darcs/ghc/libraries/bootstrapping.conf configure
> > --distpref=dist-bootstrapping --with-compiler=/usr/bin/ghc...
> 
> > hpc$ /usr/bin/hsc2hs --cc=/usr/bin/ghc --ld=/usr/bin/ghc ...
> 
> > Executing: /usr/bin/ghc -c -package-conf ...
> 
> OK, I see. You configured to use /usr/bin/ghc, and cabal-bin tells you it
> called this one.
> So at least, it is not *obvious* that something else, called plain "ghc",
> has been called. OTOH, let me object that with your standard
> configuration, calling just "ghc" will most likely end up calling
> /usr/bin/ghc (/usr/bin is a standard path entry). So this does not really
> prove there is no problem.

Ah, I see what's going on. Cabal calls hsc2hs with --cflag=--version to
find out if it is using ghc as its C compiler. At this point hsc2hs
hasn't been told what to use as a C compiler, so it defaults to trying
"ghc".

If "ghc" exists then the --version output looks like GHC, so Cabal
decides that hsc2hs is using GHC, and thus tells it to use the GHC that
it knows about (which is why it looked like it was getting passed
through correctly for me).

If ghc doesn't exist then the --version output doesn't look like GHC, so
Cabal doesn't tell it what to use as C compiler. hsc2hs thus keeps on
trying to use "ghc", which of course fails as it doesn't exist.

So, I think there are two ways forward. Either Cabal should always tell
hsc2hs to use GHC when it is building with GHC, or it should always tell
it to use gcc. But currently Cabal doesn't know where gcc is, and on
Windows we put it in the GHC install tree somewhere. GHC's build system
does know where gcc is, but that doesn't help much as we have
relocatable binary distributions.

I think that the best plan is:
* Cabal knows about cc as a program
* We pass --with-cc to Cabal when building GHC
* If --with-cc is not passed, Cabal tried to find it itself, including
  looking in the appropriate place relative to GHC on Windows
* Cabal tells hsc2hs to use the C compiler it has found

How does that sound, Duncan?


Thanks
Ian

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to