# # Run this Tcl script to generate the crosscompile.html file. # set rcsid {$Id: crosscompile.tcl,v 1.2 2000/07/31 19:16:32 drh Exp $} puts {
(This page was last modified on [lrange $rcsid 3 4] GMT)
" puts {MinGW or Minimalist GNU For Windows is a version of the popular GCC compiler that builds Win95/Win98/WinNT binaries. See the website for details.
This page describes how you can use MinGW configured as a cross-compiler running under RedHat 6.0 Linux to generate a binary for SQLite that runs under WinNT.
} proc Code {body} { puts {} } puts {} regsub -all {&} [string trim $body] {\&} body regsub -all {>} $body {\>} body regsub -all {<} $body {\<} body regsub -all {\(\(\(} $body {} body regsub -all {\)\)\)} $body {} body puts $body puts {
Here are the steps:
Get a copy of the MinGW compiler and all its associated tools that run under Linux. No binary versions of MinGW in this configuration are available for net downloads, as far as I know. You will probably have to download the source code and compile it all yourself. A separate bulletin describes how this can be done. When you are done, make sure the compiler and all its associated tools are located somewhere on your PATH environment variable.
Download the Win32 port of GDBM from Roth Consulting. You can FTP a ZIP archive of the sources directly from ftp://ftp.roth.net/pub/ntperl/gdbm/source/Win32_GDBM_Source.zip.
Make a directory and unpack the Win32 port of GDBM.
mkdir roth cd roth unzip ../Win32_GDBM_Source.zip
Manually build the GDBM library as follows:
i386-mingw32-gcc -DWIN32=1 -O2 -c *.c i386-mingw32-ar cr libgdbm.a *.o i386-mingw32-ranlib libgdbm.a cd ..
Download the SQLite tarball from http://www.hwaci.com/sw/sqlite/sqlite.tar.gz. Unpack the tarball and create a separate directory in which to build the executable and library.
tar xzf sqlite.tar.gz mkdir sqlite-bld cd sqlite-bld
Create a "hints" file that will tell the SQLite configuration script to use the MinGW cross-compiler rather than the native linux compiler. The hints file should looks something like this:
cat >mingw.hints <<\END config_TARGET_CC=i386-mingw32-gcc config_TARGET_CFLAGS='-O2' config_TARGET_GDBM_LIBS=../roth/libgdbm.a config_TARGET_GDBM_INC=-I../roth config_TARGET_AR='i386-mingw32-ar cr' config_TARGET_RANLIB=i386-mingw32-ranlib config_TARGET_EXEEXT='.exe' END
Configure and build SQLite:
../sqlite/configure --with-hints=./mingw.hints make