Now uploaded: gcc-3.3.1, with gnat, java, c++, fortran, objc and c

Gerrit P. Haase gp@familiehaase.de
Sun Aug 17 13:36:00 GMT 2003


Hallo,

gcc-3.3.1 binaries are uploaded: http://anfaenger.de/cygwin-1.5/gcc

(Note that the the source package is still uploading now, please fetch
the original 3.3.1 source package or the 3.3 source and 3.3-3.3.1.diff
from one of the original GCC mirrors -> http://gcc.gnu.org/mirrors.html


The README at this site:

GCC 3.3.1 for Cygwin >= 1.5.2
=============================

This is my private compiler which I run just for fun, don't use it,
build it yourself, that is the most fun;)

Enabled languages: c,c++,f77,objc,ada,java


What is here in this directory:
===============================

README
    This file

Binaries:

There is one big package which includes everything, executables 
are stripped:
    gcc-3.3.1-76.tar.bz2


There are also several packages with the different backends separated,
if you fetch all the small packages, you'll get the same as included
in the one big package (besides the binaries are not stripped here):

Core includes C compiler, is needed always:
    gcc-core-3.3.1-76.tar.bz2

Language backends:    
    gcc-ada-3.3.1-76.tar.bz2
    gcc-c++-3.3.1-76.tar.bz2
    gcc-f77-3.3.1-76.tar.bz2
    gcc-java-3.3.1-76.tar.bz2
    gcc-objc-3.3.1-76.tar.bz2



The source:

    gcc-3.3-src.tar.bz2
    gcc-3.3-3.3.1.diff.bz2

The diff is the original diff file fetched from one of the gcc mirrors,
applying it to gcc-3.3 will result in gcc-3.3.1.  But you may want to 
use one of the GCC mirrors to get the source from since this server
has *very* limited bandwidth -> http://gcc.gnu.org/mirrors.html

The patch against this source:
    gcc-3.3.1-76.patch.bz2

Cygwin GNAT binary package which I used to build Cygwin 1.5.2 GNAT
    gcc-ada-3.2.tar.bz2

This includes the C and the Ada backend and I think it cannot be used
to bootstrap gcc-3.3.1 (the Ada part is working, the C part not...) 
with Cygwin 1.5.2.  For details please see HOWTO below.


Build the source, quickstart:

  Unpack the source package
    tar xjf gcc-3.3-src.tar.bz2
  Unpack the diff
    bunzip2 gcc-3.3-3.3.1.diff.bz2
  Apply the diff
    cd gcc-3.3
    patch -p1<../gcc-3.3-3.3.1.diff
    cd ..
  Unpack the patch and rename the source directory
    mv gcc-3.3 gcc-3.3.1
    bunzip2 gcc-3.3.1-76.patch.bz2
    cd gcc-3.3.1
    patch -p1 <../gcc-3.3.1-76.patch
    cd ..


Run the four scripts in this order:
    gcc-conf.sh
    gcc-bootstrap.sh
    gcc-ada-bootstrap.sh
    gcc-inst.sh






HOWTO build GNAT for Cygwin 1.5.2 with David's GNAT

1.
Get a Cygwin ADA compiler gcc-3.2, built from David Billinghurst using 
a Win32 version here: http://www.geocities.com/billingd2002/gnat/, or 
the version I modified to fit in one package which installs into the 
correct path when extracted from root and where I renamed gcc.exe to 
gnatgcc.exe because I was not able to use this 'old' gcc-3.2 to compile 
gcc-3.3.1:

$ wget http://anfaenger.de/cygwin/gcc/gcc-ada-3.2.tar.bz2

This means you'll have two different GCC installations, one default
and one with ADA backend in /usr/local/gcc-3_2.


2.
Unpack the ADA package from your Cygwin root:

$ ( cd / ; tar xjf /path/gcc-ada-3.2.tar.bz2 )

it installs into /usr/local/gcc-3_2.

(Rename gcc.exe to gnatgcc.exe if you use David's original packages 
before removing files!)

Remove all from /usr/local/gcc-3_2/bin besides gnatbind.exe, 
gnatgcc.exe and gnatlink.exe.


3.
Add the /usr/local/gcc-3_2/bin directory to your PATH:

$ export PATH=/usr/local/gcc-3_2/bin:$PATH


4. 
Get GCC 3.3.1 sources: http://gcc.gnu.org/mirrors.html

Unpack it to /somewhere/you/like, change the location in the scripts 
below to match your local source path.


5.
Apply the Cygwin/Mingw32 patch (initial great work by Danny Smith,
slightly enhanced by Gerrit P. Haase):

$ wget http://anfaenger.de/cygwin-1.5/gcc/gcc-3.3.1-76.patch.bz2
$ bunzip2 /path/to/gcc-3.3.1-76.patch.bz2
$ ( cd gcc-3.3.1 ; patch -p1</path/to/gcc-3.3.1-76.patch )

Modified by me: 
- boehm-gc updated to 6.2
- '#include "tm.h"' in cygwin2.c removed
- problems when compiling libjava: gethostname() detection by configure
  fails, wrong detection of inet6 structures which are actually not yet
  implemented in Cygwin. Wrong pathseparator for bootclasspath problem.
- Problem with Ada Makefiles, gnatmake is used to generate docs during 
  the build before you have a working gnatmake, I removed this.  

  
6. 
Configure.

I use this script to configure:
===============================
#!/bin/sh

# modify to your needs
export builddir=/tmp/gcc/gcc-build
export gccsrc=/tmp/gcc/gcc-3.3.1
export inst=/tmp/gcc/inst

mkdir -p old/
mv ${builddir} old/
mv ${inst} old/
mkdir -m 777 -p ${builddir}
mkdir -m 777 -p ${inst}

cd ${builddir}

${gccsrc}/configure     \
        --with-gcc      \
        --with-gnu-ld   \
        --with-gnu-as   \
        --enable-languages=c,c++,f77,objc,ada,java \
        --enable-libgcj \
        --enable-threads=posix  \
        --with-system-zlib      \
        --disable-nls   \
        --without-included-gettext      \
        --enable-interpreter    \
        --disable-sjlj-exceptions \
        --disable-version-specific-runtime-libs \
        --disable-shared        \
        --enable-haifa  \
        --prefix=/usr   \
        --exec-prefix=/usr      \
        --sysconfdir=/etc       \
        --libdir=/usr/lib       \
        --libexecdir=/usr/sbin  \
        --disable-win32-registry        \
        --enable-java-gc=boehm  \
        --enable-hash-synchronization   \
        2>&1 | tee log.configure00

# Script end


Doublcheck that configure found the gnatgcc.exe.
Looks like this in the configure output:
...
checking for gnatbind... gnatbind
checking for compiler driver that understands Ada... gnatgcc
...

The --enable-hash-synchronization may be a problem, it is 
undefined in libjava's configure.host, but it gets overridden
by this configure flag, at least my Hello.java example below 
works with hash-synchronization enabled, if you get problems,
try to rebuild without this flag or tell me how to reproduce 
the problem and I'll build again with hash-syncronisation 
disabled.


7. 
Bootstrap.

I use this script to bootstrap:
===============================
#!/bin/sh
export builddir=/tmp/gcc/gcc-build
export gccsrc=/tmp/gcc/gcc-3.3.1
export inst=/tmp/gcc/inst

# This is needed, the manual says you need it if using a minimal
# Ada compiler which we are going to do here.
cd ${gccsrc}/gcc/ada
touch treeprs.ads [es]info.h nmake.ad[bs]

cd ${builddir}

# Want 8MB stack because the default on Cygwin
# with 2MB is too small.
make "CFLAGS=-O2" \
     "GCJFLAGS=-O2" \
     "LDFLAGS=-s -Wl,--stack=0x00800000" \
     bootstrap \
     2>&1 | tee ${builddir}/log.bootstrap00

# Script end

NOTE:
If the make ends with an error, don't start the same script 
again, this breaks the Ada build, some Ada objects will be 
recompiled which is superflous and also failed for me.  So if 
the build stocks, fix the problem and run 'cleanstrap' instead 
of 'bootstrap' to restart from scratch, or if the bootstrap 
already was finished, run 'quickstrap' instead of 'bootstrap', 
just change the target in the above script, or copy it to 
another script with another name and another target.


8.
Extra compile step after bootstrap for Ada lib and tools.

I use this script:
==================
#!/bin/sh
export builddir=/tmp/gcc/gcc-build
export gccsrc=/tmp/gcc/gcc-3.3.1
export inst=/tmp/gcc/inst

cd ${builddir}/gcc

make "CFLAGS=-O2" \
     "LDFLAGS=-s" \
     gnatlib_and_tools \
     2>&1 | tee ${builddir}/log.ada-bootstrap00

# Script end


9.
Install.

I use this script:
==================
#!/bin/sh
export builddir=/tmp/gcc/gcc-build
export gccsrc=/tmp/gcc/gcc-3.3.1
export inst=/tmp/gcc/inst

cd ${builddir}

make install prefix=${inst}/usr exec_prefix=${inst}/usr \
  bindir=${inst}/usr/bin libdir=${inst}/usr/lib \
  sysconfdir=${inst}/etc includedir=${inst}/usr/include \
  tooldir=${inst}/usr 2>&1 | tee log.install00

rm -f ${inst}/usr/info/dir

cd ${inst}
# I don't strip the binaries for now
# find . -name "*.exe" | xargs strip
tar -cjf gcc-3.3.1-76.tar.bz2 usr/

# Script end


10.
Use it.

$ ( cd / ; tar xjvf ${inst}/gcc-3.3.1-76.tar.bz2 )

#! /bin/sh
# ultra minimalistic compiler test gcc-3.3.1
set -x
# GNAT:
echo 'with Text_Io; use Text_Io;' > hello.adb
echo 'procedure hello is' >> hello.adb
echo 'begin' >> hello.adb
echo '  put ("Hello world!");' >> hello.adb
echo 'end hello;' >> hello.adb
/usr/bin/gnatmake hello
./hello
# GCJ:
echo 'public class Hello_j {' > Hello_j.java
echo 'public static void main(String[] args) {' >> Hello_j.java
echo '        System.out.println("Just another Java hacker,");' >> Hello_j.java
echo '        }' >> Hello_j.java
echo '}' >> Hello_j.java
/usr/bin/gcj --main=Hello_j Hello_j.java -o Hello_j
./Hello_j
# G++:
echo '#include<iostream>' > pointersize.cc
echo 'using namespace std;' >> pointersize.cc
echo '#define VOID_PTR void *' >> pointersize.cc
echo 'int main() {' >> pointersize.cc
echo '  cout << "__CYGWIN__ pointer size is: " << (int)sizeof(VOID_PTR) << "\n";' >> pointersize.cc
echo '}' >> pointersize.cc
/usr/bin/g++ -o pointersize pointersize.cc
./pointersize
# G77:
echo '       print *,"Hello world!"' > hello.f
echo '       end' >> hello.f
/usr/bin/g77 -o hello_f hello.f
./hello_f
# OBJC
echo '/*   hello.m' > hello.m
echo ' *   gcc -o hello hello.m -lobjc' >> hello.m
echo ' */' >> hello.m
echo 'main()' >> hello.m
echo '{' >> hello.m
echo '    printf("Hello World,\n");' >> hello.m
echo '}' >> hello.m
/usr/bin/gcc -o hello_o hello.m -lobjc
./hello_o
# C
echo '#include <stdio.h>' > hello.c
echo 'int main() {' >> hello.c
echo '  puts("hello, world");' >> hello.c
echo '  return 0;' >> hello.c
echo '}' >> hello.c
/usr/bin/gcc -o hello_c hello.c
./hello_c



Hurra, it works!

Now after it works for me(tm), you can also fetch the binary
of gcc-3.3.1 which was created during this README was written
to get an Ada compiler for Cygwin.

Fetch it here: http://anfaenger.de/cygwin-1.5/gcc/


Gerrit P. Haase, 2003-08-17, <gp at familiehaase dot de>
-- 
=^..^=


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list