This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[HOWTO] Building GCC-2.95.2 for Cygwin v1.0 (as auxiliary compiler)


Folks who don't have Cygwin v1.0 (commercial) CD, please ignore this
message.

Below is a quick recipe on how to build gcc-2.95.2 on Cygwin v1.0 (CD
version), and install it as an auxiliary compiler (ie., not overwrite
your v1.0 supplied ones).

Apologies in advance for typos, mistakes, and omissions of key steps.
I tried it out on a Win98 machine, and it actually worked.

PREP:
=====

1. Make sure your mounts are binary. If not, chances are patch will
  complain and fail (step 3 below), *and* more importantly, your build 
  will create a specs file that will NOT work on binary mounted systems. 
  Please don't ask me how to turn your mounts binary -- search the 
  mailing list. See TEXT MOUNT note in step 3 below if you insist on
  keeping mounts text.

2. Get gcc-2.95.2 sources and unpack:
  
  ftp://egcs.cygnus.com/pub/egcs/releases/gcc-2.95.2/gcc-2.95.2.tar.gz

  $ cd /usr/local/src
  [ or pick some other place instead of /usr/local/src ]
  $ tar zxvf gcc-2.95.2.tar.gz

  See http://egcs.cygnus.com/mirrors.html for Mirror site closer
  to you. 

3. Get my patches and apply:

  ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/gcc-2.95.2/patches/gcc-2.95.2-x86-win32-patches.tar.gz

  $ cd /usr/local/src/gcc-2.95.2
  $ tar zxvf /tmp/gcc-2.95.2-x86-win32-patches.tar.gz
  [ this will create gcc-2.95.2-patches/gcc-2.95.2-x86-win32.diff among
    other files ]
  $ patch -p1 -s < gcc-2.95.2-patches/gcc-2.95.2-x86-win32.diff

  ** TEXT MOUNT NOTE:
  If your mounts are not binary, this step is likely to fail. If you insist 
  on text mounts, and can live with specs file (automatically generated 
  during build process) that will not work on binary mounted system, you
  can tell patch to ignore whitespace difference with the -l (the short,
  and not very intuitive, name for --ignore-whitespace) option.

  $ patch -l -p1 -s < gcc-2.95.2-patches/gcc-2.95.2-x86-win32.diff

4. Fix/update timestamps: One unfortunate side effect of patching a release
  is that the timestamps of auto-generated files are not maintained, and
  your build will fail if you don't have autoconf, autoheader, bison, etc
  tools. If you have those, you can skip this step; otherwise run the 
  following script:

    # ----------- 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 

  Save the script in a file, say /tmp/update_timestamps.sh, and run it in 
  the gcc-2.95.2 top-level directory:

  $ cd /usr/local/src/gcc-2.95.2
  $ bash /tmp/update_timestamps.sh

  following script:

CONFIGURE and BUILD:
====================

1. Configuring is *still* tricky in Cygwin v1.0 due to the file system
  layout. For those who may listening -- /usr/i686-cygwin/include and
  /usr/i686-cygwin/lib is not the place for system includes and
  libraries. It just doesn't make sense.

  DO NOT BUILD in the gcc source directory. Let's say you want to build
  in /tmp/gcc-2.95.2:

  $ mkdir /tmp/gcc-2.95.2
  $ cd /tmp/gcc-2.95.2
  $ /usr/local/src/gcc-2.95.2/configure --disable-win32-registry \
    --prefix=/usr i686-cygwin

  This will build all the languages -- c, c++, f77, objc, java, chill. You
  can pick the languages you want with --enable-languages=LIST option.

  $ /usr/local/src/gcc-2.95.2/configure --disable-win32-registry \
    --enable-languages=c,c++,f77,objc \
    --prefix=/usr i686-cygwin

  ***
  Please avoid any creative impulse you may have to to change the 
  --prefix=/usr and i686-cygwin options to something else. This is due 
  to the placement of Cygwin runtime headers and libraries in 
  /usr/i686-cygwin/include and /usr/i686-cygwin/lib.
  ***

  The --disable-win32-registry is there to avoid a conflict with GNAT,
  which adds a registry entry to add GCC_EXEC_PREFIX, and the result
  is that you end up running the wrong (and old) compiler and cpp and
  the result is a mess. 

2. Build:

   There are problems with `make bootstrap' on Cygwin, so just make
   and install, and then repeat the process to get a stage2 build.
   
   $ make

3. Install: Now, you definitely *DO NOT* want to run `make install' w/out
   changing the install location; otherwise this will write over part of
   your Cygwin v1.0 compilers! Let's say you want gcc-2.95.2 installed in
   /usr/local/gcc-2.95.2

   $ make prefix=/usr/local/gcc-2.95.2 install

4. Repeat the build and install process at least once to get a good
   build. 
     
   $ export /usr/local/gcc-2.95.2/bin:$PATH
   $ make clean
   $ make
   $ make prefix=/usr/local/gcc-2.95.2 install

   and maybe once more just for kicks.

   $ make clean
   $ make
   $ make prefix=/usr/local/gcc-2.95.2 install

And there you have it.

Regards,
Mumit


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]