Introduction

This guide shows how to build XSD on UNIX-like operating systems such as GNU/Linux, Mac OS X, Solaris, HP-UX, 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. 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/

Build

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

$ cd
$ bzip2 -d build-0.2.2.tar.bz2
$ tar xf build-0.2.2.tar
$ cd build-0.2.2
$ 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
  

Boost-jam

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

Download the latest boost-jam source release from the Boost website (follow the "Download" link on the right). Then follow these instructions:

$ cd
$ gzip -d boost-jam-3.1.13.tgz
$ tar xf boost-jam-3.1.13.tar
$ cd boost-jam-3.1.13
$ ./build.sh
$ sudo cp bin.*/bjam /usr/local/bin/
  

Boost

Download the latest Boost libraries (or version 1.33.1 if you want to be certain everything works) from the Boost website (follow the "Download" link on the right). Then follow these build instructions:

$ cd
$ bzip2 -d boost_1_33_1.tar.bz2
$ tar xf boost_1_33_1.tar
  

For Boost 1.33.1 and earlier:

$ cd boost_1_33_1/libs/filesystem/build/
$ bjam -sTOOLS=gcc -sGXX=g++

$ cd ../../regex/build
$ bjam -sTOOLS=gcc -sGXX=g++
  

For Boost 1.34.0 and later (unfortunately there is no way to specify the compiler executable in the command line with this versions of Boost, for more information refer to the Boost documentation):

$ bjam --toolset=gcc --with-filesystem --with-regex stage
  

Xerces-C++

Note that the libxsd-backend library (see below) prior to version 1.10.0 used to depend on some of the Xerces-C++ internal headers which are not available once Xerces-C++ is installed or packaged. Therefore you may need to use the source release of Xerces-C++.

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

$ cd
$ gzip -d xerces-c-src_2_8_0.tar.gz
$ tar xf xerces-c-src_2_8_0.tar
$ export XERCESCROOT=~/xerces-c-src_2_8_0
$ cd xerces-c-src_2_8_0/src/xercesc
$ ./runConfigure -p <platform> -c gcc -x g++ -n fileonly -r none
$ make
  

Here <platform> is one of: aix, beos, linux, freebsd, netbsd, solaris, hp-10, hp-11, openserver, unixware, os400, os390, irix, ptx, tru64, macosx, cygwin, qnx, interix, mingw-msys.

The above command sequence builds Xerces-C++ as a shared library. If you would prefer to link Xerces-C++ statically, add the -s options to the runConfigure command line.

Libcult

Download the latest libcult source release from the libcult website. Then follow these build instructions:

$ cd
$ bzip2 -d libcult-1.2.0.tar.bz2
$ tar xf libcult-1.2.0.tar
$ cd libcult-1.2.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]: n

Would you like the C++ compiler to generate debug information?
[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 'libcult'?
[y]: n

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

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

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

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

Libfrontend-elements

Download the latest libfrontend-elements source release from the libfrontend-elements website. Then follow these build instructions:

$ cd
$ bzip2 -d libfrontend-elements-1.0.2.tar.bz2
$ tar xf libfrontend-elements-1.0.2.tar
$ cd libfrontend-elements-1.0.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]: n

Would you like the C++ compiler to generate debug information?
[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]: 2

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

Please enter the src_root for 'libcult'.
[]: ../libcult-1.2.0

Please enter the out_root for 'libcult'.
[/home/boris/libcult-1.2.0]: ../libcult-1.2.0

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

Libbackend-elements

Download the latest libbackend-elements source release from the libbackend-elements website. Then follow these build instructions:

$ cd
$ bzip2 -d libbackend-elements-1.0.4.tar.bz2
$ tar xf libbackend-elements-1.0.4.tar
$ cd libbackend-elements-1.0.4
$ 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]: n

Would you like the C++ compiler to generate debug information?
[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]: 2

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]: 2

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

Please enter the src_root for 'libcult'.
[]: ../libcult-1.2.0

Please enter the out_root for 'libcult'.
[/home/boris/libcult-1.2.0]: ../libcult-1.2.0

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

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.6.0.tar.bz2
$ tar xf libxsd-frontend-1.6.0.tar
$ cd libxsd-frontend-1.6.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]: n

Would you like the C++ compiler to generate debug information?
[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]: 2

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.0.2

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

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

Please enter the src_root for 'libcult'.
[]: ../libcult-1.2.0

Please enter the out_root for 'libcult'.
[/home/boris/libcult-1.2.0]: ../libcult-1.2.0

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-src_2_8_0

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

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]: 2

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

XSD

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

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

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

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]: n

Would you like the C++ compiler to generate debug information?
[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.6.0

Please enter the out_root for 'libxsd-frontend'.
[/home/boris/libxsd-frontend-1.6.0]: ../../libxsd-frontend-1.6.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]: 2

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.0.4

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

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

Please enter the src_root for 'libcult'.
[]: ../../libcult-1.2.0

Please enter the out_root for 'libcult'.
[/home/boris/libcult-1.2.0]: ../../libcult-1.2.0

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

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

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