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: Paul Millar <paulm at astro dot gla dot ac dot uk>
- To: Pieter Thysebaert <pieter dot thysebaert at intec dot rug dot ac dot be>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 20 Jan 2003 11:10:23 +0000 (GMT)
- Subject: Re: Problems with building a mingw cross-compiler
Hi Pieter,
Thanks for the information. It was the breakthrough that helped me get on
top of this problem. Turns out there's a circular dependency: mingw-gcc
depends on the "w32api" and "mingw-runtime" packages (specifically, the
include files) whilst those packages require mingw-gcc to have already
been built before they compile and install :^(
There was another wrinkle about the build-order inside the mingw-runtime
package: the root build required libmingwex.a to exist (built inside the
mingwex directory), but it doesn't start the build automatically.
I've put all the information together into a script that should do all the
dirty business of building mingw. Its available from
http://www.astro.gla.ac.uk/users/paulm/Scripts/build-mingw-cross.sh
I'm currently having a problem with mingw includes. I suspect its a
problem with the code, but I'd be grateful if you could try the script out
and let me know if it works for you.
Thanks again for you help
Paul.
On Wed, 15 Jan 2003, Pieter Thysebaert wrote:
> 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
>
>
>
>
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Particle Physics (Theory & Experimental) Groups Dr Paul Millar
Department of Physics and Astronomy paulm@astro.gla.ac.uk
University of Glasgow paulm@physics.gla.ac.uk
Glasgow, G12 8QQ, Scotland http://www.astro.gla.ac.uk/users/paulm
+44 (0)141 330 4717 A54C A9FC 6A77 1664 2E4E 90E3 FFD2 704B BF0F 03E9
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --