Hi All,
GCC-4.4.0 has been released recently. I have managed to compile it as a MinGW build. I want to share that with others. The package can be downloaded from the following links. Please download both the files and extract them to C:\MinGW folder. Then extract Win32API, MinGW Runtime, pthreads-win (If you want to use OpenMP) package to the same folder. Now you'll be able to use gcc-4.4 on Windows.
http://files.filefront.com/binutils+2191+bintarbz2/;13651013;/fileinfo.html
http://files.filefront.com/MinGW+gcc+440+bkm+1tarbz2/;13650648;/fileinfo.html
Package Details:
1) Cross-compiled binary from vanilla GCC source.
2) Only one patch was applied to fix GCC build errors. No other patch has been applied to GCC source.
3) Binutils has also been cross-compiled from vanilla BinUtils (Release 2.19.1) package
4) I've put my Blog url and my initial in the compiled binary to differentiate it from other builds.
5) gcc, g++ and gfortran binary are available. Other language compilers are not included. They are mixed together as I don't know how to create individual packages.
Important Note:
1) This is completely unsupported binary and Use it at your own risk.
2) I did very few tests by compiling few projects.
3) Notably Code::Blocks builds without any issues (but with some warning messages).
Patch:
Following patch was applied to complete the build. But it's side-effects are not explored (hope there isn't any).
--- C:/gcc-4.4.0/libstdc++-v3/include/precompiled/stdtr1c++-old.h Fri Apr 10 07:23:08 2009
+++ C:/gcc-4.4.0/libstdc++-v3/include/precompiled/stdtr1c++.h Sat Apr 25 00:03:58 2009
@@ -30,7 +30,7 @@
#include <tr1/array>
#include <tr1/cctype>
-#include <tr1/cfenv>
+//#include <tr1/cfenv>
#include <tr1/cfloat>
#include <tr1/cinttypes>
#include <tr1/climits>
Have Fun! :)
Regards,
Biplab
I've unpacked both MinGW-gcc-4.4.0-bkm-1.tar.bz2 and binutils-2.19.1-bin.tar.bz2 files into c:\mingw, then unpacked w32api-3.13-mingw32-dev.tar.gz and mingwrt-3.15.2-mingw32-dll.tar.gz and I've tried compiling a hello world program:
#include <iostream>
int main()
{
std::cout << "Goodbye cruel adventure world!" << std::endl;
}
I have got lots of errors complaining about missing headers, after copying this file set from an working 4.3.2 mingw distribution:
c:\MinGW\include\wchar.h
c:\MinGW\include\_mingw.h
c:\MinGW\include\wctype.h
c:\MinGW\include\sys\types.h
c:\MinGW\include\stdint.h
c:\MinGW\include\locale.h
c:\MinGW\include\ctype.h
c:\MinGW\include\errno.h
c:\MinGW\include\time.h
c:\MinGW\include\assert.h
I get this error:
$ g++ hello.cpp -o hello
collect2: CreateProcess: No such file or directory
.
Somehow I'm doing something wrong.
Extract mingwrt-3.15.2-mingw32-dev.tar.gz file to C:\MinGW directory. Get it from the following link-
http://sourceforge.net/project/downloading.php?group_id=2435&filename=mingwrt-3.15.2-mingw32-dev.tar.gz&a=57338028
This contains mingw runtime headers and libraries.
Right, silly me I tought that mingwrt-3.15.2-mingw32-dev.tar.gz contained only the source code to mingwm10.dll.
This fixes the header problem, but not the:
$ g++ hello.cpp -o hello
collect2: CreateProcess: No such file or directory
I have set C:\MinGW-4.4.0\bin\ the first (I did one test only with this directory) in path environment variable and
then I have ran Process Monitor to see what happens.
ntvdm.exe is ran by g++.exe in the end and there it stops, if I kill ntvdm.exe then I see the collect2 error message.
I'm using cmd.exe without msys.
I guess the gcc 4.4.0 needs a patch in order to run correctly on Windows.
Wish I was able to compile gcc... :(
How do you guys do this, it seems everybody and their grandmother can do it, only just not me...
May be I should write a blog post on how to compile this. For the time being, I'm explaining it in brief.
I prefer cross-compiling GCC as it's much faster (even from a VM) than CygWin or MSYS. Also my current antivirus freaks out every time I executes a script through MSYS.
1) You need a cross-compiler first. First install GMP-devel, MPFR-devel package on Linux. Then build BinUtils as-
./configure --target=i686-pc-mingw32 --prefix=<BinUtils-Install-Dir> && make install
Basically we need a binutils installation which can emit Windows executables on Linux.
2) Then extract mingw-runtime & runtime-devel, w32api packages to <BinUtils-Install-Dir>/i686-pc-mingw32 folder.
3) Add <BinUtils-Install-Dir> to path and configure & compile cross-gcc as-
export PATH=<BinUtils-Install-Dir>/bin:$PATH
./configure --target=i686-pc-mingw32 --prefix=<BinUtils-Install-Dir> && make install
4) Now build GMP and MPFR as -
./configure --target=i686-pc-mingw32 --prefix=<BinUtils-Install-Dir> && make install
This part you need to check the actual command to be used. Basic idea is to cross-compile them and install them to <BinUtils-Install-Dir> folder.
5) Now build GCC for MinGW as-
./configure --host=i686-pc-mingw32 --target=i686-pc-mingw32 --prefix=/mingw && make
Edit 1: You can get the extract newly compiled binary by issuing the following command.
make DESTDIR=<compiled-mingw-dir> install
<compiled-mingw-dir> can be any folder you want (e.g., /home/<Username>/foo). Only caveat is all your packages will be extracted to one folder. There should be a way to separate different language packages. But I don't know how to do that.
Hope this helps. :)
Here's the build script I made out of your step-by-step description. I probably didn't understand your instructions right, because it fails too. But then again, I've never seen a gcc build not fail... so that doesn't really mean anything.
BINUTILS=$PWD/crossbinutils
BUILDDIR=$PWD/build
test -d $BUILDDIR || mkdir $BUILDDIR
test -d $BINUTILS || mkdir $BINUTILS
wget --timestamping --quiet \
ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-4.4.0/gcc-4.4.0.tar.gz \
http://www.mpfr.org/mpfr-current/mpfr-2.4.1.tar.gz \
ftp://ftp.gmplib.org/pub/gmp-4.3.0.tar.gz
test -d gcc-4.4.0 || tar -zxf gcc-4.4.0.tar.gz
test -d mpfr-2.4.1 || tar -zxf mpfr-2.4.1.tar.gz
test -d gmp-4.3.0 || tar -zxf gmp-4.3.0.tar.gz
cd $BUILDDIR
../gcc-4.4.0/configure --target=i686-pc-mingw32 --prefix=$BINUTILS && make install
cd $BINUTILS
test -d i686-pc-mingw32 || mkdir i686-pc-mingw32
cd i686-pc-mingw32
wget --timestamping --quiet \
http://switch.dl.sourceforge.net/sourceforge/mingw/mingwrt-3.15.2-mingw32-dev.tar.gz \
http://switch.dl.sourceforge.net/sourceforge/mingw/mingwrt-3.15.2-mingw32-dll.tar.gz \
http://switch.dl.sourceforge.net/sourceforge/mingw/w32api-3.13-mingw32-dev.tar.gz
tar -zxf mingwrt-3.15.2-mingw32-dev.tar.gz
tar -zxf mingwrt-3.15.2-mingw32-dll.tar.gz
tar -zxf w32api-3.13-mingw32-dev.tar.gz
cd $BUILDDIR
export PATH=$BINUTILS/bin:$PATH
../gcc-4.4.0/configure --target=i686-pc-mingw32 --prefix=$BINUTILS && make install
../gmp-4.3.0/configure --target=i686-pc-mingw32 --prefix=$BINUTILS && make install
../mpfr-2.4.1/configure --target=i686-pc-mingw32 --prefix=$BINUTILS && make install
../gcc-4.4.0/configure --host=i686-pc-mingw32 --target=i686-pc-mingw32 --prefix=/mingw \
--enable-threads=win32 --disable-win32-registry \
--enable-languages=c,c++ --with-dwarf2 \
--disable-bootstrap \
&& make
make DESTDIR=output install
Before that, I had tried to build it following step by step what's on the gcc site using the MinGW32 cross-compiler that ships with Jaunty Jackalope (why build a cross-compiler if you have one already?). But you guessed it, it won't work :)
Of course the gcc instructions aren't helpful in any way anyway.
Martin: I've looked into the MinGW build script a few days ago, but it seemed that it was still for building 3.4.5 only (maybe I picked the wrong one too).