This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problems with building a mingw cross-compiler
- From: Pieter Thysebaert <pieter dot thysebaert at intec dot rug dot ac dot be>
- To: Paul Millar <paulm at astro dot gla dot ac dot uk>,gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 15 Jan 2003 10:22:47 +0100
- Subject: Re: Problems with building a mingw cross-compiler
- References: <Pine.LNX.4.44.0301150017110.6597-100000@phobos.astro.gla.ac.uk>
On Wednesday 15 January 2003 01:27, Paul Millar wrote:
> Hi,
>
> I'm trying to compile a cross-compiler that will generate Windows binaries
> from a Linux host. I'm hitting two (probably related) problems.
>
>From your (entire) post, I assume you want mingw32 target on a linux host &
build.
I've done that twice in a single week, although that's been a while now ;-).
I used gcc 3.2.1, binutils 2.13.1 (from some GNU mirror)
w32API 2.1, mingw runtime source 2.2 from www.mingw.org
I believe I did this:
export PREFIX=/usr/local/cross
tar xvfz binutils-2.13.1.tar.gz
mkdir build-binutils
cd build-binutils
../binutils-2.13.1/configure --host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu --target=i686-pc-mingw32
--prefix=$PREFIX
make
make install
cd ..
export PATH=$PREFIX/bin:$PATH
tar xvfz mingw-whatever.tar.gz
cp -r ming-whatever/include $PREFIX/i686-pc-mingw32/include
(you want standard C headers for mingw in $PREFIX/target/include)
tar xvfz gcc-3.2.1.tar.gz
mkdir build-gcc
cd build-gcc
../gcc-3.2.1/configure --prefix=$PREFIX --host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu --target=i686-pc-mingw32 --without-headers
--with-newlib --disable-threads --enable-languages=c
make
make install
cd..
tar xvfz w32api-2.1.tar.gz
mkdir build-w32api
cd build-w32api
../w32api-2.1/configure --prefix=$PREFIX/i686-pc-mingw32
--build=i686-pc-linux-gnu --host=i686-pc-mingw32
make
make install
(you should now have windows header files in prefix/target/include and import
libs in prefix/target/lib)
cd ..
mkdir build-mingw
cd build-mingw
../mingw-whatever/configure --build=i686-pc-linux-gnu --host=i686-pc-mingw32
--prefix=$PREFIX/i686-pc-mingw32
I had to tweak the mingw Makefiles here (3 in total) because the CFLAGS did
not include a dirtectory containing the required windows header files; adding
-I$(PREFIX)/i686-pc-mingw32/include to INCLUDES did the trick
make
make install
cd ../build-gcc
rm -rf *
../gcc-3.2.1/configure --prefix=$PREFIX --host=i686-pc-linux-gnu
--build=i686-pc-linux-gnu --target=i686-pc-mingw32 --enable-threads
--enable-languages=c,c++ --disable-long-long
make
make install
I had to specify --disable-long-long because I get undefined symbols
(regarding string-to-long-long conversion) in the resulting libstdc++.
Pieter