Bug 28864 - bootstrapping fails when building from non-/bin/sh-compatible shell
Summary: bootstrapping fails when building from non-/bin/sh-compatible shell
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 3.4.6
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-27 18:44 UTC by Georg Schwarz
Modified: 2008-12-28 21:30 UTC (History)
3 users (show)

See Also:
Host: mips-sgi-irix5.3
Target: mips-sgi-irix5.3
Build: mips-sgi-irix5.3
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg Schwarz 2006-08-27 18:44:27 UTC
For bootstrapping gcc 3.4.6 I have configured it the follwing way:

env CONFIG_SHELL=/bin/ksh /usr/local/tmp/gcc-3.4.6/configure --prefix=/usr/local --with-ld=/usr/bin/ld --with-as=/usr/bin/as --enable-languages=c

Building (using GNU make) then ends up like this:

if [ -f specs.ready ] ; then \
                true; \
        else \
                echo timestamp > specs.ready; \
        fi
(MAKE="/usr/local/pkg/bin/gmake"; srcdir=`cd /usr/local/tmp/gcc-3.4.6/gcc/fixinc && ${PWDCMD-pwd}` ; \
        CC="cc"; CFLAGS="  -g -DIN_GCC     -DHAVE_CONFIG_H -DGENERATOR_FILE"; LDFLAGS=""; \
        WARN_CFLAGS=""; LIBERTY=`${PWDCMD-pwd}`/"../libiberty/libiberty.a"; \
        export MAKE srcdir CC CFLAGS LDFLAGS WARN_CFLAGS LIBERTY; \
        cd ./fixinc && \
        /bin/ksh ${srcdir}/mkfixinc.sh mips-sgi-irix5.3 mips-sgi-irix5.3)
constructing ../fixinc.sh for mips-sgi-irix5.3 to run on mips-sgi-irix5.3
/usr/local/pkg/bin/gmake TARGETS=oneprocess SHELL="/bin/tcsh" CC="cc" CFLAGS=" -g -DIN_GCC -DHAVE_CONFIG_H -DGENERATOR_FILE" LDFLAGS="" LIBERTY="/usr/local/tmp/b/gcc/../libiberty/libiberty.a" install-bin
gmake[2]: Entering directory `/usr/local/tmp/b/gcc/fixinc'
/bin/tcsh /usr/local/tmp/gcc-3.4.6/gcc/fixinc/genfixes machname.h
SHELL=/bin/sh: Command not found.
export: Command not found.
if: Expression Syntax.
gmake[2]: *** [machname.h] Error 1
gmake[2]: Leaving directory `/usr/local/tmp/b/gcc/fixinc'
gmake[1]: *** [fixinc.sh] Error 2
gmake[1]: Leaving directory `/usr/local/tmp/b/gcc'
gmake: *** [all-gcc] Error 2


The reason is found in gcc-3.4.6/gcc/fixinc/mkfixinc.sh which has:

defs="SHELL=\"$SHELL\" CC=\"$CC\" CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\" LIBERTY=\"$LIBERTY\""


SHELL in my case is the shell I started the build from, /bin/tcsh.
The script that gets called later on, gcc-3.4.6/gcc/fixinc/genfixes, assumes a /bin/sh-compatible shell though.

To work around the issue one can call GNU make with the SHELL set to /bin/sh or  /bin/ksh.
To fix this one might change "SHELL=\"$SHELL\" into "SHELL=\"$CONFIG_SHELL\" in gcc-3.4.6/gcc/fixinc/genfixes, assuming CONFIG_SHELL must necessarily be a /bin/sh-compatible shell.
Comment 1 Andrew Pinski 2006-08-27 18:50:13 UTC
Actually this is a bug in the make version you are using because a SHELL inside make should and will always be a sh-compatible shell.

Also this works for me as I use the tcsh as my shell.

One more question, since you are using 3.4.6, can you try 4.0.3 instead as 3.4.x is no longer being maintained?
Comment 2 Georg Schwarz 2006-08-27 19:04:42 UTC
Subject: Re:  bootstrapping fails when building from non-/bin/sh-compatible shell


Am 27.08.2006 um 20:50 schrieb pinskia at gcc dot gnu dot org:

>
>
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-08-27  
> 18:50 -------
> Actually this is a bug in the make version you are using because a  
> SHELL inside

it's GNU Make 3.81. Is this a known issue, or are you just assuming  
it's a bug?

> make should and will always be a sh-compatible shell.
>
> Also this works for me as I use the tcsh as my shell.

strange. I can easily reproduce the behavior I reported.

>
> One more question, since you are using 3.4.6, can you try 4.0.3  
> instead as
> 3.4.x is no longer being maintained?

I will, but I think there were some other issues that prevented me  
from boostrapping 4.X on IRIX 5.


Comment 3 Georg Schwarz 2006-09-03 14:25:51 UTC
Unfortunately gcc 4.X.X for MIPS now requires GNU binutils as. However this triggers gcc bug #16253 on IRIX 5.3, so neither gcc 4.0.3 nor gcc 4.1.1 compiles on IRIX 5.3.
Comment 4 David Brownlee 2006-09-20 22:27:44 UTC
Seeing the same issue with gcc 3.4.6 on NetBSD/i386 4.0_BETA using gmake 3.81 and SHELL=/bin/tcsh
Comment 5 Andrew Pinski 2008-12-28 21:30:24 UTC
SHELL is set by make which is always set to a semi borne compatible shell so the configuration of make is incorrect.