Introduction

This guide shows how to build XSD on UNIX-like operating systems such as GNU/Linux, Mac OS X, Solaris, etc. If you run into problems while following these instructions feel free to ask for help on the xsd-users mailing list.

The build commands presented below assume that you download and build the source code in your home directory. Adjust your paths accordingly if you are using a different directory. Commands that require super-user privileges are prefixed with sudo.

Prerequisites

The following standard utilities are required to build XSD. Any fairly recent GNU/Linux distribution should have these utilities already installed. Normally the XSD compiler is built with GNU g++. Other C++ compilers may work but are not regularly tested. The generated code can be compiled with other C++ compiler. The XSD runtime is a header-only library and does not need to be built.

Utility Version Command Download
GNU bash >= 2.00 bash --version http://www.gnu.org/software/bash/
GNU m4 >= 1.4 m4 --version http://www.gnu.org/software/m4/
GNU make >= 3.81 make --version http://www.gnu.org/software/make/
GNU g++ >= 3.4.3 g++ --version http://gcc.gnu.org/

Xerces-C++

If you already have Xerces-C++ libraries and development files installed on your system, you can skip this sections and proceed to the next section.

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

$ cd
$ gzip -d xerces-c-3.1.1.tar.gz
$ tar xf xerces-c-3.1.1.tar
$ cd xerces-c-3.1.1
$ ./configure --disable-threads --disable-network \
--disable-shared CXXFLAGS=-O2 CFLAGS=-O2
$ cd src
$ make
  

The above command sequence builds Xerces-C++ as a static library. If you would prefer to build a shared library, replace the --disable-shared option with --disable-static.

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=-L../xerces-c-3.1.1/src/.libs
$ ./xsd/xsd --version
  

Alternatively, the subsequent sections provide step-by-step instructions on how to build XSD and all its dependencies individually in interactive mode. Note: the below instructions are no longer maintained and may be outdated.

Build

Download the latest build source release from the build project page. Then follow these installation instructions:

$ cd
$ bzip2 -d build-0.3.10.tar.bz2
$ tar xf build-0.3.10.tar
$ cd build-0.3.10
$ sudo make install install_prefix=/usr/local
  

Note that you need to install build in a location where GNU make looks for included makefiles by default (normally /usr/include and /usr/local/include). Otherwise you will need to add the build include directory to the make search list. For example, if you installed build to /home/user/install, then the following command will add the include directory in this path to the make search list:

$ export MAKEFLAGS=-I/home/user/install/include
  

Libcutl

Download the latest libcutl source release from the libcutl project page. Then follow these build instructions:

$ cd
$ bzip2 -d libcutl-1.4.2.tar.bz2
$ tar xf libcutl-1.4.2.tar
$ cd libcutl-1.4.2
$ make

Please select the C++ compiler you would like to use:
(1) GNU C++ (g++)
(2) Intel C++ (icc)
[1]: 1

Would you like the C++ compiler to optimize generated code?
[y]: y

Would you like the C++ compiler to generate debug information?
[y]: n

Embed dynamic library paths into executables (rpath)?
[y]: n

Please enter any extra C++ preprocessor options.
[]:

Please enter any extra C++ compiler options.
[]:

Please enter any extra C++ linker options.
[]:

Please enter any extra C++ libraries.
[]:

Would you like to build a multi-threaded version of 'libcutl'?
[y]: n

Would you like to build the network subsystem of 'libcutl'?
[y]: n

Would you like to build the data representation subsystem of 'libcutl'?
[y]: n

Please select the default library type:
(1) archive
(2) shared object
[2]: 1

Please enter the archiver (ar) binary you would like to use.
[ar]: ar

Please enter the indexer (ranlib) binary you would like to use.
[ranlib]: ranlib

Please enter the g++ binary you would like to use, for example 'g++-3.4',
'/usr/local/bin/g++' or 'distcc g++'.
[g++]: g++

Please select the optimization level you would like to use:
[2]: 2
  

Libxsd-frontend

Download the latest libxsd-frontend source release from the libxsd-frontend project page. Then follow these build instructions:

$ cd
$ bzip2 -d libxsd-frontend-1.15.0.tar.bz2
$ tar xf libxsd-frontend-1.15.0.tar
$ cd libxsd-frontend-1.15.0
$ make

Please select the C++ compiler you would like to use:
(1) GNU C++ (g++)
(2) Intel C++ (icc)
[1]: 1

Would you like the C++ compiler to optimize generated code?
[y]: y

Would you like the C++ compiler to generate debug information?
[y]: n

Embed dynamic library paths into executables (rpath)?
[y]: n

Please enter any extra C++ preprocessor options.
[]:

Please enter any extra C++ compiler options.
[]:

Please enter any extra C++ linker options.
[]:

Please enter any extra C++ libraries.
[]:

Please select the default library type:
(1) archive
(2) shared object
[2]: 1

Please enter the archiver (ar) binary you would like to use.
[ar]: ar

Please enter the indexer (ranlib) binary you would like to use.
[ranlib]: ranlib

Would you like to configure dependency on the installed version
of 'libfrontend-elements' as opposed to the development build?
[y]: n

Please enter the src_root for 'libfrontend-elements'.
[]: ../libfrontend-elements-1.1.1

Please enter the out_root for 'libfrontend-elements'.
[/home/boris/libfrontend-elements-1.1.1]: ../libfrontend-elements-1.1.1

Would you like to configure dependency on the installed
version of 'libcutl' as opposed to the development build?
[y]: n

Please enter the src_root for 'libcutl'.
[]: ../libcutl-1.4.2

Please enter the out_root for 'libcutl'.
[/home/boris/libcutl-1.4.2]: ../libcutl-1.4.2

Would you like to configure dependency on the installed version
of 'libxerces-c' as opposed to the development build?
[y]: n

Please enter the 'libxerces-c' root directory.
[]: ../xerces-c-3.0.0

Please select the library type you would like to use:
(1) archive
(2) shared object
[2]: 1

Would you like to configure dependency on the installed version
of 'boost libraries' as opposed to the development build?
[y]: n

Please enter the 'boost' root directory.
[]: ../boost_1_33_1

Please select the library type you would like to use:
(1) archive
(2) shared object
[2]: 1

For boost 1.34.0 and later, please enter the toolset version
that is embedded into the library names. For example, for
gcc34 enter 34. For previous versions of boost leave this
field blank.
[]:

Please enter the g++ binary you would like to use, for example 'g++-3.4',
'/usr/local/bin/g++' or 'distcc g++'.
[g++]: g++

Please select the optimization level you would like to use:
[2]: 2
  

XSD

Download the latest XSD source release from the XSD project page. Then follow these build instructions:

$ cd
$ bzip2 -d xsd-3.2.0.tar.bz2
$ tar xf xsd-3.2.0.tar
$ cd xsd-3.2.0/xsd
$ make

Please select the C++ compiler you would like to use:
(1) GNU C++ (g++)
(2) Intel C++ (icc)
[1]: 1

Would you like the C++ compiler to optimize generated code?
[y]: y

Would you like the C++ compiler to generate debug information?
[y]: n

Embed dynamic library paths into executables (rpath)?
[y]: n

Please enter any extra C++ preprocessor options.
[]:

Please enter any extra C++ compiler options.
[]:

Please enter any extra C++ linker options.
[]:

Please enter any extra C++ libraries.
[]:

Would you like to configure dependency on the installed
version of 'libxsd-frontend' as opposed to the development build?
[y]: n

Please enter the src_root for 'libxsd-frontend'.
[]: ../../libxsd-frontend-1.15.0

Please enter the out_root for 'libxsd-frontend'.
[/home/boris/libxsd-frontend-1.15.0]: ../../libxsd-frontend-1.15.0

Would you like to configure dependency on the installed version
of 'boost libraries' as opposed to the development build?
[y]: n

Please enter the 'boost' root directory.
[]: ../../boost_1_33_1

Please select the library type you would like to use:
(1) archive
(2) shared object
[2]: 1

Would you like to configure dependency on the installed version
of 'libbackend-elements' as opposed to the development build?
[y]: n

Please enter the src_root for 'libbackend-elements'.
[]: ../../libbackend-elements-1.6.1

Please enter the out_root for 'libbackend-elements'.
[/home/boris/libbackend-elements-1.6.1]: ../../libbackend-elements-1.6.1

Would you like to configure dependency on the installed
version of 'libcutl' as opposed to the development build?
[y]: n

Please enter the src_root for 'libcutl'.
[]: ../../libcutl-1.4.2

Please enter the out_root for 'libcutl'.
[/home/boris/libcutl-1.4.2]: ../../libcutl-1.4.2

Would you like to build optional parts of 'XSD' that require
the 'ACE' library?
[n]: n

Would you like to build optional parts of 'XSD' that require
the 'XDR' library (part of the system in most GNU/Linux and
UNIX distributions)?
[n]: n

Would you like to build optional parts of 'XSD' that require
the boost 'serialization' library?
[n]: n

Would you like to build optional parts of 'XSD' that require
the boost 'date_time' library?
[n]: n

Would you like to build optional parts of 'XSD' that require
the XQilla library?
[n]: n

Please enter the g++ binary you would like to use, for example 'g++-3.4',
'/usr/local/bin/g++' or 'distcc g++'.
[g++]: g++

Please select the optimization level you would like to use:
[2]: 2

$ ./xsd --version
XML Schema Definition Compiler 3.2.0
  

After this step the XSD compiler executable can be found in the xsd-3.2.0/xsd directory.