Bug 15212 - [4.8/4.9/5 Regression] bootstrap fails on interix3
Summary: [4.8/4.9/5 Regression] bootstrap fails on interix3
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 3.4.0
: P5 normal
Target Milestone: 4.8.5
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2004-04-29 20:32 UTC by Tristan Fillmore
Modified: 2015-03-03 13:34 UTC (History)
7 users (show)

See Also:
Host: i586-pc-interix3
Target: i586-pc-interix3
Build: i586-pc-interix3
Known to work:
Known to fail: 3.4.1, 4.0.0, 4.0.4
Last reconfirmed: 2006-02-05 15:46:16


Attachments
config.log from GCC 3.4.0 on interix3 (440 bytes, text/plain)
2004-04-29 20:53 UTC, Tristan Fillmore
Details
gcc/config.log from GCC 3.4.0 on interix3 (15.43 KB, text/plain)
2004-04-29 21:13 UTC, Tristan Fillmore
Details
patch (part 1 of 2) to fix this bug (559 bytes, patch)
2006-12-15 02:15 UTC, Martin Koeppe
Details | Diff
patch (part 2 of 2) to fix this bug (266 bytes, patch)
2006-12-15 02:44 UTC, Martin Koeppe
Details | Diff
GCC 4.2.0 on interix 3.5 (1.23 KB, patch)
2007-05-29 11:40 UTC, Markus Duft
Details | Diff
Fixed GCC 4.2.0 on interix 3.5 (1.22 KB, patch)
2007-05-29 12:13 UTC, Markus Duft
Details | Diff
Refreshed configuration that worked for me (3.54 KB, patch)
2007-06-12 02:53 UTC, Kaz Sasayama
Details | Diff
gcc 4.2.1 on interix 3.5 with shared libs (6.96 KB, patch)
2007-09-01 23:40 UTC, Martin Koeppe
Details | Diff
A proposed patch for bootstrapping GCC-4.2.2 on Interix 6 (8.67 KB, patch)
2007-11-10 14:58 UTC, Takuya OSHIMA
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Fillmore 2004-04-29 20:32:38 UTC
Build steps used:
-----------------
cd gcc-3.4.0/
mkdir obj-i586-pc-interix3
cd obj-i586-pc-interix3/
../configure --host=i586-pc-interix3
make bootstrap  (I am using GNU make)


Here's the last bit of the output:
----------------------------------
Bootstrapping the compiler
make[1]: Entering directory `/root/gcc-3.4.0/obj-i586-pc-interix3/gcc'
make CC="gcc" libdir=/usr/local/lib LANGUAGES="c " \
        CFLAGS="-g " MAKEINFO="/root/gcc-3.4.0/missing makeinfo
--split-size=5000000" \
        MAKEINFOFLAGS="--no-split" COVERAGE_FLAGS= \
        OBJS-onestep="alias.o bb-reorder.o bitmap.o builtins.o
caller-save.o calls.o cfg.o cfganal.o cfgbuild.o cfgcleanup.o
cfglayout.o cfgloop.o cfgloopanal.o cfgloopmanip.o loop-init.o
loop-unswitch.o loop-unroll.o cfgrtl.o combine.o conflict.o convert.o
coverage.o cse.o cselib.o dbxout.o debug.o df.o diagnostic.o dojump.o
doloop.o dominance.o dwarf2asm.o dwarf2out.o emit-rtl.o except.o
explow.o expmed.o expr.o final.o flow.o fold-const.o function.o gcse.o
genrtl.o ggc-common.o global.o graph.o gtype-desc.o haifa-sched.o
hooks.o ifcvt.o insn-attrtab.o insn-emit.o insn-modes.o insn-extract.o
insn-opinit.o insn-output.o insn-peep.o insn-recog.o integrate.o intl.o
jump.o  langhooks.o lcm.o lists.o local-alloc.o loop.o optabs.o
options.o opts.o params.o postreload.o predict.o print-rtl.o
print-tree.o value-prof.o profile.o ra.o ra-build.o ra-colorize.o
ra-debug.o ra-rewrite.o real.o recog.o reg-stack.o regclass.o regmove.o
regrename.o reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o
rtl-error.o sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o
sdbout.o sibcall.o simplify-rtx.o sreal.o stmt.o stor-layout.o
stringpool.o targhooks.o timevar.o toplev.o tracer.o tree.o tree-dump.o
unroll.o varasm.o varray.o version.o vmsdbgout.o xcoffout.o alloc-pool.o
et-forest.o cfghooks.o bt-load.o pretty-print.o ggc-page.o web.o i386.o
winnt.o host-default.o hashtable.o tree-inline.o tree-optimize.o
cgraph.o cgraphunit.o"make[2]: Entering directory
`/root/gcc-3.4.0/obj-i586-pc-interix3/gcc'
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
sh ../../gcc/mkconfig.sh config.h
TARGET_CPU_DEFAULT="" \
HEADERS="config/i386/i386.h config/i386/unix.h config/i386/bsd.h
config/i386/gas.h config/i386/i386-interix.h config/i386/i386-interix3.h
config/interix.h config/interix3.h defaults.h" DEFINES="" \
sh ../../gcc/mkconfig.sh tm.h
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
sh ../../gcc/mkconfig.sh bconfig.h
gcc -c -D__INTERIX -D_ALL_SOURCE  -g  -DIN_GCC   -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic
-Wno-long-long    -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I.
-I../../gcc -I../../gcc/. -I../../gcc/../include -I../intl
../../gcc/genmodes.c -o genmodes.o
In file included from ../../gcc/genmodes.c:23:
../../gcc/system.h:339: error: conflicting types for `strsignal'
/usr/include/string.h:100: error: previous declaration of `strsignal'
make[2]: *** [genmodes.o] Error 1
make[2]: Leaving directory `/root/gcc-3.4.0/obj-i586-pc-interix3/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/root/gcc-3.4.0/obj-i586-pc-interix3/gcc'
make: *** [bootstrap] Error 2
Comment 1 Andrew Pinski 2004-04-29 20:36:21 UTC
Can you attach the config.log?
Comment 2 Tristan Fillmore 2004-04-29 20:53:49 UTC
Created attachment 6190 [details]
config.log from GCC 3.4.0 on interix3

OK, here is the config.log.
Comment 3 Andrew Pinski 2004-04-29 20:56:34 UTC
The one from gcc subdirectory would help more.
Comment 4 Tristan Fillmore 2004-04-29 21:13:52 UTC
Created attachment 6191 [details]
gcc/config.log from GCC 3.4.0 on interix3

No problem.  Here is the config.log from the gcc subfolder.
Comment 5 Andrew Pinski 2004-04-29 21:27:42 UTC
For some reason the configure test for checking if strsignal is declared at all is failing.

configure:7790: gcc -c -g -O2 -I../../gcc -I../../gcc/../include  conftest.c >&5
configure: In function `main':
configure:7864: error: `strsignal' undeclared (first use in this function)
configure:7864: error: (Each undeclared identifier is reported only once
configure:7864: error: for each function it appears in.)
Comment 6 Tristan Fillmore 2004-04-29 21:57:35 UTC
(In reply to comment #5)
> For some reason the configure test for checking if strsignal is declared at
all is failing.
> 
> configure:7790: gcc -c -g -O2 -I../../gcc -I../../gcc/../include  conftest.c >&5
> configure: In function `main':
> configure:7864: error: `strsignal' undeclared (first use in this function)
> configure:7864: error: (Each undeclared identifier is reported only once
> configure:7864: error: for each function it appears in.)

Similar lines appear in the gcc/config.log from a GCC 3.3.3 build:

configure:4461: checking whether strsignal is declared
configure:4480: gcc -c -g -O2 -I../../gcc -I../../gcc/../include  conftest.c 1>&5
configure: In function `main':
configure:4475: error: `strsignal' undeclared (first use in this function)
configure:4475: error: (Each undeclared identifier is reported only once
configure:4475: error: for each function it appears in.)

However, 3.3.3 will successfully bootstrap.
Comment 7 Jim Wilson 2004-04-30 04:31:21 UTC
Subject: Re:  [3.4 Regression] bootstrap fails on interix3

pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-29 21:27 -------
> For some reason the configure test for checking if strsignal is declared at all is failing.

It looks like the problem is that the configure and build are done with 
different compiler options.  The configure is done with "gcc".  The 
build is done with "gcc -D__INTERIX -D_ALL_SOURCE".  This is not wise, 
as it means the configure checks will not be correct for the build.  You 
must use the same compiler (and compiler options) for configure and build.

Probably strsignal is in /usr/include/string.h, but only declared if one 
of __INTERIX or _ALL_SOURCE is defined.  Thus the configure check did 
not see it, but the build did.

gcc-3.4 behaves differently than gcc-3.3 here because the 
HAVE_DECL_STRSIGNAL stuff in system.h is new.  This adds a declaration 
if strsignal is present in libc, but we found no declaration in the 
header files at configure time, which is the case here.

This is a bug with the gcc/config/x-interix file.  It sets X_CFLAGS, 
which won't work, because this modifies the compiler flags after we have 
already configured.

I have no good immediate suggestion on how to fix this.  Maybe it can be 
hacked around in an xm-interix.h file by defining HAVE_DECL_STRSIGNAL. 
That is an ugly solution though.
Comment 8 Tristan Fillmore 2004-04-30 21:52:33 UTC
OK, well I can just do a 'export CFLAGS="-D_ALL_SOURCE"' before bootstrapping
and it seems that will be OK as a workaround.  However, now I've bumped into the
problem  with test_real_width which was described on the GCC maillist here:
http://gcc.gnu.org/ml/gcc/2004-04/msg01110.html

So I guess the next question is, how do I go about petitioning those patches be
integrated into the GCC source tree?
Comment 9 Jim Wilson 2004-05-01 04:02:54 UTC
Subject: Re:  [3.4 Regression] bootstrap fails on interix3

tfillmore at beatware dot com wrote:
> So I guess the next question is, how do I go about petitioning those patches be
> integrated into the GCC source tree?

The patches have to be submitted to gcc-patches.  Also, we need 
copyright assignments from the author(s) if the patches are non-trivial. 
  I see no actual patches in the thread you referred to, it just 
mentioned that patches were available from Microsoft.
Comment 10 Tristan Fillmore 2004-05-04 22:25:43 UTC
I've uploaded the patches here:
http://www.beatware.com/~tristan/Interix/interix-patches.tar.gz

There were actually two directories of patches in the Microsoft-supplied
tarball; I wasn't sure of the differences so I included both.

From the README file:
"all the code herein, and the sources that these apply
to, are subject to the GPL.  You should understand the obligations
it creates for you.  The patches herein have had the appropriate
releases signed and accepted by the FSF for them, and could be
included in the official gcc trees over time.  It is our hope that
that does happen.  Of course, consistent with the GPL, no warranty
of any form is expressed or implied.  Microsoft provides no support
for these instructions, the patches, or the binaries and is not
responsible for errors or omissions in them."
Comment 11 Mark Mitchell 2004-06-12 22:01:41 UTC
Postponed until 3.4.2; Interix is not a primary platform.
Comment 12 Mark Mitchell 2004-08-29 18:59:09 UTC
Postponed until GCC 3.4.3.
Comment 13 Mark Mitchell 2004-11-01 00:46:25 UTC
Postponed until GCC 3.4.4.
Comment 14 Nathanael C. Nerode 2004-12-02 03:10:32 UTC
I'm taking a look at this.  Since I don't have interix, I need help from the 
bug reporter. 
 
Could you try the following?  Replace the gcc/config/x-interix file with an 
empty file (or a file just containing comments), and try bootstrapping.  
Attach the log. 
 
Please try on mainline CVS if possible.  Thanks. 
Comment 15 Tristan Fillmore 2004-12-07 00:29:06 UTC
(In reply to comment #14)
> I'm taking a look at this.  Since I don't have interix, I need help from the 
> bug reporter. 

I've now set up an Interix system for the purpose of providing shell accounts. 
Anyone who would like access for testing/development of GCC should email me and
I'll create an account for them.
Comment 16 Andrew Pinski 2005-01-21 21:29:43 UTC
Removing target milestone per: <http://gcc.gnu.org/ml/gcc/2005-01/msg01255.html>.  This does 
not effect any of the primary or secondary targets.
Comment 17 Mark Mitchell 2005-08-22 01:35:36 UTC
Interix is not a primary or secondary platform; removing target milestone.
Comment 18 Mark Mitchell 2006-05-25 02:35:26 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 19 Nathanael C. Nerode 2006-05-26 18:34:45 UTC
I'm afraid I've become very busy and my priorities have changed; I'm not going to get this bug fixed.  Unassigning.
Comment 20 Martin Koeppe 2006-09-09 19:53:46 UTC
Hi all,

as being pointed from PR 28968 to this one, I now tested "make bootstrap" with several gcc versions on native Interix/SFU 3.5 on W2K-SP4. The bootstrap compiler is interix gcc 3.3.

In particular I tested
- gcc-3.3.6
- gcc-3.4.6
- gcc-4.0.3
- gcc-4.1.1
- gcc-4.2 (20060709, currently in Debian Linux)

All these 5 versions I configured with

$ ../src/configure \
        --enable-languages=c,c++ \
        --enable-threads=posix \
        --with-stabs \
        --enable-nls \
        --enable-shared \
        --disable-libssp \
        --with-gnu-as \
        --with-gnu-ld

$ gmake bootstrap

Results are as follows:

gcc-3.3.6:  bootstrap finished successfully, currently I did no further tests.
gcc-3.4.6:  as 3.3.6, no further tests either
gcc-4.0.3:  fails
gcc-4.1.1:  fails
gcc-4.2:    fails

failure details:

gcc-4.0.3:
==========
fails at gcc/c-parse.{c,y}

[...]
Bootstrapping the compiler
gmake[1]: Entering directory `/tmp/gcc-4.0/build/gcc'
gmake CC=" stage2/xgcc -Bstage2/ -B/usr/local/i586-pc-interix3/bin/" CC_FOR_BUILD=" stage2
         STAGE_PREFIX=stage2/ \
         ADAFLAGS="" CFLAGS="-g -O2" LDFLAGS="" WARN_CFLAGS="\$(GCC_WARN_CFLAGS)" STRICT_W
         CFLAGS="-g -O2" WERROR=""
gmake[2]: Entering directory `/tmp/gcc-4.0/build/gcc'
stage2/xgcc -Bstage2/ -B/usr/local/i586-pc-interix3/bin/ -c -D__INTERIX -D_ALL_SOURCE  -g
c-parse.c:2218:12: error: #if with no expression
c-parse.c:2328:20: error: #if with no expression
c-parse.c: In function 'yyparse':
c-parse.c:2534: error: 'yystacksize' undeclared (first use in this function)
c-parse.c:2534: error: (Each undeclared identifier is reported only once
c-parse.c:2534: error: for each function it appears in.)
c-parse.c:2538: warning: ISO C90 forbids mixed declarations and code
[...]
c-parse.y:2838: warning: implicit declaration of function 'OBJC_NEED_RAW_IDENTIFIER'
c-parse.y:2856: warning: 'return' with no value, in function returning non-void
c-parse.y:2860: warning: 'return' with no value, in function returning non-void
c-parse.y:2863: warning: 'return' with no value, in function returning non-void
c-parse.y:2881: error: syntax error before ')' token
c-parse.y:2884: warning: this function may return with or without a value
c-parse.y: In function 'yylex':
c-parse.y:2890: warning: statement with no effect
c-parse.y:2892: warning: statement with no effect
c-parse.y: In function 'yyprint':
c-parse.y:2913: warning: implicit declaration of function 'IDENTIFIER_POINTER'
c-parse.y:2914: warning: format '%s' expects type 'char *', but argument 3 has type 'int'
c-parse.y:2918: warning: format '%s' expects type 'char *', but argument 3 has type 'int'
c-parse.y:2922: error: syntax error before ',' token
In file included from c-parse.y:2963:
./gt-c-parse.h: At top level:
./gt-c-parse.h:30: error: syntax error before ',' token
./gt-c-parse.h:32: warning: missing initializer
./gt-c-parse.h:32: warning: (near initialization for 'gt_ggc_r_gt_c_parse_h[0].cb')
./gt-c-parse.h:37: error: 'gt_ggc_mx_tree_node' undeclared here (not in a function)
./gt-c-parse.h:39: error: 'gt_pch_nx_tree_node' undeclared here (not in a function)
./gt-c-parse.h:39: warning: missing initializer
./gt-c-parse.h:39: warning: (near initialization for 'gt_ggc_r_gt_c_parse_h[1].cb')
gmake[2]: *** [c-parse.o] Error 1
gmake[2]: Leaving directory `/tmp/gcc-4.0/build/gcc'
gmake[1]: *** [stage3_build] Error 2
gmake[1]: Leaving directory `/tmp/gcc-4.0/build/gcc'
gmake: *** [bootstrap] Error 2

I didn't have a closer look into it yet.
I use flex 2.5.4 and bison 2.1.

- cosmetic:  gcc/config/i386/host-cygwin.c is executable


gcc-4.1.1:
==========
- first PR 28968 is encountered, after working around this (sorry Andrew, I didn't yet implement the correct fix),

- it fails because $(SHELL) in the Makefile is set to "sh", and therefore the shell scripts for as and nm are generated in targets stamp-as and stamp-nm with header "#!sh". Those scripts seem not to be executable on interix, manually changing them to "#!/bin/sh" let's continue the build.

- after some time, it fails again. This time a process "collect2" is using 100% CPU (but only 1500KB) for ca. 50 minutes, then it suddenly stops without further information. Last output is:

gmake[2]: Entering directory `/tmp/gcc-4.1/build/gcc'
gawk -f ../../src/gcc/opt-gather.awk ../../src/gcc/c.opt ../../src/gcc/common.opt ../../src/gcc/config/i386/i386.opt > tmp-optionlist
sh ../../src/gcc/../move-if-change tmp-optionlist optionlist
optionlist is unchanged
echo timestamp > s-options
gawk -f ../../src/gcc/opt-functions.awk -f ../../src/gcc/opth-gen.awk \
       < optionlist > tmp-options.h
sh ../../src/gcc/../move-if-change tmp-options.h options.h
options.h is unchanged
echo timestamp > s-options-h
stage1/xgcc -Bstage1/ -B/usr/local/i586-pc-interix3/bin/ -c -D__INTERIX -D_ALL_SOURCE  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wmissing-format-attribute     -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../src/gcc -I../../src/gcc/build -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -D_ALL_SOURCE -I/usr/local/include  -I/usr/local/ssl/include   -o build/genmodes.o ../../src/gcc/genmodes.c
stage1/xgcc -Bstage1/ -B/usr/local/i586-pc-interix3/bin/ -c -D__INTERIX -D_ALL_SOURCE  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wmissing-format-attribute     -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../src/gcc -I../../src/gcc/build -I../../src/gcc/../include -I../../src/gcc/../libcpp/include  -D_ALL_SOURCE -I/usr/local/include  -I/usr/local/ssl/include   -o build/errors.o ../../src/gcc/errors.c
stage1/xgcc -Bstage1/ -B/usr/local/i586-pc-interix3/bin/ -D__INTERIX -D_ALL_SOURCE  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wmissing-format-attribute     -DHAVE_CONFIG_H -DGENERATOR_FILE  -o build/genmodes \
 build/genmodes.o build/errors.o ../build-i586-pc-interix3/libiberty/libiberty.a
[wait 50min]
gmake[2]: *** [build/genmodes] Error 1
gmake[2]: Leaving directory `/tmp/gcc-4.1/build/gcc'
gmake[1]: *** [stage2_build] Error 2
gmake[1]: Leaving directory `/tmp/gcc-4.1/build/gcc'
gmake: *** [bootstrap] Error 2

- cosmetic:  gcc/config/i386/{host-cygwin,winnt-cxx,winnt-stubs}.c are executable


gcc-4.2 (20060709):
===================
here, at the very beginning builddir/gcc/Makefile is not created. It says:
config.status: creating Makefile
sed: cannot allocate memory

It is the original interix version of sed. The machine used to build all the compilers has 2GB RAM, and during the builds, there is still over 1GB free.



If there is interest, I can do further tests on request.

Martin
Comment 21 Martin Koeppe 2006-09-10 20:14:42 UTC
(In reply to comment #20)

Update for gcc-4.2
==================

When installing GNU sed (I used 4.1.5) before configuring, the Makefile is created and building starts. "make bootstrap" nevertheless fails with:

[...]
Configuring stage 2 in ./intl
configure: creating cache ./config.cache
checking whether gmake sets $(MAKE)... yes
checking for a BSD-compatible install... /bin/install -c
checking whether NLS is requested... yes
checking for msgfmt... /usr/local/bin/msgfmt
checking for gmsgfmt... /usr/local/bin/msgfmt
checking for xgettext... /usr/local/bin/xgettext
checking for msgmerge... /usr/local/bin/msgmerge
checking for i586-pc-interix3.5-gcc...  /tmp/gcc-4.2/build/./prev-gcc/xgcc -B/tmp/gcc-4.2/build/./prev-gcc/ -B/usr/local/i586-pc-interix3.5/bin/
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
gmake[2]: *** [configure-stage2-intl] Error 77
gmake[2]: Leaving directory `/tmp/gcc-4.2/build'
gmake[1]: *** [stage2-bubble] Error 2
gmake[1]: Leaving directory `/tmp/gcc-4.2/build'
gmake: *** [bootstrap] Error 2

(For gcc-4.0.3 the new sed doesn't make any difference.)

Martin
Comment 22 Martin Koeppe 2006-09-14 10:12:18 UTC
(In reply to comment #21)

Update 2 for gcc-4.2
====================

I now successfully bootstrapped gcc-4.2-20060909, using native, i.e. ms-patched, binutils!

After applying some hotfixes to interix, fixing the shell script headers for as, nm, collect-ld, and disabling -Werror, "gmake bootstrap" now succeeded.

Interix hotfixes:
KB886655: ld
KB902074: libc.a, libc.so.3.5
KB917960: posix.exe, psxdll.dll, psxrun.exe, psxss.exe
You may refer to: http://www.duh.org/interix/hotfixes.php

Shell script issue:
While building in builddir/gcc there are 3 scripts generated:
as, nm, collect-ld. These have a wrong header. When gmake fails, you need to modify the first line "#!sh" -> "#!/bin/sh" and restart. Unfortunately I don't know where the right place for patching this is.
Interix apparently cannot execute scripts starting with "#!sh".

-Werror:
There are several of the following warnings emitted when building stage2 and higher:
warning: alignment of '[...]' is greater than maximum object file alignment.  Using 16
When gmake stopped, I removed -Werror in the Makefile and restarted.
Don't know what's really wrong here, either.

(The hotfixes didn't help for 4.0.3 or 4.1.1.)

Martin
Comment 23 Martin Koeppe 2006-12-04 00:17:56 UTC
(In reply to comment #22)
> Shell script issue:
> While building in builddir/gcc there are 3 scripts generated:
> as, nm, collect-ld. These have a wrong header. When gmake fails, you need to
> modify the first line "#!sh" -> "#!/bin/sh" and restart. Unfortunately I don't
> know where the right place for patching this is.
> Interix apparently cannot execute scripts starting with "#!sh".

I now found the source of this in config/mh-interix, which says SHELL=sh. At least on interix 3.5+ there is /bin/sh, so this line should be removed! It causes the build to fail, as "#!sh" scripts are now disabled for security reasons on interix.

Martin
Comment 24 Martin Koeppe 2006-12-15 02:15:54 UTC
Created attachment 12807 [details]
patch (part 1 of 2) to fix this bug

This patch is from PR 28968.
Comment 25 Martin Koeppe 2006-12-15 02:44:52 UTC
Created attachment 12808 [details]
patch (part 2 of 2) to fix this bug

This patch (mh-interix.diff) and the previous one (interix-winnt.diff) let me successfully "make bootstrap" gcc-4.2-20061212 on Win2K/Interix3.5, without manual intervention, with the following configuration and no environment variables such as CFLAGS set:

../src/configure \
        --enable-languages=c,c++ \
        --enable-threads=posix \
        --with-stabs \
        --disable-nls \
        --enable-shared \
        --disable-libssp \
        --with-gnu-as \
        --with-gnu-ld \
        --disable-werror \
	--program-suffix=-4.2

make bootstrap
Comment 26 Kaz Sasayama 2007-05-22 13:37:02 UTC
(In reply to comment #25)
> This patch (mh-interix.diff) and the previous one (interix-winnt.diff) let me
> successfully "make bootstrap" gcc-4.2-20061212 on Win2K/Interix3.5, without
> manual intervention, with the following configuration and no environment
> variables such as CFLAGS set:

Is it more better to add "-D_ALL_SOURCE" to STAGE1_CFLAGS too?  It can be defined in the toplevel configure script.
Comment 27 Markus Duft 2007-05-25 10:30:40 UTC
(In reply to comment #25)
> Created an attachment (id=12808) [edit]
> patch (part 2 of 2) to fix this bug
> This patch (mh-interix.diff) and the previous one (interix-winnt.diff) let me
> successfully "make bootstrap" gcc-4.2-20061212 on Win2K/Interix3.5, without
> manual intervention, with the following configuration and no environment
> variables such as CFLAGS set:
> ...

Have you managed to build libstdc++v3? it gives me *lots* of errors. i managed fixing a few (copying host_headers next to c++config.h for example, otherwise it wont find those files...), but now i'm stuck...
Comment 28 Martin Koeppe 2007-05-26 15:49:38 UTC
(In reply to comment #27) 
> Have you managed to build libstdc++v3? it gives me *lots* of errors. i managed
> fixing a few (copying host_headers next to c++config.h for example, otherwise
> it wont find those files...), but now i'm stuck...

I didn't do much C++ testing and didn't yet try 4.2.0 final, but for the libstdc++ I used the additional one-line hack described here:
http://www.interopsystems.com/tools/tm.aspx?m=7387&mpage=2#10788

Don't know how the correct patch should look like.
Comment 29 Markus Duft 2007-05-29 11:37:18 UTC
Hi everybody!

gcc 4.2.0 works fine on interix 3.5 using the native binutils (at least as and ld must be native...) with patch i will attach, and the following commands:

$ ../gcc-4.2.0/configure --enable-languages=c,c++ --enable-threads=posix --with-stabs --disable-nls --enable-shared --disable-libssp --with-gnu-as --with-gnu-ld --disable-werror --prefix=/testing/gcc/installed
$ gmake bootstrap
$ gmake install

i used GNU make, since the interix native make has some problems, but i don't know if gcc would build fine with the native one...

i applied the two interix patches attached here allready, and changed libstdc++v3 to not include -ffunction-sections, which breaks any C++ compiled program on interix, maybe somebody could change GCC to just ignore this flag on interix/windows?

have fun compiling...

Cheers, Markus
Comment 30 Markus Duft 2007-05-29 11:40:12 UTC
Created attachment 13625 [details]
GCC 4.2.0 on interix 3.5

The patch includes the two previous diffs posted here.
Comment 31 Markus Duft 2007-05-29 12:13:34 UTC
Created attachment 13626 [details]
Fixed GCC 4.2.0 on interix 3.5

The patch includes the two previous diffs posted here.

This is a fixed version, which also should work fine for cross compilers...
Comment 32 Kaz Sasayama 2007-06-01 12:24:39 UTC
If Bug 21706 is fixed, it can be built without defining _ALL_SOURCE even on Interix.
Comment 33 Markus Duft 2007-06-01 12:32:45 UTC
(In reply to comment #32)
> If Bug 21706 is fixed, it can be built without defining _ALL_SOURCE even on
> Interix.

are you sure? my experiences with interix tell me to almost allways enable _ALL_SOURCE, or not much will work.... ;o)
Comment 34 Kaz Sasayama 2007-06-01 15:39:33 UTC
(In reply to comment #33)
> (In reply to comment #32)
> > If Bug 21706 is fixed, it can be built without defining _ALL_SOURCE even on
> > Interix.
> 
> are you sure? my experiences with interix tell me to almost allways enable
> _ALL_SOURCE, or not much will work.... ;o)
> 

Sure, by not defining _ALL_SOURCE Interix headers hide non-standard NAMES from C programs, but GCC's build system can either find necessary functions from the C library or provide replacements.
Comment 35 Kaz Sasayama 2007-06-12 02:53:35 UTC
Created attachment 13684 [details]
Refreshed configuration that worked for me

I made a new Interix 3 configuration that bootstrapped C and C++ compilers for me without special configure parameters.  It may be missing or have meaningless options/settings for Interix, but I hope it can be a starting point.
Comment 36 Martin Koeppe 2007-09-01 23:40:46 UTC
Created attachment 14148 [details]
gcc 4.2.1 on interix 3.5 with shared libs

This patch adds building the gcc libs (libstdc++, libffi, ...) as shared. The fortran compiler can now also be built, and -fPIC, if supplied, is ignored now.
Comment 37 Takuya OSHIMA 2007-11-10 14:58:41 UTC
Created attachment 14524 [details]
A proposed patch for bootstrapping GCC-4.2.2 on Interix 6

The attached patch is to bootstrap GCC 4.2.2 on Interix 6.0, based on Martin's.
The compilers bootstrapped successfully with the following config.
../gcc-4.2.2/configure   --verbose \
    --prefix=/dev/fs/D/ohshima/OpenFOAM/interix/gcc-4.2.2 \
    --with-gmp=/dev/fs/D/ohshima/OpenFOAM/interix/gcc-4.2.2 \
    --with-mpfr=/dev/fs/D/ohshima/OpenFOAM/interix/gcc-4.2.2 \
    --enable-version-specific-runtime-libs --enable-threads=posix \
    --disable-win32-registry --disable-libssp --with-stabs \
    --enable-fully-dynamic-string --enable-shared \
    --enable-languages=c,c++,fortran

However the failure rates of the testsuites (make -f check), as indicated below, are considerably higher compared to other platforms. Moreover, the numbers of failures slightly vary across the test runs. I'd be grateful if anyone can look into and revise the patch.

		=== g++ Summary ===

# of expected passes		12703
# of unexpected failures	67
# of unexpected successes	2
# of expected failures		65
# of unresolved testcases	42
# of untested testcases		30
# of unsupported tests		150

		=== gcc Summary ===

# of expected passes		40371
# of unexpected failures	525
# of unexpected successes	1
# of expected failures		109
# of unresolved testcases	2
# of untested testcases		245
# of unsupported tests		405

		=== gfortran Summary ===

# of expected passes		14296
# of unexpected failures	1484
# of expected failures		5
# of unsupported tests		80

		=== libstdc++ Summary ===

# of expected passes		2936
# of unexpected failures	84
# of expected failures		13
# of unsupported tests		158

With kind regards,
Takuya
Comment 38 Joseph S. Myers 2008-07-04 16:31:46 UTC
Closing 4.1 branch.
Comment 39 Joseph S. Myers 2009-03-31 16:18:54 UTC
Closing 4.2 branch.  Patches should be submitted following the instructions at:
http://gcc.gnu.org/contribute.html
Comment 40 Richard Biener 2009-08-04 12:26:01 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 41 Richard Biener 2010-05-22 18:10:01 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 42 Richard Biener 2011-06-27 12:14:44 UTC
4.3 branch is being closed, moving to 4.4.7 target.
Comment 43 Jakub Jelinek 2012-03-13 12:48:19 UTC
4.4 branch is being closed, moving to 4.5.4 target.
Comment 44 Steven Bosscher 2012-11-09 22:22:35 UTC
Douglas, could you, as the de facto interix maintainer, please have a 
look at the patches in comment #31, comment #36, and comment #37?
Comment 45 Jakub Jelinek 2013-04-12 15:17:08 UTC
GCC 4.6.4 has been released and the branch has been closed.
Comment 46 Richard Biener 2014-06-12 13:47:26 UTC
The 4.7 branch is being closed, moving target milestone to 4.8.4.
Comment 47 Jakub Jelinek 2014-12-19 13:36:50 UTC
GCC 4.8.4 has been released.
Comment 48 Kai Tietz 2015-03-03 13:34:09 UTC
The Interix target got obsoleted at 4.6 (see https://gcc.gnu.org/gcc-4.6/changes.html ).
Therefore I close this bug as WONTFIX.  If status for Interix changes in future, feel free to reopen this bug.