Compiling in Windows
Windows Using cygwin
To compile and run in Windows, you need some kind of Linux/Unix environment. The recommended option is to use cygwin and this documentation is based on its use. This process has been verified in both Windows XP, Windows Vista and Windows 7 (although you may need the latest cygwin 1.7 for Windows 7).
Installing cygwin
First you need to set up your computer to use cygwin. Refer to the [[1]] for details.
Installing xerces
The first time you download the project, you will need to install xerces in your cygwin environment (if you already have xerces installed, you can <a href="#cygcc">skip to compiling now</a>). Although cygwin has an option to install the xerces binary, it usually has an out-dated version. You therefore will need to download the xerces source code, build it, and install it. Since revision 274 of the nairn-mpm-fea project, the code requires xerces 3.0 or newer. The procedure for xerces 3.0 or newer is:
- <a href="http://xerces.apache.org/xerces-c/download.cgi">Download the
xercessource code</a>, which will be in a file such asxerces-c-3.x.x.tar.gz(withxbeing some numbers). Note that you should get the.tar.gzfile instead of the.zipversion because the.zipversion has DOS files with carriage returns and line feeds (either in the source or inserted by Windows' zip methods) that may complicate compiliation. The.tar.gzfile is also smaller. - Move the downloaded file to a folder such as the root
cygwinfolder, which by default is at Windows pathC:\cygwin\(warning: thexercesinstall will fail if the path to the folder incygwincontains any spaces; if you use the recommended root folder, the path will be "/" which has no spaces and is therefore safe). - Start a
cygwinshell and and extract the files with:cd / gunzip xerces-c-3.x.x.tar.gz tar xvf xerces-c-3.x.xtar
where thex's are replaced by numbers in your downloaded file. - Go to the new folder and configure the code with:
cd xerces-c-3.x.x ./configure LDFLAGS=-no-undefined
This step will prepare the
xercessource code for building. Note: if you get error messages saying that $'\r'$ command is not found it means your files are DOS files rather than Unix files. Consult a Unix expert on how to fix them or go back to step1and get the.tar.gzfile this time. - When this configuring step is done, enter the commands
cd src make
This step will compilexercesand save the librarys in thexerces-c-3.x.x/.libsfolder. - Finally, enter the command "
make install" (still in the same folder). This step will install the compiledxerceslibraries and needed header files in the default locations of/usr/local/liband/usr/local/includefolders, respectively.
<a name="cygcc"></a>You are now ready to compile the nairn-mpm-fea code. In a cygwin shell, navigate to the checked out nairn-mpm-fea and proceed as follows. To compile NairnMPM use:
cd nairn-mpm-fea/NairnMPM/build make SYSTEM=cygwin
and to compile NairnFEA use:
cd nairn-mpm-fea/NairnFEA/build make SYSTEM=cygwin
All source code will be compiled and the executables will be installed in nairn-mpm-fea/NairnMPM/input or nairn-mpm-fea/NairnFEA/input, respectively. You can use an additional 'make install' command to copy each compiled executable to your ~/bin folder if desired.
If the command-line compile does not work, the most likely explanation is a problem with the xerces installation. You either have to install it as specified above or edit the makefile to recognize your custom installation. The process is documented in the makefile and involves editing the xercesSo and headersPath variables for your different settings. Another possible reason is a potential conflict with some cygwin/Windows combinations. If you get a linking error about undefined references to typeinfo, you have encountered a dynamic linking problem. It can be fixed by deleting the dynamic library at /usr/local/lib/libserces-c.dll.a and then use the 'make SYSTEM=cygwin' command to link again. This change will cause the code to link statically. The resulting executables will be much larger but should work fine.
Once the code is compiled, do a <a href="../running/index.html">test run</a> to verify it worked.