Compiling in Linux
This page explains several methods to compile code engines in Linux systems.
Introduction
The nairn-mpm-fea code engines can easily be compiled on any Linux system with a C++ compiler and with xerces already installed. Below are details on specific systems that are already set up for compilation, already have xerces, and are currently in use for OSParticulas, NairnMPM, and NairnFEA. See the section on ][#Other Linux Systems|other systems]] for compilation on other Linux/Unix systems.
In brief, each system simply requires a custom argument to the make command. After compilation is over see below for generic details that apply to all system.
Carbon/Hedera Cluster (Oregon State University)
If you are using the Carbon/Hedera cluster in the Oregon State University, Wood Science & Engineering Department, use a simple make command. This system is the default system from compiling the code. The commands for OSParticulas and NairnMPM are:
cd nairn-mpm-fea/NairnMPM/build make
and for NairnFEA are:
cd nairn-mpm-fea/NairnFEA/build make
MPM Workstation (Oregon State University)
If you are using mpm in the Oregon State University, Wood Science & Engineering Department, the commands for OSParticulas and NairnMPM are:
cd nairn-mpm-fea/NairnMPM/build make SYSTEM=mpm
and for NairnFEA are:
cd nairn-mpm-fea/NairnFEA/build make SYSTEM=mpm
Zia Workstation (CISRO)
If you are using Zia Linux system, the commands for OSParticulas and NairnMPM are:
cd nairn-mpm-fea/NairnMPM/build make SYSTEM=zia
and for NairnFEA are:
cd nairn-mpm-fea/NairnFEA/build make SYSTEM=zia
Inferno (University of Utah)
If you are using Inferno in the University or Utah, CSAFE Group, the commands for OSParticulas and NairnMPM are:
cd nairn-mpm-fea/NairnMPM/build make SYSTEM=inferno
and for NairnFEA are:
cd nairn-mpm-fea/NairnFEA/build make SYSTEM=inferno
Compilation on Supported Linux Systems
The commands for the above system will compile all source code and install the executables in nairn-mpm-fea/NairnMPM/input or nairn-mpm-fea/NairnFEA/input, respectively.
Other Linux Systems
Compiling on any Linux/Unix system should be straightforward, with the most difficult step usually being installing and linking to the xerces
library. The key steps needed for successful compilation:
- Use a compatible
C++
compiler. The code has been tested with at leastgcc 3.2
throughgcc 4.3.1
). It is possible other compilers will need minor changes for compilation. - Validation and parsing of the
XML
files are handled using free third party software from the <a href="http://www.apache.org/">Apache Software Foundation</a> called the <a href="http://xml.apache.org/xerces-c/index.html">xerces
validating XML parser</a>. You will need to downloadxerces
and install it on your system. It is available in <a href="http://xml.apache.org/xerces-c/install.html">binary installs</a> for some systems (e.g., Linux and Windows). For others systems (e.g., MacOS X) you need to download the source code and <a href="http://xml.apache.org/xerces-c/build.html">build</a> it. Since revision 274 of thenairn-mpm-fea
project, the codes requirexerces 3.0
or newer. Prior to this revision, the codes requiedxerces 2.8
or older. Unfortunately, the new versions ofxerces
are not compatible with the older ones. - Compiling of
NairnMPM
orNairnFEA
needs access to all thexerces
header files. These are provided in thexerces
source code downloads. Even iff your system has the xerces binary installed, it may not have the header files. You can get them by <a href="http://xml.apache.org/dist/xerces-c/stable/">downloading the xerces source code</a>, even though you will not need to build it.
Once a suitable compiler, the xerces
binary, and xerces
header files are installed, compilation may require editing the makefile
s in the nairn-mpm-fea
folders. Specifically, you will need to edit the makefile
s in the build
directories (NairnMPM
and NairnFEA
) and set the following variables:
- The variable
CC
: set it to the desiredC++
compiler. - The variable
xercesSo
: set it to the path name to thexerces
library binary file. - The variable
headersPath
: set it to the path name to the folder containing thexercesc
folder of header files.
After setting the variables, use a standard make
command to compile the code.
Once the code is compiled, do a <a href="../running/index.html">test run</a> to verify it worked.
If it compiles, but will not load the xerces
library at runtime, you will have to find the system-dependent method to provide the path to the xerces
library and make sure the system can find the xerces
library.
If you successfully get the code compiled and running on a system that is not listed above, please send email to <a href="mailto:John.Nairn@oregonstate.edu">John.Nairn@oregonstate.edu</a> with the system name and step-by-step instructions for compiling and running the code.