Software/Geant4/Installation/Xerces-C
Introduction
Xerces-C++
is a validating XML parser written in a portable subset of C++. Xerces-C++ makes it easy to give your application the ability to read and write XML data.
Geant4
requires the Xerces-C++
headers and libraries compiled against the C++11 standard in order to provide support for GDML geometry descriptions.
Details
- Website
- http://xerces.apache.org/xerces-c/
- Source URL
- http://www.apache.org/dist/xerces/c/3/sources/
- Installed Production version
- 3.1.3 (17 Feb 2016)
- Source code
src/geant4-prerequisites/xerces-c/xerces-c-3.1.3.tar.gz
- Installed Development version
- 3.2.0 (20 October 2017)
- Central Repository
- https://github.com/apache/xerces-c
Installation Notes
The Xerces-C++ website provides some useful instructions on Building and Installing Xerces-C++.
For installation, Xerces-C++
does not support installation into a sandbox directory (i.e. there are no options prefix
or DESTDIR
defined for command make install
) and must be given the installation directory with the -prefix
option.
As such, to recompile Xerces-C++
for different target directories, the configure
script must be rerun with a modified -prefix /path/to/dest
option.
This has to be managed manually as can be seen in the installation commands below.
Installation
When downloading software, the downloaded tarball (or other Zip
archive) should be placed in an appropriately named directory in /unix/pbt/software/src
: the instructions below assume that the directory is /unix/pbt/software/src/geant4-prerequisites/xerces-c
.
The source code should then be extracted into a suitable subdirectory in /unix/pbt/software/build
.
The extracted source code directory can only be deleted once the software has been built and installed.
Installation from Central Repository
After the latest version has been pulled from its central repository and placed within /unix/pbt/software/src/xerces-c, create a build directory within the PBT software directory from which you can compile the code:
cd /unix/pbt/software/build/ mkdir xerces-c cd xerces-c
CMake
can then be used to configure and install Xerces-C
.
cmake ../../src/xerces-c ccmake .
The command ccmake .
opens an interactive GUI that can be used to specify installation options. From within this you can define your installation directory and configure any other options as required. On the PBT cluster it is required that the software is installed to the development directory, and so the CMAKE_INSTALL_PREFIX
is defined as follows:
CMAKE_INSTALL_PREFIX /unix/pbt/software/dev/xerces-c-3.2
- c to configure
- g to generate and exit
The software can then be installed using the usual commands:
make make install
Installation from source code
Source Code Extraction
cd /unix/pbt/software/src/geant4-prerequisites/xerces-c tar -xvz -f xerces-c-3.1.3.tar.gz
Build And Install
It is possible to build for the Production environment without deleting the Xerces-C build
directory created for the Development installation, meaning that significant time is saved when running make
.
However, it isn't recommended to do so as the Production installation ends up referencing components within /unix/pbt/software/dev
which is not desirable as the two environments are no longer independent.
As such, these instructions assume one is building from scratch for each environment: to do so, make sure that the build/qt
directory is deleted before recreating it for the subsequent build and install.
Also, although it is possible to install straight to the Production environment, it is highly discouraged to do so without first compiling a Development version.
Development Environment
cd /unix/pbt/software/build mkdir -pv xerces-c/xerces-c-3.1.3 cd xerces-c/xerces-c-3.1.3 ../../../src/geant4-prerequisites/xerces-c/xerces-c/configure --prefix /unix/pbt/software/dev/xerces-c-3.1.3 make make install
Production Environment
cd /unix/pbt/software/build mkdir -pv xerces-c/xerces-c-3.1.3 cd xerces-c/xerces-c-3.1.3 ../../../src/geant4-prerequisites/xerces-c/xerces-c/configure --prefix /unix/pbt/software/prod-sl6 make make install