Difference between revisions of "Compile the Code Engines"
Line 31: | Line 31: | ||
[http://xml.apache.org/xerces-c/index.html | xerces source code] from the [http://www.apache.org/ | Apache Software Foundation] web site and then building and installing <tt>xerces</tt> with the following steps (after seeing potential [[#MacOS X Lion or Newer Command Line Tools|startup issues on Lion or newer systems]]): | [http://xml.apache.org/xerces-c/index.html | xerces source code] from the [http://www.apache.org/ | Apache Software Foundation] web site and then building and installing <tt>xerces</tt> with the following steps (after seeing potential [[#MacOS X Lion or Newer Command Line Tools|startup issues on Lion or newer systems]]): | ||
<ol> | |||
<li>Open Terminal app and navigate to the xerces source folder expanded from the downloaded file.</li> | |||
<li>Configure the code with the command: | |||
<pre>./configure CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64"</pre> | <pre>./configure CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64"</pre> | ||
where the provided <tt>arch</tt> (or architecture) is the desired option for your machine. The main Mac options are <tt>i386</tt> for 32 bit Intel processors, <tt>x86_64</tt> for 64 bit Intel processors, <tt>ppc</tt> for 32 bit PowerPC chips, or <tt>ppc64</tt> for 64 bit PowerPC64 chips. Although <tt>i386</tt> will work on any Intel processor, you should use <tt>x86_64</tt> if you have a 64 bit processor, because the code will run faster. To determine how many bits your Intel chip has, chose "About This Mac" from the Apple menu, click "More Info..." button, and look up the processor name in the hardware section. The "Intel Core Solo" and "Intel Core Duo" are 32 bit chips and most others are 64 bit chips. | where the provided <tt>arch</tt> (or architecture) is the desired option for your machine. The main Mac options are <tt>i386</tt> for 32 bit Intel processors, <tt>x86_64</tt> for 64 bit Intel processors, <tt>ppc</tt> for 32 bit PowerPC chips, or <tt>ppc64</tt> for 64 bit PowerPC64 chips. Although <tt>i386</tt> will work on any Intel processor, you should use <tt>x86_64</tt> if you have a 64 bit processor, because the code will run faster. To determine how many bits your Intel chip has, chose "About This Mac" from the Apple menu, click "More Info..." button, and look up the processor name in the hardware section. The "Intel Core Solo" and "Intel Core Duo" are 32 bit chips and most others are 64 bit chips.</li> | ||
<li>When the configuration is done, use the following commands: | |||
<pre>cd src | <pre>cd src | ||
make | make | ||
make install</pre> | make install</pre> | ||
These | These commands make the library (but not the unneeded <tt>xerces</tt> examples). The final install command after <tt>make</tt> is done, installs both the library and the header files at the default locations listed above. If the <tt>make install</tt> shows a permission error, you can solve that by using <tt>sudo make install</tt> instead and provide your administrator password.</li> | ||
<li>When working with <tt>nairn-mpm-fea</tt> on a new Mac, the <tt>xerces</tt> installation only needs to be done once. The only reason to repeat it is when a new <tt>xerces</tt> version is available and/or the project requires a new version for compatibility.</li> | |||
</ol> | |||
==== MacOS X Command Line Compiling ==== | ==== MacOS X Command Line Compiling ==== | ||
==== MacOS X Lion or Newer Command Line Tools ==== | ==== MacOS X Lion or Newer Command Line Tools ==== |
Revision as of 10:20, 4 June 2013
After checking out the nairn-mpm-fea project, the next step is to compile it. All code-engine source code is standard C++ and it should be possible to compile on a variety of systems. This page gives details on some common systems. Users are responsible for compilation on other systems.
MacOS X Compiling
Using XCode
Most development of OSParticulas and NairnFEA is done in MacOS X and thus compiling on MacOS X is easy. The preferred method is to use XCode (a command-line method is described below). A complete XCode project is located at
nairn-mpm-fea/Common/Projects/NairnMPM.xcodeproj
This project is called NairnMPM, but it includes all MPM and FEA source code in two targets named NairnMPM and NairnFEA. Once xerces is installed, open the NairnMPM.xcodeproj to compile the code by:
- Select the target to compile - either NairnMPM or NairnFEA
- Choose build and they will compile and saved in XCode's derived data folder.
If a linking error occurs, you might have conflicting architectures between the XCode settings and the xerces library you installed. To fix this problem edit both the project and target settings and under the "Architectures" section, set the "Architectures" option to match the architecture you used when installing xerces or recompile xerces if needed.
Compiling Xerces on MacOS X
Before you can compile and run the project, however, you will need an installed version of the xerces library and a copy of the xerces header files. The XCode project and command-line method below both assume they are installed in the default locations for MacOS X or at
/usr/local/lib/libxerces-c.dylib
for the library and at
/usr/local/include
for the header files. These can be changed if needed by editing the project and target settings. Since revision 274 of the nairn-mpm-fea
project, this library must be xerces 3.0 or newer; prior to that revision, it had be xerces 2.8 or older. These libraries can be obtained by downloading the
| xerces source code from the | Apache Software Foundation web site and then building and installing xerces with the following steps (after seeing potential startup issues on Lion or newer systems):
- Open Terminal app and navigate to the xerces source folder expanded from the downloaded file.
- Configure the code with the command:
./configure CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64"
where the provided arch (or architecture) is the desired option for your machine. The main Mac options are i386 for 32 bit Intel processors, x86_64 for 64 bit Intel processors, ppc for 32 bit PowerPC chips, or ppc64 for 64 bit PowerPC64 chips. Although i386 will work on any Intel processor, you should use x86_64 if you have a 64 bit processor, because the code will run faster. To determine how many bits your Intel chip has, chose "About This Mac" from the Apple menu, click "More Info..." button, and look up the processor name in the hardware section. The "Intel Core Solo" and "Intel Core Duo" are 32 bit chips and most others are 64 bit chips. - When the configuration is done, use the following commands:
cd src make make install
These commands make the library (but not the unneeded xerces examples). The final install command after make is done, installs both the library and the header files at the default locations listed above. If the make install shows a permission error, you can solve that by using sudo make install instead and provide your administrator password. - When working with nairn-mpm-fea on a new Mac, the xerces installation only needs to be done once. The only reason to repeat it is when a new xerces version is available and/or the project requires a new version for compatibility.