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/ |
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 Boost 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++
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. You have a choice of using Xerces-C++ 2-series (e.g., 2.8.0) or 3-series (e.g., 3.0.0). For XSD 3.2.0 or later Xerces-C++ 3-series is recommended.
For Xerces-C++ 3-series, follow these build instructions:
$ cd $ gzip -d xerces-c-3.0.0.tar.gz $ tar xf xerces-c-3.0.0.tar $ cd xerces-c-3.0.0 $ ./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.
For Xerces-C++ 2-series, 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 -s $ 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 static library.
If you would prefer to build a shared library, remove the -s
options from the runConfigure command line.
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 Boost and
Xerces-C++. This package can be used to build the XSD compiler
in non-interactive mode. The package can be downloaded from the
XSD project page.
The README file inside provides further instructions.
Alternatively, the subsequent sections provide step-by-step instructions on how to build XSD and all its dependencies individually in interactive mode.
Build
Download the latest build source release from the
build
project page. Then follow these installation instructions:
$ cd $ bzip2 -d build-0.3.3.tar.bz2 $ tar xf build-0.3.3.tar $ cd build-0.3.3 $ 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
Libcult
Download the latest libcult source release from the
libcult
website. Then follow these build instructions:
$ cd $ bzip2 -d libcult-1.4.2.tar.bz2 $ tar xf libcult-1.4.2.tar $ cd libcult-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 '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]: 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
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.1.1.tar.bz2 $ tar xf libfrontend-elements-1.1.1.tar $ cd libfrontend-elements-1.1.1 $ 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 'libcult' as opposed to the development build? [y]: n Please enter the src_root for 'libcult'. []: ../libcult-1.4.2 Please enter the out_root for 'libcult'. [/home/boris/libcult-1.4.2]: ../libcult-1.4.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++ Please select the optimization level you would like to use: [2]: 2
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.6.1.tar.bz2 $ tar xf libbackend-elements-1.6.1.tar $ cd libbackend-elements-1.6.1 $ 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 '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. []: 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.4.2 Please enter the out_root for 'libcult'. [/home/boris/libcult-1.4.2]: ../libcult-1.4.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++ 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 'libcult' as opposed to the development build? [y]: n Please enter the src_root for 'libcult'. []: ../libcult-1.4.2 Please enter the out_root for 'libcult'. [/home/boris/libcult-1.4.2]: ../libcult-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 'libcult' as opposed to the development build? [y]: n Please enter the src_root for 'libcult'. []: ../../libcult-1.4.2 Please enter the out_root for 'libcult'. [/home/boris/libcult-1.4.2]: ../../libcult-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 'Berkeley DB XML' 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.