Command line build using MinGW and autotools
Command line build using ant
MS Developer Studio build

Command line build using MinGW and autotools

Prerequisites

You need to install the compiler and a minimal system environment:

and all sources needed to build Log4cxx:

MingGW installation

Download latest MinGW installer: http://prdownloads.sf.net/mingw/MinGW-5.1.3.exe

Download and install MinGW with the installer.

Install MinGW candidate package.

Select the type of install:

After installation finished, you have MinGW installed with:

MSYS and msysDTK installation

Download latest MSYS installer: http://prdownloads.sf.net/mingw/MSYS-1.0.11-2004.04.30-1.exe

Download latest msysDTK installer: http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe

MSYS installer asks for MinGW path (default is C:\MinGW), set the path properly to bindmount the directory to /mingw: c:/MinGW

Python installation

Download latest python installer, you need python later for APR buildconf script: http://www.python.org/ftp/python/2.5/python-2.5.msi

Sources installation

Optionally, you can update libtool using mingwPORT and this nice tutorial: http://www.mingw.org/MinGWiki/index.php/mingwPORT

Edit user environment variable PATH and append (this is a convenient way for command line access): C:\MinGW\bin;C:\Python25

Download all needed sources and put them into C:\msys\1.0\src\ (create it if needed):

For APR, APR-util and Log4cxx, you need to download a subversion client. I suggest to use TortoiseSVN http://tortoisesvn.net

Create 3 directories:

Download sources inside created directories using your subversion client and these URLs:

The final step: build everything

Now, log in msys and bring all needed stuff in your home:

$ tar zxf /usr/src/cppunit-1.12.0.tar.gz
$ tar zxf /usr/src/expat-2.0.0.tar.gz
$ tar zxf /usr/src/libiconv-1.11.tar.gz
$ cp -rf /usr/src/apr .
$ cp -rf /usr/src/apr-util .
$ cp -rf /usr/src/log4cxx .

Build cppunit as a static library.
It failed to build as a shared library. I used mingPORT style flags except -O3 optimization (can produce weird effect), replaced by -O2:

$ cd cppunit-1.12.0
$ ./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686" --disable-shared
$ make && make install
$ cd

Build expat library:

$ cd expat-2.0.0
$ ./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686"
$ make && make install
$ cd

Build libiconv library.
I wasn't able to build APR-iconv with MinGW so libiconv is the natural alternative:

$ cd libiconv-1.11
$ ./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686"
$ make && make install
$ cd

Build APR library.
It seems there's a mis-optimization at level greater than -O0 producing link time errors (undefined reference to libmsvcrt_a_iname and _nm_pctype):

$ cd apr
$ ./buildconf
$ ./configure CFLAGS="-O0 -s -mms-bitfields -march=i686" CXXFLAGS="-O0 -s -mms-bitfields -march=i686"
$ make && make install
$ cd

Build APR-util library:
Depending on your version of apr-util you may need to add --disable-shared --enable-static --disable-dbd-dso

$ cd apr-util
$ ./buildconf
$ ./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686" --with-apr=/usr/local --with-expat=/usr/local --with-iconv=/usr/local
$ make && make install
$ cd

Build Log4cxx library.
Official MinGW g++-3.4.5 doesn't support wide string, we need to disable them with --disable-wchar_t. Some unofficial MinGW with wide string support can be found (ogre/g++-3.4.5 or develer/g++-4.1.2), but we avoid them until official MinGW GCC 4.2.0 release (soon):

$ cd log4cxx
$ ./autogen.sh
$ ./configure CFLAGS="-O2 -s -mms-bitfields -march=i686" CXXFLAGS="-O2 -s -mms-bitfields -march=i686" --disable-wchar_t --with-apr=/usr/local --with-apr-util=/usr/local
$ make && make install
$ cd

Command line build using ant

MS Developer Studio build

Some information can be found here: http://www.dreamcubes.com/blog/?itemid=43

MSWindowsBuildInstructions (last edited 2009-09-20 23:45:58 by localhost)