Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Programming and Hacking > Development
Register FAQ Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 5th March 2006, 19:52   #1  |  Link
cc979
Curious BetaTester
 
Join Date: Oct 2005
Posts: 430
Compiling GCC for MinGW & Cross-Compiling with Linux

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/MinG...3.exe?download

MSYS-1.0.10.exe

http://prdownloads.sf.net/mingw/MSYS...0.exe?download

if you need cvs
http://prdownloads.sf.net/mingw/msys...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/showf...ease_id=158844
http://sourceforge.net/project/showf...ease_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/s...t.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/down...on-bin-zip.php
http://gnuwin32.sourceforge.net/down...on-dep-zip.php

flex into \mingw\ directory --
http://gnuwin32.sourceforge.net/down...ex-bin-zip.php

libtool into \mingw\ directory --
http://gnuwin32.sourceforge.net/down...ol-bin-zip.php

libiconv into \mingw\
http://gnuwin32.sourceforge.net/down...nv-bin-zip.php
http://gnuwin32.sourceforge.net/down...nv-dep-zip.php

and maybe newer gnu-make (not needed but useful and sometimes buggy)
http://prdownloads.sourceforge.net/m...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
Quote:
../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
Quote:
../configure --enable-languages=c -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x

Quote:
make "CFLAGS=-O2" "LDFLAGS=-s"
or
Quote:
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)
Quote:
make DESTDIR=/home/gcc-build install
(the normal install)
Quote:
make install
Quote:
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
Quote:
../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
Quote:
../configure --enable-languages=c,c++ -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x

Quote:
make "CFLAGS=-O2" "LDFLAGS=-s"
or
Quote:
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)
Quote:
make DESTDIR=/home/gcc-build install
(the normal install)
Quote:
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
Quote:
../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
Quote:
../configure --enable-languages=c,c++ -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x

Quote:
make "CFLAGS=-O2" "LDFLAGS=-s"
or
Quote:
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)
Quote:
make DESTDIR=/home/gcc-build install
(the normal install)
Quote:
make install
***

Fortran, GMP, MPFR

Building GMP

download gmp from
http://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/

cd your gmp-src

Quote:
./configure --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw
Quote:
make DESTDIR=/home/gcc-libs install
Quote:
make install
Building MPFR

download mpfr from
http://www.mpfr.org/mpfr-current/

cd your mpfr-src

Quote:
./configure --host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw
Quote:
make DESTDIR=/home/gcc-libs install
Quote:
make install
Building Fortran (F95)

cd your gcc-src
mkdir build
cd build


Quote:
../configure --enable-languages=f95 -v --enable-optimize --prefix=/mingw --oldincludedir=/mingw/include --enable-threads --disable-nls --disable-win32-registry --disable-shared --without-x

Quote:
make "CFLAGS=-O2 " "LDFLAGS=-s"
or
Quote:
make bootstrap "CFLAGS=-O2" "LDFLAGS=-s"

(save for later installs)
Quote:
make DESTDIR=/home/f95-build install
Quote:
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
__________________
Asrock N68-S AMD Athlon(tm) II X4 620 Processor (2.6GHz) - Crucial 2GB PC6400 800MHz DDR2 - Nvidia 9600GT

Tools: ProcessExplorer & ProcessMonitor - BatchCompressor

Guide: MinGW Compiling GCC

Last edited by cc979; 3rd August 2009 at 04:00.
cc979 is offline   Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.