cc979
5th March 2006, 19:52
I've made this little guide to get a working MinGW gcc-4.0.3 up to gcc-4.1.2 (should work with binutils too)
i did have the latest build on my googlepage but it ran out of bandwidth, unless anybody canrecommend a freehost - its back to the previous way
try this (check http://www.mingw.org/download.shtml for updates)
MinGW-5.1.3-[candidate only base-files]
http://prdownloads.sf.net/mingw/MinGW-5.1.3.exe?download
MSYS-1.0.10.exe
http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download
if you need cvs
http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download
and when installing if the connection drops, click retry (sf problem)
and i recommend to get latest runtime,w32api headers
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158844
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158847
and the new binutils that allows spaces in filenames
https://sourceforge.net/forum/forum.php?forum_id=661143
and if building hogs your system i recommend editing the msys.bat
change the:
line 62: start rxvt ... into start /LOW rxvt ... and
line 66: start sh ... into start /LOW sh ...
(more reliable for your system, you can do other while building)
get gcc-sources try here:
http://www.mirrorservice.org/sites/sources.redhat.com/pub/gcc/
release directory or whatever
***** most of the pre-released/snapshots of gcc needs bison,flex and sometimes libiconv, libtool
bison into \mingw\ directory --
http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php
flex into \mingw\ directory --
http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php
libtool into \mingw\ directory --
http://gnuwin32.sourceforge.net/downlinks/libtool-bin-zip.php
libiconv into \mingw\
http://gnuwin32.sourceforge.net/downlinks/libiconv-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/libiconv-dep-zip.php
and maybe newer gnu-make (not needed but useful and sometimes buggy)
http://prdownloads.sourceforge.net/mingw/mingw32-make-3.80.0-3.exe?download
installing the newer make delete/rename old msys\1.0\bin\make.exe and install the new make into \mingw\ and then
rename the new mingw32-make.exe into make.exe
make --version to check
or compile your own from http://ftp.gnu.org/gnu/make/
***
The directory that should contain system headers does not exist:
/usr/include
create an empty include folder in \msys\1.0\
***
make[2]: Leaving directory `/home/user/svn/gcc-4_1-branch/build/libcpp'
make[2]: Entering directory `/home/user/svn/gcc-4_1-branch/build/gcc'
Makefile:1280: *** target pattern contains no `%'. Stop.
make[2]: Leaving directory `/home/user/svn/gcc-4_1-branch/build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/user/svn/gcc-4_1-branch/build'
make: *** [all] Error 2
check makefile = LD = ld
(not LD = ?:/mingw/bin/../lib/gcc/mingw32/???/../../../../mingw32/bin/ld.exe)
i think related to --with-gcc --with-gnu-ld --with-gnu-as
or delete ld.exe from \mingw\mingw32\bin or empty the folder that's what i did
(but i think the newer binutils fixes that anyway, will check later)
****
Step 1
cd yourgcc-src
mkdir build
cd build
Step 2
tip. before you install new gcc zip your \mingw\ directory ... you never know
Pass 1
append "&> output-results.txt" without quotes to echo to file (displayed text into a file)
after some experiments, i found symbolic links are broke, not sure on how to fix it
you can append: --with-dwarf2 -s (for silent output) to configure line
you can append &>result.txt to pipe any shell output to file
*** for gcc 4.1+ use bison,flex see notes on ld.exe
*** for gcc 4.2+ append --disable-werror
*** updated configure 2006.12.23 (remove --host=mingw32 --target=mingw32 to build for your system)
(remove '"CFLAGS=-O2" "LDFLAGS=-s" --enable-optimize' if debugging the compiler)
for i386
../configure --enable-languages=c -v --enable-optimize --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
for i686
../configure --enable-languages=c -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2" "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
* if the bootstrap fails something is wrong with gcc compiler itself, means it can't rebuild itself with itself
(you can save it for later, if you re-install mingw just copy the folder back in)
make DESTDIR=/home/gcc-build install
(the normal install)
make install
make html
(if you want the html - docs, there should be here yourgcc-src\libstdc++-v3\docs\html )
close and re-load ming
Step 3
Pass 2
empty your build directory
if you need g77 its not supported in gcc 4+, try gcc 3.4.4
but if want to build gfortran read further down
available languages are: c,c++,f95,java,objc,obj-c++,treelang
*** for gcc 4.2+ append --disable-werror
for i386
../configure --enable-languages=c,c++ -v --enable-optimize --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
for i686
../configure --enable-languages=c,c++ -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2" "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
* if the bootstrap fails something is wrong with gcc compiler itself, means it can't rebuild itself with itself
(you can save it for later, if you re-install mingw just copy the folder back in)
make DESTDIR=/home/gcc-build install
(the normal install)
make install
close and re-load ming
Step 4
Pass 3 ( build gcc with gcc with profiled bootstrap to get a faster compiler)
this not necessary but you get a faster compiler
empty your build directory
for i386
../configure --enable-languages=c,c++ -v --enable-optimize --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
for i686
../configure --enable-languages=c,c++ -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2" "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
* if the bootstrap fails something is wrong with gcc compiler itself, means it can't rebuild itself with itself
(you can save it for later, if you re-install mingw just copy the folder back in)
make DESTDIR=/home/gcc-build install
(the normal install)
make install
***
Fortran, GMP, MPFR
Building GMP
download gmp from
http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/
cd your gmp-src
./configure --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw
make DESTDIR=/home/gcc-libs install
make install
Building MPFR
download mpfr from
http://www.mpfr.org/mpfr-current/
cd your mpfr-src
./configure --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw
make DESTDIR=/home/gcc-libs install
make install
Building Fortran (F95)
cd your gcc-src
mkdir build
cd build
../configure --enable-languages=f95 -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2 " "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
(save for later installs)
make DESTDIR=/home/f95-build install
make install
**** more to add later
Compiling GCC for MinGW from Linux
update in progress...
see later posts
**** more to add later
thanks to those who helped, you know who you are
cheers
i did have the latest build on my googlepage but it ran out of bandwidth, unless anybody canrecommend a freehost - its back to the previous way
try this (check http://www.mingw.org/download.shtml for updates)
MinGW-5.1.3-[candidate only base-files]
http://prdownloads.sf.net/mingw/MinGW-5.1.3.exe?download
MSYS-1.0.10.exe
http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download
if you need cvs
http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download
and when installing if the connection drops, click retry (sf problem)
and i recommend to get latest runtime,w32api headers
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158844
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721&release_id=158847
and the new binutils that allows spaces in filenames
https://sourceforge.net/forum/forum.php?forum_id=661143
and if building hogs your system i recommend editing the msys.bat
change the:
line 62: start rxvt ... into start /LOW rxvt ... and
line 66: start sh ... into start /LOW sh ...
(more reliable for your system, you can do other while building)
get gcc-sources try here:
http://www.mirrorservice.org/sites/sources.redhat.com/pub/gcc/
release directory or whatever
***** most of the pre-released/snapshots of gcc needs bison,flex and sometimes libiconv, libtool
bison into \mingw\ directory --
http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php
flex into \mingw\ directory --
http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php
libtool into \mingw\ directory --
http://gnuwin32.sourceforge.net/downlinks/libtool-bin-zip.php
libiconv into \mingw\
http://gnuwin32.sourceforge.net/downlinks/libiconv-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/libiconv-dep-zip.php
and maybe newer gnu-make (not needed but useful and sometimes buggy)
http://prdownloads.sourceforge.net/mingw/mingw32-make-3.80.0-3.exe?download
installing the newer make delete/rename old msys\1.0\bin\make.exe and install the new make into \mingw\ and then
rename the new mingw32-make.exe into make.exe
make --version to check
or compile your own from http://ftp.gnu.org/gnu/make/
***
The directory that should contain system headers does not exist:
/usr/include
create an empty include folder in \msys\1.0\
***
make[2]: Leaving directory `/home/user/svn/gcc-4_1-branch/build/libcpp'
make[2]: Entering directory `/home/user/svn/gcc-4_1-branch/build/gcc'
Makefile:1280: *** target pattern contains no `%'. Stop.
make[2]: Leaving directory `/home/user/svn/gcc-4_1-branch/build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/user/svn/gcc-4_1-branch/build'
make: *** [all] Error 2
check makefile = LD = ld
(not LD = ?:/mingw/bin/../lib/gcc/mingw32/???/../../../../mingw32/bin/ld.exe)
i think related to --with-gcc --with-gnu-ld --with-gnu-as
or delete ld.exe from \mingw\mingw32\bin or empty the folder that's what i did
(but i think the newer binutils fixes that anyway, will check later)
****
Step 1
cd yourgcc-src
mkdir build
cd build
Step 2
tip. before you install new gcc zip your \mingw\ directory ... you never know
Pass 1
append "&> output-results.txt" without quotes to echo to file (displayed text into a file)
after some experiments, i found symbolic links are broke, not sure on how to fix it
you can append: --with-dwarf2 -s (for silent output) to configure line
you can append &>result.txt to pipe any shell output to file
*** for gcc 4.1+ use bison,flex see notes on ld.exe
*** for gcc 4.2+ append --disable-werror
*** updated configure 2006.12.23 (remove --host=mingw32 --target=mingw32 to build for your system)
(remove '"CFLAGS=-O2" "LDFLAGS=-s" --enable-optimize' if debugging the compiler)
for i386
../configure --enable-languages=c -v --enable-optimize --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
for i686
../configure --enable-languages=c -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2" "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
* if the bootstrap fails something is wrong with gcc compiler itself, means it can't rebuild itself with itself
(you can save it for later, if you re-install mingw just copy the folder back in)
make DESTDIR=/home/gcc-build install
(the normal install)
make install
make html
(if you want the html - docs, there should be here yourgcc-src\libstdc++-v3\docs\html )
close and re-load ming
Step 3
Pass 2
empty your build directory
if you need g77 its not supported in gcc 4+, try gcc 3.4.4
but if want to build gfortran read further down
available languages are: c,c++,f95,java,objc,obj-c++,treelang
*** for gcc 4.2+ append --disable-werror
for i386
../configure --enable-languages=c,c++ -v --enable-optimize --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
for i686
../configure --enable-languages=c,c++ -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2" "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
* if the bootstrap fails something is wrong with gcc compiler itself, means it can't rebuild itself with itself
(you can save it for later, if you re-install mingw just copy the folder back in)
make DESTDIR=/home/gcc-build install
(the normal install)
make install
close and re-load ming
Step 4
Pass 3 ( build gcc with gcc with profiled bootstrap to get a faster compiler)
this not necessary but you get a faster compiler
empty your build directory
for i386
../configure --enable-languages=c,c++ -v --enable-optimize --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
for i686
../configure --enable-languages=c,c++ -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2" "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
* if the bootstrap fails something is wrong with gcc compiler itself, means it can't rebuild itself with itself
(you can save it for later, if you re-install mingw just copy the folder back in)
make DESTDIR=/home/gcc-build install
(the normal install)
make install
***
Fortran, GMP, MPFR
Building GMP
download gmp from
http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/
cd your gmp-src
./configure --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw
make DESTDIR=/home/gcc-libs install
make install
Building MPFR
download mpfr from
http://www.mpfr.org/mpfr-current/
cd your mpfr-src
./configure --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw
make DESTDIR=/home/gcc-libs install
make install
Building Fortran (F95)
cd your gcc-src
mkdir build
cd build
../configure --enable-languages=f95 -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x
make "CFLAGS=-O2 " "LDFLAGS=-s"
or
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"
(save for later installs)
make DESTDIR=/home/f95-build install
make install
**** more to add later
Compiling GCC for MinGW from Linux
update in progress...
see later posts
**** more to add later
thanks to those who helped, you know who you are
cheers