HOWTO build GCC-2.95.2 on Cygb20.1 [Re: Newbie: problems building gcc 2.95.2]

Mumit Khan khan@NanoTech.Wisc.EDU
Tue Nov 23 20:30:00 GMT 1999


On Wed, 24 Nov 1999, Serge S. Spiridonoff wrote:

> I'm trying to build gcc under Windows NT but having troubles with it.
> 
> I've done the following things:
> 
> - installed Cygwin B20.1
> - installed the patch gcc-2.95.2-cygb20.tar.gz
> - downloaded and unpacked gcc-2.95.2.tar.bz2 to /usr/local/src/gcc-2.95.2
> - created /usr/local/build/gcc-2.95.2
> 
> scenario 1.
> 
> $ cd /usr/local/build/gcc-2.95.2
> $ bash /usr/local/src/gcc-2.95.2/configure -v i586-cygwin32
> 
> this works fine
> 
> $ make > make.log 2>&1
> 
> this fails with
> /usr/local/src/gcc-2.95.2/gcc/libgcc2.c:41: stdlib.h: No such file or
> directory
> /usr/local/src/gcc-2.95.2/gcc/libgcc2.c:42: unistd.h: No such file or
> directory

The trouble is due to the layout, and where the headers are. It's quite
to trivial to get it to work however, so read on.

> scenario 2.
> 
> install the gcc-2.95.2-x86-win32.diff patch first
> 
> in this case, configure fails with
> Configuring gcc...
> : not found

Yeah, the usual text/binary stuff, and possibly that you don't have
/bin/sh.

Here's what I do:

0. Apologies in advance for all the unintentional typos and accidental 
  omissions in the following recipe that may add hours of frustration 
  ;-)

1. Make mounts binary. You'll thank me someday (before anyone yells, 
  it's just for building gcc, otherwise the specs file won't work on 
  binary mounts). Also patching may have trouble (the trick is to
  use -l or --ignore-whitespace option to tell patch to ignore 
  whitespace).

2. Get gcc-2.95.2.tar.gz and unpack.
3. Get my patches and apply:
   
   $ cd /usr/local/src
   $ tar zxf /tmp/gcc-2.95.2.tar.gz
   $ cd /usr/local/src/gcc-2.95.2
   $ patch -p1 -s < /tmp/gcc-2.95.2-x86-win32.diff

4. The patching process screws up timestamps, and unless you have
  autoheader, and possibly a few other tools, you're in trouble. Fix
  the timestamps with the script. Cut out the section between 
  CUT FROM HERE and CUT TO HERE, put it into a file, and feed it
  bash from the toplevel gcc-2.95.2 directory.

================== CUT FROM HERE ...
#
#! /bin/sh
#

"Fixing local tree timestamps"
touch `find . -name configure -print`
touch `find texinfo -name Makefile.in -print`
touch `find texinfo -name \*.pot -print`
touch `find texinfo -name \*.gmo -print`
for f in gcc/c-parse.y \
	 gcc/c-parse.h \
	 gcc/c-parse.c \
	 gcc/cstamp-h.in \
	 gcc/c-gperf.h \
	 gcc/cexp.c \
	 gcc/cp/parse.c \
	 gcc/cp/parse.h \
	 gcc/objc/objc-parse.y \
	 gcc/objc/objc-parse.c \
	 gcc/java/parse.h \
	 gcc/java/parse.c \
	 gcc/java/parse-scan.c \
	 libf2c/libU77/stamp-h.in \
	 contrib/fixinc/fixincl.x \
	 contrib/fixinc/inclhack.sh \
	 contrib/fixinc/fixincl.sh \
	 gcc/fixinc/fixincl.x \
	 gcc/fixinc/inclhack.sh \
	 gcc/fixinc/fixincl.sh
do
	if [ -f $f ]; then
		touch $f
	fi
done

exit 0
#================== TO HERE 
    
   $ cd /usr/local/src/gcc-2.95.2
   $ bash /tmp/update_timestamps

   Even if you have autoheader, bison, flex, etc, installed, I still
   recommend fixing timestamps since life's easier this way.

5. Configure (NOTE the options, these are crucial).

   $ mkdir /usr/local/build/gcc-2.95.2
   $ cd /usr/local/build/gcc-2.95.2
   $ CONFIG_SHELL=bash bash /usr/local/src/gcc-2.95.2/configure \
     --prefix=/Cygnus/cygwin-b20 \
     --exec-prefix=/Cygnus/cygwin-b20/H-i586-cygwin32 \
     -v i586-cygwin32
   
   If your Cygwin b20.1 install root is something other than /Cygnus,
   use that instead (eg., //D/Cygnus if you installed to D: drive).

   These "interesting" prefix and exec-prefix are needed to make sure
   the compiler can find the standard includes and libraries, which
   are installed as "target" includes and headers instead of to the
   usual /usr/include and /usr/lib.

5. Build: Note that `make bootstrap' fails mysteriously depending on
   the winsup/cygwin dll version, so you're best off making the build,
   installing it, using that to make it again, and installing that 
   again. Poor man's bootstrap, and in fact, I believe that's how
   Cygnus does it. So just repeat the next two steps.
   
   $ make > make.log 2>&1

6. Install: If you want to install over the existing compiler, just run
   
   $ make install > install.log 2>&1

   If you want to install to a different place, which is what I do, pass
   prefix and exec_prefix variables to Make:

   $ make prefix=/usr/local/gcc-2.95.2 \
     exec_prefix=/usr/local/gcc-2.95.2/H-i586-cygwin32 \
     install > install.log 2>&1 
   
   The relative pathname changes will make things work just fine even
   if you install it elsewhere. These patches are finally in mainline
   GCC, thanks to Tom Tromey for finaly taking the time to put it
   together!

7. Repeat 5 and 6 after running `make clean' at least once to get a good
   build, and to make sure the compiler can bootstrap itself. If you've
   installed to a different place (6.b), then prepend that to PATH:
     
   $ export PATH=/usr/local/gcc-2.95.2/H-i586-cygwin32/bin:$PATH

   Go to 5.

> : not found
> : not found
> : not found
> : not found
> /usr/local/src/gcc-2.95.2/gcc/configure: 123: Syntax error: Bad for loop
> variable
> Configure in /Cygnus/usr/local/build/gcc-2.95.2/gcc failed, exiting.
> 
> 
> scenario 3.
> 
> I tried to not install the full patch (gcc-2.95.2-x86-win32.diff) but only
> relative-path and libgcc2 patches.

I recommend installing the whole thing. I don't "support" the individual
pieces -- think of those as for exposition only.

Regards,
Mumit



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list