2 # Run this Tcl script to generate the mingw.html file.
4 set rcsid
{$Id: mingw.tcl
,v
1.4 2003/03/30 18:58:58 drh Exp
$}
8 <title
>Notes On How To Build MinGW As A Cross-Compiler
</title
>
12 Notes On How To Build MinGW As A Cross-Compiler
14 puts "<p align=center>
15 (This page was last modified on [lrange $rcsid 3 4] UTC)
19 <p
><a href
="http://www.mingw.org/">MinGW
</a
> or
20 <a href
="http://www.mingw.org/">Minimalist GNU For Windows
</a
>
21 is a version of the popular GCC compiler that builds Win95
/Win98
/WinNT
22 binaries. See the website
for details.
</p
>
24 <p
>This page describes how you can build MinGW
25 from sources as a cross-compiler
26 running under Linux. Doing so will allow you to construct
27 WinNT binaries from the comfort and convenience of your
31 proc Link
{path
{file {}}} {
37 puts "<a href=\"$path\">$file</a>"
41 <p
>Here are the steps
:</p
>
45 <p
>Get a copy of
source code. You will need the binutils
, the
46 compiler
, and the MinGW runtime. Each are available separately.
47 As of this writing
, Mumit Khan has collected everything you need
48 together in one FTP site
:
51 ftp
://ftp.nanotech.wisc.edu
/pub
/khan
/gnu-win32
/mingw32
/snapshots
/gcc-2.95
.2-1
54 The three files you will need are
:</p
>
57 Link
$ftpsite binutils-19990818-1-src.tar.gz
59 Link
$ftpsite gcc-2.95
.2-1-src.tar.gz
61 Link
$ftpsite mingw-20000203.zip
65 <p
>Put all the downloads in a directory out of the way. The sequel
66 will assume all downloads are in a directory named
67 <b
>~
/mingw
/download
</b
>.
</p
>
72 Create a directory in which to install the new compiler suite and make
73 the new directory writable.
74 Depending on what directory you choose
, you might need to become
75 root. The example shell commands that follow
76 will assume the installation directory is
77 <b
>/opt
/mingw
</b
> and that your user ID is
<b
>drh
</b
>.
</p
>
87 <p
>Unpack the
source tarballs into a separate directory.
</p
>
91 tar xzf ..
/download
/binutils-
*.tar.gz
92 tar xzf ..
/download
/gcc-
*.tar.gz
93 unzip ..
/download
/mingw-
*.zip
98 <p
>Create a directory in which to put all the build products.
</p
>
105 <p
>Configure and build binutils and add the results to your PATH.
</p
>
107 mkdir ~
/mingw
/bld
/binutils
108 cd ~
/mingw
/bld
/binutils
109 ..
/..
/src
/binutils
/configure
--prefix=/opt
/mingw
--target=i386-mingw32
-v
110 make
2>
;&
;1 | tee make.out
111 make install
2>
;&
;1 | tee make-install.out
112 export PATH
=$PATH:/opt
/mingw
/bin
117 <p
>Manually copy the runtime include files into the installation directory
118 before trying to build the compiler.
</p
>
120 mkdir
/opt
/mingw
/i386-mingw32
/include
121 cd ~
/mingw
/src
/mingw-runtime
*/mingw
/include
122 cp
-r * /opt
/mingw
/i386-mingw32
/include
127 <p
>Configure and build the compiler
</p
>
129 mkdir ~
/mingw
/bld
/gcc
131 ..
/..
/src
/gcc-
*/configure
--prefix=/opt
/mingw
--target=i386-mingw32
-v
135 make
2>
;&
;1 | tee make.out
141 <p
>Configure and build the MinGW runtime
</p
>
143 mkdir ~
/mingw
/bld
/runtime
144 cd ~
/mingw
/bld
/runtime
145 ..
/..
/src
/mingw-runtime
*/configure
--prefix=/opt
/mingw
--target=i386-mingw32
-v
146 make install-target-w32api
152 <p
>And you are done...
</p
>
156 <p
><a href
="index.html"><img src
="/goback.jpg" border
=0 />
157 Back to the SQLite Home Page
</a
>