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.
Quotehttp://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
Great Job!
Thanks for sharing.
I found that there are several types of *unofficial mingw package"
http://www.equation.com/servlet/equation.cmd?call=fortran
and
http://www.tdragon.net/recentgcc/
I'm not sure what's the difference between them.
:D
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.
Quote from: drac on April 27, 2009, 07:10:57 PM
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-
Quotehttp://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.
Quote from: Biplab on April 28, 2009, 08:30:21 AM
Extract mingwrt-3.15.2-mingw32-dev.tar.gz file to C:\MinGW directory. Get it from the following link-
Quotehttp://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 directoryI 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.
Quote from: drac on April 28, 2009, 01:53:00 PM
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.
You should extract them to
C:\MinGW folder. Otherwise it'd fail to execute other binaries.
Quote from: ollydbg on April 27, 2009, 09:35:09 AM
I found that there are several types of *unofficial mingw package"
http://www.equation.com/servlet/equation.cmd?call=fortran
and
http://www.tdragon.net/recentgcc/
I'm not sure what's the difference between them.
:D
They differ by configuration options, way it's built, optimization options, platform naming scheme, etc.
Quote from: Biplab on April 28, 2009, 04:58:51 PM
You should extract them to C:\MinGW folder. Otherwise it'd fail to execute other binaries.
Just tried it, the same behavior. Tested gcc and g++.
After some more digging I found out what was the problem.
The folder i686-pc-mingw32\bin\ had some very weird executables, containing only text like this (ar.exe):
Link: bin/ar.exeThe folder i686-pc-mingw32 was part of binutils-2.19.1-bin.tar.bz2 , after deleting it everything worked
fine (also in c:\mingw-4.4.0)
Cheers!
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...
Quote from: thomas on April 28, 2009, 09:43:04 PM
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 installBasically 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 install4) Now build GMP and MPFR as -
./configure --target=i686-pc-mingw32 --prefix=<BinUtils-Install-Dir> && make installThis 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 && makeEdit 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. :)
Quote from: thomas on April 28, 2009, 09:43:04 PM
Wish I was able to compile gcc... :(
Dunno - but did you (anyone) try:
http://sourceforge.net/project/shownotes.php?release_id=668578
???
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).
You are trying to build a cross-compiler (Host: Linux & Target: MinGW) before building a compatible BinUtils (Host: Linux & Target: MinGW). I believe that is the problem in your case.
Edit 1:
1) Build BinUtils (Host: Linux & Target: MinGW) and install.
2) Then add newly built <BinUtils-Path> to PATH.
3) Then start building cross-compiler. :)
That doesn't work either, which is not surprising.
Quote from: thomas on May 01, 2009, 01:20:13 PM
That doesn't work either, which is not surprising.
What is the failure message and which part does fail?
Don't waste your time any further, Biplab. I'll give up. Thank you for trying, though.
The failure is about 20,000 lines of configure and make shit, followed by "compiler can't create executables". This is independent to what combination of --host --target and --build I provide.
I've tried what you said, tried what the abysmal available documentation tells you, tried what the even more abysmal "canadian cross howto" tells you.
It doesn't work with the MinGW32 cross compiler that Ubuntu provides, either (providing /usr as sysroot, as it's in /usr/i586-mingw32msvc). The exact same compiler works just fine for building programs with Code::Blocks, and they run under Windows with no problems.
The GMP build script will also output a message that --target is not appropriate (hidden in 20,000 lines of useless crap that nobody ever wants to read), but it builds fine. If you do as it tells you, it will compile everything using the native compiler... great.
See, this is why GNU and Linux will never be competitive. They have to make everything super configurable and portable for 3500 platforms that nobody uses, but they just can't make it work out of the box with 2-3 simple commands on a plain normal mainstream PC, nor can they provide clear and understandable instructions what to do to get the desired result.
They can't even give you an error message without requiring you to scroll through 30 screen pages of useless information. Bah!
<off topic>
This (http://apina.biz/15549.jpg) seemed appropriate! :)
</off topic>
Quote from: drac on May 01, 2009, 02:59:59 PM
This (http://apina.biz/15549.jpg) seemed appropriate! :)
That's a good one. Funnily that's also the reason for me to switch to Windows. I did this (Linux) for years at the university but I just don't have time for such anymore. But:
@Thomas: However - I *never* had such issues with wxWidgets. This is one of the good examples that compiles out-of-the-box and is cross-platform.
Quote from: drac on May 01, 2009, 02:59:59 PM
<off topic>
This (http://apina.biz/15549.jpg) seemed appropriate! :)
</off topic>
Oh my god... this is exactly how I feel now :)
Quote from: thomas on May 01, 2009, 02:30:10 PM
The failure is about 20,000 lines of configure and make shit, followed by "compiler can't create executables". This is independent to what combination of --host --target and --build I provide.
I've tried what you said, tried what the abysmal available documentation tells you, tried what the even more abysmal "canadian cross howto" tells you.
Most likely configure is mixing up path of Linux hosted gcc/bintuils with the cross-one.
This is one of the reasons I build my own cross-compiler and install them to a uncommon path (in my case /home/biplab/cross-tools). This helps me avoid interference with other installed gcc tools.
Many Thanks!