<?xml version="1.0"?>
<oembed><version>1.0</version><provider_name>UCT HPC</provider_name><provider_url>https://ucthpc.uct.ac.za</provider_url><author_name>Timothy Carr</author_name><author_url>https://ucthpc.uct.ac.za/index.php/author/timothy-carr/</author_url><title>Compile / Install / Deploy OpenFOAM 2.0 - UCT HPC</title><type>rich</type><width>600</width><height>338</height><html>&lt;blockquote class="wp-embedded-content" data-secret="IgQYCAte0z"&gt;&lt;a href="https://ucthpc.uct.ac.za/index.php/2011/09/16/compile-install-deploy-openfoam-2-0/"&gt;Compile / Install / Deploy OpenFOAM 2.0&lt;/a&gt;&lt;/blockquote&gt;&lt;iframe sandbox="allow-scripts" security="restricted" src="https://ucthpc.uct.ac.za/index.php/2011/09/16/compile-install-deploy-openfoam-2-0/embed/#?secret=IgQYCAte0z" width="600" height="338" title="&#x201C;Compile / Install / Deploy OpenFOAM 2.0&#x201D; &#x2014; UCT HPC" data-secret="IgQYCAte0z" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"&gt;&lt;/iframe&gt;&lt;script type="text/javascript"&gt;
/*! This file is auto-generated */
!function(c,d){"use strict";var e=!1,o=!1;if(d.querySelector)if(c.addEventListener)e=!0;if(c.wp=c.wp||{},c.wp.receiveEmbedMessage);else if(c.wp.receiveEmbedMessage=function(e){var t=e.data;if(!t);else if(!(t.secret||t.message||t.value));else if(/[^a-zA-Z0-9]/.test(t.secret));else{for(var r,s,a,i=d.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=d.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=new RegExp("^https?:$","i"),l=0;l&lt;n.length;l++)n[l].style.display="none";for(l=0;l&lt;i.length;l++)if(r=i[l],e.source!==r.contentWindow);else{if(r.removeAttribute("style"),"height"===t.message){if(1e3&lt;(s=parseInt(t.value,10)))s=1e3;else if(~~s&lt;200)s=200;r.height=s}if("link"===t.message)if(s=d.createElement("a"),a=d.createElement("a"),s.href=r.getAttribute("src"),a.href=t.value,!o.test(a.protocol));else if(a.host===s.host)if(d.activeElement===r)c.top.location.href=t.value}}},e)c.addEventListener("message",c.wp.receiveEmbedMessage,!1),d.addEventListener("DOMContentLoaded",t,!1),c.addEventListener("load",t,!1);function t(){if(o);else{o=!0;for(var e,t,r,s=-1!==navigator.appVersion.indexOf("MSIE 10"),a=!!navigator.userAgent.match(/Trident.*rv:11\./),i=d.querySelectorAll("iframe.wp-embedded-content"),n=0;n&lt;i.length;n++){if(!(r=(t=i[n]).getAttribute("data-secret")))r=Math.random().toString(36).substr(2,10),t.src+="#?secret="+r,t.setAttribute("data-secret",r);if(s||a)(e=t.cloneNode(!0)).removeAttribute("security"),t.parentNode.replaceChild(e,t);t.contentWindow.postMessage({message:"ready",secret:r},"*")}}}}(window,document);
&lt;/script&gt;
</html><description>Big-Bytes decided to write up a quick tutorial on how to install OpenFOAM 2 in the user space. Administrators and users constantly battle with dependencies especially with the latest software releases. This problem begins when a system administrator installs and configures a Linux system. All is well in the beginning and users are happy but at some point the user will begin to complain about outdated software dependency versions. Some system dependencies can be upgraded rather quickly but others not and a user space compile is imminent. This was in the case of GCC, its linkers and the dependencies required to build GCC.OpenFoam 2 requires GCC 4.4 and above to compile correctly and on a Scientific Linux 5.4 system only GCC 4.1.2 was available. It is not recommended to upgrade a system-wide compiler such as GCC and its also not trivial to upgrade a linux machine while having to deal with the demands of users. Compile GCCCreate a directory $HOME/contrib and $HOME/contrib/build. You can of course name these directories anyway you like. Download all the dependencies for GCC. These are listed below and extract into contrib.GMP - http://gmplib.orgMPFR - http://www.mpfr.orgMPC - http://www.multiprecision.orgBinutils - http://www.gnu.org/software/binutilsBegin to compile the dependencies first before GCC. You may need to compile the GMP dependency first as the other dependencies depend on it.&nbsp; Dependency Compile and Install &nbsp;&nbsp;&nbsp; GMP: Extract with tar xfvz gmp.tar.gz Change into the directory and compile with ./configure --prefix=$HOME/contrib/gmp-complete make &amp;&amp; make install &nbsp;&nbsp;&nbsp;&nbsp; MPFR:Extract with tar xfvz mpfr.tar.gz Change into the directory and compile with ./configure --prefix=$HOME/contrib/mpfr-complete --with-gmp-build=&lt;directory in which the source is in, the extracted directory and not the compiled directory&gt;make &amp;&amp; make install &nbsp;&nbsp;&nbsp; MPC:Extract with tar xfvz mpc.tar.gz Change into the directory and compile with ./configure --prefix=$HOME/contrib/mpc-complete --with-gmp=$HOME/contrib/gmp-complete --with-mpfr=$HOME/contrib/mpfr-completemake &amp;&amp; make install&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; BinUtils:Extract with bunzip binutils &amp;&amp; tar xfv binutils.tar Change into the directory and compile with ./configure --prefix=$HOME/contrib/binutils-completemake &amp;&amp; make installmake target_header_dir=$HOME/binutils-complete/include -C libiberty&nbsp;&nbsp;&nbsp; Library and Path location updatesNow  that we have completed all the dependency requirements its important to  update the library paths and system paths. Add the following below to  $HOME/.bashrc ( User specific functions). LD_LIBRARY_PATH=$HOME/contrib/mpc-complete/lib:$HOME/contrib/mpfr-complete/lib:$HOME/contrib/gmp-complete/lib:$HOME/contrib/gcc-complete/lib/:$HOME/contrib/gcc-complete/lib64:$LD_LIBRARY_PATHCOMPILE_OF=$HOME/contrib/gcc-complete/bin:$HOME/contrib/gcc-complete/lib:$HOME/contrib/binutils-complete/binPATH=$COMPILE_OF:$PATHCPATH=$HOME/contrib/gcc-complete/includeLogout  and login to refresh the environment. Its important to execute the "  which ld " and " which gcc ". This will ensure that you have your  environment setup correctly. To confirm that you have the correct  version of GCC installed, execute " gcc --version " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Compile latest version of GCCDownload the latest version of GCC from a mirror site into $HOME/contrib and extract there. Change directory into the $HOME/contrib/build. Notice that we are NOT executing the "./configure" script from within the extracted directory but rather from a build directory. Its extremely important to adhere to this rule. cd $HOME/contrib/build../gcc-4.6.1/configure --prefix=$HOME/contrib/gcc-complete/ --enable-languages=c,c++ --with-gmp=$HOME/contrib/gmp-complete --with-mpc=$HOME/contrib/mpc-complete/ --with-mpfr=$HOME/contrib/mpfr-complete/&nbsp; ( NB: notice the importance of the two periods before the configure script )make -j 4 ( This assumes that you would like the compile of GCC to consume 4 CPU processors. make installmake clean ( This will erase all the intermediate files )$HOME/contrib/gcc-complete/bin/gcc &ndash;version should give show the correct version.&nbsp;Install and Compile OpenFOAM 2You will need to do this as your normal user, not root, in order to maintain access to gcc 4.6.&nbsp; Compile in $HOME as per default and copy the compiled package to the shared software area later.Create directory $HOME/OpenFOAMDownload the OpenFOAM2 and ThirdParty compression files from the OpenFOAM websiteExtract both into the $HOME/OpenFOAM directory with the " tar xfvz &lt;filename&gt;" commandChange directory into&nbsp; $HOME/OpenFOAM/OpenFOAM-2.0.1/etcOpen up the " bashrc " file and locate the " foamInstall=$HOME " variable. If you are installing OpenFOAM into a alternate location you may update the location here.&nbsp; Save the file and exitAdd the following to $HOME/.bashrc - "source&nbsp; $HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc"Set the following environment variable to get OpenFOAM to utilize the maximum number of CPU processors on the system. " export WM_NCOMPPROCS=4 "Change directory into $HOME/OpenFOAM/ThirdParty-2.0.1/Execute the file " ./Allwmake " When completed successfully execute "./$HOME/OpenFOAM/OpenFOAM-2.0.1/etc/bashrc". This will refresh the shell environment.Change directory into $HOME/OpenFOAM/OpenFOAM-2.0.1/ and execute " ./Allwmake " If all goes well you should have a fully compiled version of OpenFOAM. Tutorials are available on the OpenFOAM website. &nbsp;</description></oembed>
