Installing XSD on Linux
This README
describes installing the XSD compiler
(xsd
) and runtime library (libxsd
) from binary
packages on a generic Linux distribution. Note that the runtime library is
header-only.
Before using the generic Linux binary packages check if distribution-specific packages are available. Debian, Ubuntu, Fedora, and RHEL packages are provided.
Besides the runtime library, the generated code also depends on the underlying XML parser which can be Xerces-C++ for the C++/Tree mapping and Xerces-C++ or Expat for the C++/Parser mapping. Both of these XML parsers are usually available from the distribution's official package repository and you need to install one or the other explicitly, or, alternatively, build one from source.
The following binary packages are provided for generic Linux (here
<...>
denotes the version and architecture information):
xsd-<...>-linux-glibcX.Y.tar.xz -- XSD compiler libxsd-<...>-linux.tar.xz -- XSD runtime library
Note that the XSD compiler package is statically linked except for
glibc
and can be used on any distribution with
glibc
version X.Y
or later.
By default both packages assume the installation into
/usr/local/
but can be relocated. For example, to install to
/usr/local/
:
$ sudo tar -xf xsd-<...>.tar.xz -C / --strip-components=1 $ sudo tar -xf libxsd-<...>.tar.xz -C / --strip-components=1
Or, to relocate to /opt/xsd/
:
$ sudo mkdir -p /opt/xsd $ sudo tar -xf xsd-<...>.tar.xz -C /opt/xsd --strip-components=3 $ sudo tar -xf libxsd-<...>.tar.xz -C /opt/xsd --strip-components=3
To test the installation you can try to build and run an example, for
example cxx/tree/hello/
from the xsd-examples
source package (see examples README
for
details):
$ xsd cxx-tree hello.xsd $ c++ -std=c++11 -c hello.cxx $ c++ -std=c++11 -c driver.cxx $ c++ -std=c++11 -o driver driver.o hello.o -lxerces-c $ ./driver hello.xml