Introduction

NOTE: these instructions are for building XSD 4.0.0 and earlier. For the current version, see Installing XSD with build2.

This guide shows how to build statically-linked Win32 XSD compiler with GCC-MinGW toolchain using the MSYS shell environment. The resulting binary is self-sufficient and can be used on other Win32 machines without installing MinGW or copying any DLLs. The generated code can be compiled with other C++ compilers (e.g., Visual C++). The XSD runtime is a header-only library and does not need to be built. If you run into problems while following these instructions feel free to ask for help on the xsd-users mailing list.

MinGW/MSYS

To build XSD on Windows you need a working MinGW/MSYS environment. MinGW-w64 is recommended. Particularly, make sure you have a working C++ compiler (GNU g++), GNU make, and GNU m4.

Xerces-C++

Download the latest Xerces-C++ source release from the Xerces-C++ download page. Then follow these build instructions:

$ cd
$ gzip -dc xerces-c-3.1.1.tar.gz | tar x
$ cd xerces-c-3.1.1
$ ./configure --disable-threads --disable-network \
--enable-transcoder-windows --disable-shared \
CXXFLAGS=-O2 CFLAGS=-O2
$ cd src
$ make
  

All-In-One Package

Starting with XSD 3.2.0 we provide a source package, called xsd+dep-x.y.z.tar.bz2, which contains pre-configured XSD source code as well as all its dependencies except Xerces-C++. This package can be used to build the XSD compiler in non-interactive mode. This is the easy and recommended way to build XSD. The package can be downloaded from the XSD project page. The README file inside provides further instructions. Given the above Xerces-C++ build, the XSD build steps would look like this:

$ cd
$ bzip -d xsd+dep-4.0.0.tar.bz2
$ tar xf xsd+dep-4.0.0.tar
$ cd xsd+dep-4.0.0
$ make CPPFLAGS=-I../xerces-c-3.1.1/src \
LDFLAGS="-static -L../xerces-c-3.1.1/src/.libs"
$ ./xsd/xsd --version