Subject: Re: Something for the FAQ - How do I cross compile...
From: [email-masked] (Mumit Khan)

23 Aug 1997 19:23:36 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: root <[email-masked]>
Original-cc: [email-masked]
In-reply-to: Your message of "Wed, 20 Aug 1997 12:06:29 EDT."
             <[email-masked]> 
Original-Sender: [email-masked]

root <[email-masked]> writes:
> If I want to build the Gnu-win32 so that I can produce NT programs
> under Linux or another host/build machine, what do I use for the
> --target entry?  i686-cygwin32-gnu says fcntl.h is missing, and I
> will try some other things, but it would really help if you would
> say somewhere in the faq how to do this.
> -

I remember a post by Geoffrey Noer a long time back with the essentials,
and I've successfully used that since b17 to build everything under
i386-linux. I'll use i386-linux instead of the more specific i[456] etc.

I do this regularly and haven't had any problems. Here's an excerpt
from a message that I had sent someone else (replace b17 with 18.1):

 -- using template mhl.format --

From:    Mumit Khan <[email-masked]>
Subject: BUILDING CROSS COMPILER 

You really need to start with getting the whole source tree for cygnus
gnu-win32 b17.1 from cygnus's ftp site. You of course do need a C compiler
already installed on your machine (eg., gcc) to bootstrap the cross
compiler. GCC 2.7.2* work quite well when building the cross compiler.

You don't need the source for gcc other than what comes with gnu-win32
source distribution (there is gcc in there already, as well as a whole
bunch of other things).

Here's what I've done:

Part 1: Building the cross-compiler 

1. Get Cygnus b17.1 source tree for the compiler toolchain
   ftp://ftp.cygnus.com/pub/gnu-win32/cdk-src/*

   Comes as a bunch of files xaa, xab, etc.

2. Unzip and untar on your Unix machine (say a Linux machine). Let's
   assume you untar everything under $srcdir (where $srcdir in my
   case is /src/gnu/gnu-win32-b17.1)

   % mkdir gnu-win32-b17.1
   % cd gnu-win32-b17.1
   % cat ../xa* | tar zxvf -

3. Now create a build tree.

   % mkdir cross-build
   % cd cross-build

4. Configure for cross compiler
   % $srcdir/configure --target=i386-cygwin32 --host=i386-linux \
     -v --prefix=/scratch/gnu

   Replace /scratch/gnu above with what you want. This is where the 
   cross-compilers will eventually end up!

5. Make the cross-compiler now
   
   % make >& make.log
   % make install

Part 2: [OPTIONAL] Building the native tools

1. Add $prefix/bin to your path <<<<<<<< Make sure you do this!

2. Create a new build tree

   % mkdir cygwin32
   % cd cygwin32

3. Configure for native tools
   % $srcdir/configure --prefix=/scratch/gnu-win32 \
     --exec-prefix=/scratch/gnu-win32/H-i386-cygwin32 \
     --target=i386-cygwin32 --host=i386-cygwin32 \
     --build=i386-linux -v

4. ``make'' and ``make install''

Part 3: [OPTIONAL] Build native user tools.

[... same as Part 2 ... ]

 -- 

regards,
Mumit -- [email-masked]
http://www.xraylith.wisc.edu/~khan/
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".