GCJ/MingW build entirely on Windows with no nasty hacks !! 8-)
John Murga
john@murga.org
Sat Jan 18 15:31:00 GMT 2003
Hi,
It turns out that all the build issues with Cygwin seem to be down
to the fact that the GCC Makefile requires some tools not found in
most Cygwin installations to compile successfully. Unfortunately it
doesn't complain when configuring, so finding this out was a process
of trial and error... and luck.
But anyway, what follows is a complete step by step process to
creating a MINGW cross compiler on Cygwin without having to use
ANY nasty hacks... the only additional patch is one that I also
have to apply to the Makefile when building under RH8...
I've written these instructions under the assumption that Windows
users would generally not know much UNIX. The whole process takes
under two hours on my Athlon 1.3gz with Windows 2000 and you have
to press return a couple of times to confirm that each step builds
correctly.
Thanks to Ranjit who documented the Linux cross compilation process
clearly enough for me understand, I've re-used some of his scripts.
A 6k file with the required scripts is attached to this message...
Anyway, here goes :
####################################################
Building a cross compiler for GCJ/MINGW under Cygwin
####################################################
Get Cygwin installed
####################
Run up the Cygwin "setup" installed and point it to an up-to-date mirror (I chose
mirror.averse.net). Select "unzip" from the "Archive" category and "patch" from the
"Utils" category, then open up the "Devel" category and make sure the following
packages are selected :
autoconf
automake
binutils
bison
byacc
flexx
gcc
libtool
make
mktemp
( I suspect these are not all required but on a fresh install of Cygwin
this is what finally worked for me )
Selecting these packages will also select the packages that these tools depend on,
so you should leave the other package selections on "default" unless you are
adding something.
You can now sit back and wait while it downloads 30Mb+ of Cygwin tools...
Once Cygwin has installed find the "cygwin.bat" file and place the following
line somewhere before the call to "bash" :
set CYGWIN=check_case:strict
Although this setting seems like a really good idea it does break things in normal
Cygwin use, however it works fine with all the stuff we are going to use now.
Create your build directory
###########################
Start Cygwin
Create a directory for your build
Copy the file attached to this message to this directory
unzip mingwPack.zip
Download the GCJ files
######################
http://sourceforge.net/project/showfiles.php?group_id=2435&release_id=38019
binutils-2.13.90-20021006-2-src.tar.gz
gcc-3.2-20020817-1.src.tar.gz
gcj-3.2-20021210-1.src.diff.gz
mingw-runtime-2.3.tar.gz
w32api-2.1.tar.gz
http://sourceforge.net/projects/mingwrep/
regex-0.12-20010123.zip
Get the GCJ source code for version 3.2 from any GCC mirror...
(I got mine from http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-3.2/)
gcc-java-3.2.tar.gz
Place all these files in the build directory you created earlier.
( If you download different versions to these you may have to edit
the envSetup.sh or buildGcj.sh scripts and it may not work anyway ).
Extract binutils, gcc & and gcj
###############################
Now go back into Cygwin and from your build directory do the following :
tar -zxvf binutils-2.13.90-20021006-2-src.tar.gz
tar -zxvf gcc-3.2-20020817-1.src.tar.gz
mv gcc-3.2-20020817-1 gcc-3.2
tar -zxvf gcc-java-3.2.tar.gz
Apply Ranjit's patches and my patch to the makefile
###################################################
Now the source folders are ready we can apply the patches :
gunzip gcj-3.2-20021210-1.src.diff.gz
cd gcc-3.2
patch -b -p0 < ../gcj-3.2-20021210-1.src.diff
patch -b -p0 < ../gcj-3.2-20021210-2.src.diff
cd ..
Do the build !
##############
./buildGcj.sh
This is a wrapper around slightly modified versions of
Rangit's scripts...
Test it
#######
Compile the "HelloWorld" example with :
xgcc/bin/mingw32-gcj --main=HelloWorld HelloWorld.java -o Hello
And then try running it from a DOS window (to ensure it doesn't pick
anything up from the Cygwin path.
I works beautifully...
Good luck !
Cheers
JohnM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mingwPack.zip
Type: application/x-zip-compressed
Size: 6389 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030118/c5ecf534/attachment.bin>
More information about the Java
mailing list