[GHC] #4829: build does not respect --with-gcc option
GHC
cvs-ghc at haskell.org
Fri Dec 10 03:50:06 CET 2010
#4829: build does not respect --with-gcc option
---------------------------------+------------------------------------------
Reporter: gwright | Owner:
Type: bug | Status: new
Priority: normal | Component: Build System
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Building GHC failed
---------------------------------+------------------------------------------
The build still does not respect the `--with-gcc` option, despite the
patches that closed #2966.
To reproduce on OS X: replace gcc, which is a symlink to the actual
compiler, with a symlink to a script that errors out:
{{{
#!/bin/bash
echo "Uh oh. You shouldn't be here!"
exit 1
}}}
Then run
{{{
gwright-macbook> ./configure --with-gcc=/usr/bin/gcc-4.2
gwright-macbook> make
}}}
where `/usr/bin/gcc-4.2` is the actual gcc binary.
The build fails with:
{{{
ghc-prim-0.2.0.0: cannot find libHSghc-prim-0.2.0.0.a on library path
(ignoring)
"inplace/bin/ghc-cabal" configure --with-
ghc="/Users/gwright/tmp/ghc-7-branch/ghc/inplace/bin/dummy-ghc" --with-
ghc-pkg="/Users/gwright/tmp/ghc-7-branch/ghc/inplace/bin/ghc-pkg" --with-
gcc="/usr/bin/gcc-4.2" --configure-option=--with-cc="/usr/bin/gcc-4.2"
--enable-library-profiling --enable-library-for-ghci --configure-
option=CFLAGS=" -m64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-
version-min=10.5 -fno-stack-protector " --configure-option=LDFLAGS=" -m64
-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 "
--configure-option=CPPFLAGS=" @CONF_CPP_OPTS_STAGE1@ " -- dist-install
libraries/integer-gmp
Configuring integer-gmp-0.2.0.2...
checking build system type... i386-apple-darwin10.5.0
checking host system type... i386-apple-darwin10.5.0
checking target system type... i386-apple-darwin10.5.0
checking for gcc... /usr/bin/gcc-4.2
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [libraries/integer-gmp/dist-install/package-data.mk] Error 77
make: *** [all] Error 2
}}}
From the `configure` output, we can see that sometimes the specified
compiler is found, but other times `/usr/bin/gcc` is picked off the
`PATH`, in violation of your mother's rule, "Don't put that in your mouth,
you don't know where it's been."
I've been able to get the build to complete with `/usr/bin/gcc` linked to
the above script by patching `aclocal.m4`, `compiler/Makefile.local` and
`rts/ghc.mk`, as well as passing
{{{
SRC_HC_OPTS += -pgmP /usr/bin/gcc-4.2 -optP-E -optP-undef -optP-
traditional
SRC_HC_OPTS += -pgma /usr/bin/gcc-4.2
SRC_HC_OPTS += -pgmc /usr/bin/gcc-4.2
SRC_HC_OPTS += -pgml /usr/bin/gcc-4.2
}}}
in build.mk.
What I've done is unlikely a minimal fix. If the `-pgmX` options
shouldn't be passed through `SRC_HC_OPTS`, I probably need to make a lot
of fiddly changes. On the other hand, if we do allow passing the `-pgmX`
options through `SRC_HC_OPTS`, we run into the problem in ticket #4821,
which is has a kludgy solution.
Should the `SRC_HC_OPTS` be left alone and the path to the compiler be
passed other ways?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4829>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list