{"id":1043,"date":"2011-09-16T17:29:09","date_gmt":"2011-09-16T15:29:09","guid":{"rendered":"http:\/\/oldblogs.uct.ac.za\/blog\/big-bytes\/2011\/09\/16\/compile-install-deploy-openfoam-2.0-onto-the-sagrid"},"modified":"2015-08-14T13:22:20","modified_gmt":"2015-08-14T11:22:20","slug":"compile-install-deploy-openfoam-2-0","status":"publish","type":"post","link":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/","title":{"rendered":"Compile \/ Install \/ Deploy OpenFOAM 2.0"},"content":{"rendered":"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.\r\n\r\nOpenFoam 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.\r\n\r\n<u><strong><span style=\"font-size: medium;\">Compile GCC<\/span><\/strong><\/u>\r\n\r\nCreate a directory $HOME\/contrib and $HOME\/contrib\/build. You can of course name these directories anyway you like.\r\nDownload all the dependencies for GCC. These are listed below and extract into contrib.\r\n<ul>\r\n\t<li><a href=\"http:\/\/gmplib.org\/\">GMP - http:\/\/gmplib.org<\/a><\/li>\r\n\t<li><a href=\"http:\/\/www.mpfr.org\/\">MPFR - http:\/\/www.mpfr.org<\/a><\/li>\r\n\t<li><a href=\"http:\/\/www.multiprecision.org\/\">MPC - http:\/\/www.multiprecision.org<\/a><\/li>\r\n\t<li><a href=\"http:\/\/www.gnu.org\/software\/binutils\">Binutils - http:\/\/www.gnu.org\/software\/binutils<\/a><\/li>\r\n<\/ul>\r\nBegin to compile the dependencies first before GCC. You may need to compile the GMP dependency first as the other dependencies depend on it.\r\n\r\n<u><strong><span style=\"font-size: small;\">Dependency Compile and Install <\/span><\/strong><\/u>\r\n\r\n<strong>GMP: <\/strong>\r\n<ul>\r\n\t<li>Extract with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">tar xfvz gmp.tar.gz <\/span><\/li>\r\n\t<li>Change into the directory and compile with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">.\/configure --prefix=$HOME\/contrib\/gmp-complete<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make<\/span> &amp;&amp; <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make install <\/span><\/li>\r\n<\/ul>\r\n<strong>MPFR:<\/strong>\r\n<ul>\r\n\t<li>Extract with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">tar xfvz mpfr.tar.gz<\/span><\/li>\r\n\t<li>Change into the directory and compile with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">.\/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;<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make <\/span>&amp;&amp; <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make install <\/span><\/li>\r\n<\/ul>\r\n<strong>MPC:<\/strong>\r\n<ul>\r\n\t<li>Extract with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">tar xfvz mpc.tar.gz <\/span><\/li>\r\n\t<li>Change into the directory and compile with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">.\/configure --prefix=$HOME\/contrib\/mpc-complete --with-gmp=$HOME\/contrib\/gmp-complete --with-mpfr=$HOME\/contrib\/mpfr-complete<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make<\/span> &amp;&amp; <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make install<\/span><\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<strong>\u00a0\u00a0\u00a0\u00a0 BinUtils:<\/strong>\r\n<ul>\r\n\t<li>Extract with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">bunzip binutils &amp;&amp; tar xfv binutils.tar <\/span><\/li>\r\n\t<li>Change into the directory and compile with <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">.\/configure --prefix=$HOME\/contrib\/binutils-complete<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make<\/span> &amp;&amp; <span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make install<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make target_header_dir=$HOME\/binutils-complete\/include -C libiberty<\/span><\/li>\r\n<\/ul>\r\n<span style=\"font-size: small;\"><strong>\u00a0\u00a0\u00a0 <\/strong><u><strong>Library and Path location updates<\/strong><\/u><\/span>\r\n\r\nNow\r\nthat we have completed all the dependency requirements its important to\r\nupdate the library paths and system paths. Add the following below to\r\n$HOME\/.bashrc ( User specific functions).\r\n<span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">\r\n<\/span><strong><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">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_PATH<\/span><\/strong>\r\n\r\n<span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">COMPILE_OF=$HOME\/contrib\/gcc-complete\/bin:$HOME\/contrib\/gcc-complete\/lib:$HOME\/contrib\/binutils-complete\/bin\r\nPATH=$COMPILE_OF:$PATH\r\nCPATH=$HOME\/contrib\/gcc-complete\/include<\/span>\r\n\r\nLogout\r\nand login to refresh the environment. Its important to execute the \"\r\nwhich ld \" and \" which gcc \". This will ensure that you have your\r\nenvironment setup correctly. To confirm that you have the correct\r\nversion of GCC installed, execute \" gcc --version \"\r\n\r\n<span style=\"font-size: small;\"> <u><strong>Compile latest version of GCC<\/strong><\/u><\/span>\r\n<ul>\r\n\t<li>Download the <a href=\"http:\/\/gcc.gnu.org\/\">latest version of GCC<\/a> from a mirror site into $HOME\/contrib and extract there.<\/li>\r\n\t<li>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.<\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">cd $HOME\/contrib\/build<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">..\/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\/<\/span>\u00a0 ( NB: notice the importance of the two periods before the configure script )<\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make -j 4<\/span> ( This assumes that you would like the compile of GCC to consume 4 CPU processors.<\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make install<\/span><\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">make clean<\/span> ( This will erase all the intermediate files )<\/li>\r\n\t<li><span style=\"font-size: xx-small; font-family: arial,helvetica,sans-serif;\">$HOME\/contrib\/gcc-complete\/bin\/gcc \u2013version<\/span> should give show the correct version.<\/li>\r\n<\/ul>\r\n&nbsp;\r\n\r\n<u><strong><span style=\"font-size: medium;\">Install and Compile OpenFOAM 2<\/span><\/strong><\/u>\r\n\r\nYou will need to do this as your normal user, not root, in order to maintain access to gcc 4.6.\u00a0 Compile in $HOME as per default and copy the compiled package to the shared software area later.\r\n<ul>\r\n\t<li>Create directory $HOME\/OpenFOAM<\/li>\r\n\t<li>Download the OpenFOAM2 and ThirdParty compression files from the <a href=\"http:\/\/www.openfoam.com\/\">OpenFOAM website<\/a><\/li>\r\n\t<li>Extract both into the $HOME\/OpenFOAM directory with the \" tar xfvz &lt;filename&gt;\" command<\/li>\r\n\t<li>Change directory into\u00a0 $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc<\/li>\r\n\t<li>Open 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.<\/li>\r\n\t<li>Save the file and exit<\/li>\r\n\t<li>Add the following to $HOME\/.bashrc - \"source\u00a0 $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc\/bashrc\"<\/li>\r\n\t<li>Set the following environment variable to get OpenFOAM to utilize the maximum number of CPU processors on the system. \" export WM_NCOMPPROCS=4 \"<\/li>\r\n\t<li>Change directory into $HOME\/OpenFOAM\/ThirdParty-2.0.1\/<\/li>\r\n\t<li>Execute the file \" .\/Allwmake \"<\/li>\r\n\t<li>When completed successfully execute \".\/$HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc\/bashrc\". This will refresh the shell environment.<\/li>\r\n\t<li>Change directory into $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/ and execute \" .\/Allwmake \"<\/li>\r\n<\/ul>\r\nIf all goes well you should have a fully compiled version of OpenFOAM. Tutorials are available on the OpenFOAM website.\r\n\r\n&nbsp;","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n<p>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. <\/p>\n<p><u><strong><span>Compile GCC<\/span><\/strong><\/u><\/p>\n<p>Create a directory $HOME\/contrib and $HOME\/contrib\/build. You can of course name these directories anyway you like. <br \/>Download all the dependencies for GCC. These are listed below and extract into contrib.<\/p>\n<ul>\n<li><a href=\"http:\/\/gmplib.org\/\">GMP &#8211; http:\/\/gmplib.org<\/a><\/li>\n<li><a href=\"http:\/\/www.mpfr.org\/\">MPFR &#8211; http:\/\/www.mpfr.org<\/a><\/li>\n<li><a href=\"http:\/\/www.multiprecision.org\/\">MPC &#8211; http:\/\/www.multiprecision.org<\/a><\/li>\n<li><a href=\"http:\/\/www.gnu.org\/software\/binutils\">Binutils &#8211; http:\/\/www.gnu.org\/software\/binutils<\/a><\/li>\n<\/ul>\n<p>Begin to compile the dependencies first before GCC. You may need to compile the GMP dependency first as the other dependencies depend on it.&nbsp; <\/p>\n<p><u><strong><span>Dependency Compile and Install <\/span><\/strong><\/u><\/p>\n<p>&nbsp;&nbsp;&nbsp; <strong>GMP: <\/strong><\/p>\n<ul>\n<li>Extract with <span>tar xfvz gmp.tar.gz <\/span><\/li>\n<li>Change into the directory and compile with <span>.\/configure &#8211;prefix=$HOME\/contrib\/gmp-complete<\/span> <\/li>\n<li><span>make<\/span> &amp;&amp; <span>make install <\/span><\/li>\n<\/ul>\n<p>&nbsp;&nbsp;&nbsp;&nbsp; <strong>MPFR:<\/strong><\/p>\n<ul>\n<li>Extract with <span>tar xfvz mpfr.tar.gz<\/span> <\/li>\n<li>Change into the directory and compile with <span>.\/configure &#8211;prefix=$HOME\/contrib\/mpfr-complete &#8211;with-gmp-build=&lt;directory in which the source is in, the extracted directory and not the compiled directory&gt;<\/span><\/li>\n<li><span>make <\/span>&amp;&amp; <span>make install <\/span><\/li>\n<\/ul>\n<p>&nbsp;&nbsp;&nbsp; <strong>MPC:<\/strong><\/p>\n<ul>\n<li>Extract with <span>tar xfvz mpc.tar.gz <\/span><\/li>\n<li>Change into the directory and compile with <span>.\/configure &#8211;prefix=$HOME\/contrib\/mpc-complete &#8211;with-gmp=$HOME\/contrib\/gmp-complete &#8211;with-mpfr=$HOME\/contrib\/mpfr-complete<\/span><\/li>\n<li><span>make<\/span> &amp;&amp; <span>make install<\/span><\/li>\n<\/ul>\n<p>&nbsp;&nbsp;&nbsp; <strong><\/strong><\/p>\n<p><strong>&nbsp;&nbsp;&nbsp;&nbsp; BinUtils:<\/strong><\/p>\n<ul>\n<li>Extract with <span>bunzip binutils &amp;&amp; tar xfv binutils.tar <\/span><\/li>\n<li>Change into the directory and compile with <span>.\/configure &#8211;prefix=$HOME\/contrib\/binutils-complete<\/span><\/li>\n<li><span>make<\/span> &amp;&amp; <span>make install<\/span><\/li>\n<li><span>make target_header_dir=$HOME\/binutils-complete\/include -C libiberty<\/span><\/li>\n<\/ul>\n<p><span><strong><span>&nbsp;&nbsp;&nbsp; <\/span><\/strong><u><strong><span>Library and Path location updates<\/span><\/strong><\/u><\/span><\/p>\n<p>Now<br \/>\n that we have completed all the dependency requirements its important to<br \/>\n update the library paths and system paths. Add the following below to<br \/>\n$HOME\/.bashrc ( User specific functions). <br \/><span><br \/><\/span><strong><span>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_PATH<\/span><\/p>\n<p><span>COMPILE_OF=$HOME\/contrib\/gcc-complete\/bin:$HOME\/contrib\/gcc-complete\/lib:$HOME\/contrib\/binutils-complete\/bin<br \/>PATH=$COMPILE_OF:$PATH<br \/>CPATH=$HOME\/contrib\/gcc-complete\/include<\/span><\/strong><\/p>\n<p>Logout<br \/>\n and login to refresh the environment. Its important to execute the &#8221;<br \/>\nwhich ld &#8221; and &#8221; which gcc &#8220;. This will ensure that you have your<br \/>\nenvironment setup correctly. To confirm that you have the correct<br \/>\nversion of GCC installed, execute &#8221; gcc &#8211;version &#8221; <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span> <u><strong>Compile latest version of GCC<\/strong><\/u><\/span><\/p>\n<ul>\n<li>Download the <a href=\"http:\/\/gcc.gnu.org\/\">latest version of GCC<\/a> from a mirror site into $HOME\/contrib and extract there. <\/li>\n<li>Change directory into the $HOME\/contrib\/build. Notice that we are NOT executing the &#8220;.\/configure&#8221; script from within the extracted directory but rather from a build directory. Its extremely important to adhere to this rule. <\/li>\n<li><span>cd $HOME\/contrib\/build<\/span><\/li>\n<li><span>..\/gcc-4.6.1\/configure &#8211;prefix=$HOME\/contrib\/gcc-complete\/ &#8211;enable-languages=c,c++ &#8211;with-gmp=$HOME\/contrib\/gmp-complete &#8211;with-mpc=$HOME\/contrib\/mpc-complete\/ &#8211;with-mpfr=$HOME\/contrib\/mpfr-complete\/<\/span>&nbsp; ( NB: notice the importance of the two periods before the configure script )<\/li>\n<li><span>make -j 4<\/span> ( This assumes that you would like the compile of GCC to consume 4 CPU processors. <\/li>\n<li><span>make install<\/span><\/li>\n<li><span>make clean<\/span> ( This will erase all the intermediate files )<\/li>\n<li><span>$HOME\/contrib\/gcc-complete\/bin\/gcc &ndash;version<\/span> should give show the correct version.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><u><strong><span>Install and Compile OpenFOAM 2<\/span><\/strong><\/u><\/p>\n<p>You 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.<\/p>\n<ul>\n<li>Create directory $HOME\/OpenFOAM<\/li>\n<li>Download the OpenFOAM2 and ThirdParty compression files from the <a href=\"http:\/\/www.openfoam.com\/\">OpenFOAM website<\/a><\/li>\n<li>Extract both into the $HOME\/OpenFOAM directory with the &#8221; tar xfvz &lt;filename&gt;&#8221; command<\/li>\n<li>Change directory into&nbsp; $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc<\/li>\n<li>Open up the &#8221; bashrc &#8221; file and locate the &#8221; foamInstall=$HOME &#8221; variable. If you are installing OpenFOAM into a alternate location you may update the location here.&nbsp; <\/li>\n<li>Save the file and exit<\/li>\n<li>Add the following to $HOME\/.bashrc &#8211; &#8220;source&nbsp; $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc\/bashrc&#8221;<\/li>\n<li>Set the following environment variable to get OpenFOAM to utilize the maximum number of CPU processors on the system. &#8221; export WM_NCOMPPROCS=4 &#8220;<\/li>\n<li>Change directory into $HOME\/OpenFOAM\/ThirdParty-2.0.1\/<\/li>\n<li>Execute the file &#8221; .\/Allwmake &#8221; <\/li>\n<li>When completed successfully execute &#8220;.\/$HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc\/bashrc&#8221;. This will refresh the shell environment.<\/li>\n<li>Change directory into $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/ and execute &#8221; .\/Allwmake &#8221; <\/li>\n<\/ul>\n<p>If all goes well you should have a fully compiled version of OpenFOAM. Tutorials are available on the OpenFOAM website. <\/p>\n<p>&nbsp;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9,8],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Compile \/ Install \/ Deploy OpenFOAM 2.0 - UCT HPC<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Compile \/ Install \/ Deploy OpenFOAM 2.0 - UCT HPC\" \/>\n<meta property=\"og:description\" content=\"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 &quot;  which ld &quot; and &quot; which gcc &quot;. This will ensure that you have your  environment setup correctly. To confirm that you have the correct  version of GCC installed, execute &quot; gcc --version &quot; &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 &quot;.\/configure&quot; 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 &quot; tar xfvz &lt;filename&gt;&quot; commandChange directory into&nbsp; $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etcOpen up the &quot; bashrc &quot; file and locate the &quot; foamInstall=$HOME &quot; 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 - &quot;source&nbsp; $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc\/bashrc&quot;Set the following environment variable to get OpenFOAM to utilize the maximum number of CPU processors on the system. &quot; export WM_NCOMPPROCS=4 &quot;Change directory into $HOME\/OpenFOAM\/ThirdParty-2.0.1\/Execute the file &quot; .\/Allwmake &quot; When completed successfully execute &quot;.\/$HOME\/OpenFOAM\/OpenFOAM-2.0.1\/etc\/bashrc&quot;. This will refresh the shell environment.Change directory into $HOME\/OpenFOAM\/OpenFOAM-2.0.1\/ and execute &quot; .\/Allwmake &quot; If all goes well you should have a fully compiled version of OpenFOAM. Tutorials are available on the OpenFOAM website. &nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\" \/>\n<meta property=\"og:site_name\" content=\"UCT HPC\" \/>\n<meta property=\"article:published_time\" content=\"2011-09-16T15:29:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-08-14T11:22:20+00:00\" \/>\n<meta name=\"author\" content=\"Timothy Carr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Timothy Carr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\"},\"author\":{\"name\":\"Timothy Carr\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#\/schema\/person\/41f6cd039836d7741f2b82a7b7cfe8d0\"},\"headline\":\"Compile \/ Install \/ Deploy OpenFOAM 2.0\",\"datePublished\":\"2011-09-16T15:29:09+00:00\",\"dateModified\":\"2015-08-14T11:22:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\"},\"wordCount\":837,\"publisher\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#organization\"},\"articleSection\":[\"application\",\"programming\"],\"inLanguage\":\"en-ZA\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\",\"url\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\",\"name\":\"Compile \/ Install \/ Deploy OpenFOAM 2.0 - UCT HPC\",\"isPartOf\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#website\"},\"datePublished\":\"2011-09-16T15:29:09+00:00\",\"dateModified\":\"2015-08-14T11:22:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/#breadcrumb\"},\"inLanguage\":\"en-ZA\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ucthpc.uct.ac.za\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Compile \/ Install \/ Deploy OpenFOAM 2.0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#website\",\"url\":\"https:\/\/ucthpc.uct.ac.za\/\",\"name\":\"UCT HPC\",\"description\":\"University of Cape Town High Performance Computing\",\"publisher\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ucthpc.uct.ac.za\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-ZA\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#organization\",\"name\":\"University of Cape Town High Performance Computing\",\"url\":\"https:\/\/ucthpc.uct.ac.za\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-ZA\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ucthpc.uct.ac.za\/wp-content\/uploads\/2015\/09\/logocircless.png\",\"contentUrl\":\"https:\/\/ucthpc.uct.ac.za\/wp-content\/uploads\/2015\/09\/logocircless.png\",\"width\":450,\"height\":423,\"caption\":\"University of Cape Town High Performance Computing\"},\"image\":{\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#\/schema\/person\/41f6cd039836d7741f2b82a7b7cfe8d0\",\"name\":\"Timothy Carr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-ZA\",\"@id\":\"https:\/\/ucthpc.uct.ac.za\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7e94dcf3a408e6ada008042fc29d4b15?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7e94dcf3a408e6ada008042fc29d4b15?s=96&d=mm&r=g\",\"caption\":\"Timothy Carr\"},\"sameAs\":[\"http:\/\/ucthpc.uct.ac.za\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Compile \/ Install \/ Deploy OpenFOAM 2.0 - UCT HPC","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/","og_locale":"en_US","og_type":"article","og_title":"Compile \/ Install \/ Deploy OpenFOAM 2.0 - UCT HPC","og_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;","og_url":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/","og_site_name":"UCT HPC","article_published_time":"2011-09-16T15:29:09+00:00","article_modified_time":"2015-08-14T11:22:20+00:00","author":"Timothy Carr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Timothy Carr","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/#article","isPartOf":{"@id":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/"},"author":{"name":"Timothy Carr","@id":"https:\/\/ucthpc.uct.ac.za\/#\/schema\/person\/41f6cd039836d7741f2b82a7b7cfe8d0"},"headline":"Compile \/ Install \/ Deploy OpenFOAM 2.0","datePublished":"2011-09-16T15:29:09+00:00","dateModified":"2015-08-14T11:22:20+00:00","mainEntityOfPage":{"@id":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/"},"wordCount":837,"publisher":{"@id":"https:\/\/ucthpc.uct.ac.za\/#organization"},"articleSection":["application","programming"],"inLanguage":"en-ZA"},{"@type":"WebPage","@id":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/","url":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/","name":"Compile \/ Install \/ Deploy OpenFOAM 2.0 - UCT HPC","isPartOf":{"@id":"https:\/\/ucthpc.uct.ac.za\/#website"},"datePublished":"2011-09-16T15:29:09+00:00","dateModified":"2015-08-14T11:22:20+00:00","breadcrumb":{"@id":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/#breadcrumb"},"inLanguage":"en-ZA","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ucthpc.uct.ac.za\/index.php\/2011\/09\/16\/compile-install-deploy-openfoam-2-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ucthpc.uct.ac.za\/"},{"@type":"ListItem","position":2,"name":"Compile \/ Install \/ Deploy OpenFOAM 2.0"}]},{"@type":"WebSite","@id":"https:\/\/ucthpc.uct.ac.za\/#website","url":"https:\/\/ucthpc.uct.ac.za\/","name":"UCT HPC","description":"University of Cape Town High Performance Computing","publisher":{"@id":"https:\/\/ucthpc.uct.ac.za\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ucthpc.uct.ac.za\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-ZA"},{"@type":"Organization","@id":"https:\/\/ucthpc.uct.ac.za\/#organization","name":"University of Cape Town High Performance Computing","url":"https:\/\/ucthpc.uct.ac.za\/","logo":{"@type":"ImageObject","inLanguage":"en-ZA","@id":"https:\/\/ucthpc.uct.ac.za\/#\/schema\/logo\/image\/","url":"https:\/\/ucthpc.uct.ac.za\/wp-content\/uploads\/2015\/09\/logocircless.png","contentUrl":"https:\/\/ucthpc.uct.ac.za\/wp-content\/uploads\/2015\/09\/logocircless.png","width":450,"height":423,"caption":"University of Cape Town High Performance Computing"},"image":{"@id":"https:\/\/ucthpc.uct.ac.za\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/ucthpc.uct.ac.za\/#\/schema\/person\/41f6cd039836d7741f2b82a7b7cfe8d0","name":"Timothy Carr","image":{"@type":"ImageObject","inLanguage":"en-ZA","@id":"https:\/\/ucthpc.uct.ac.za\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7e94dcf3a408e6ada008042fc29d4b15?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7e94dcf3a408e6ada008042fc29d4b15?s=96&d=mm&r=g","caption":"Timothy Carr"},"sameAs":["http:\/\/ucthpc.uct.ac.za"]}]}},"_links":{"self":[{"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/posts\/1043"}],"collection":[{"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/comments?post=1043"}],"version-history":[{"count":2,"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/posts\/1043\/revisions"}],"predecessor-version":[{"id":2208,"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/posts\/1043\/revisions\/2208"}],"wp:attachment":[{"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/media?parent=1043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/categories?post=1043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ucthpc.uct.ac.za\/index.php\/wp-json\/wp\/v2\/tags?post=1043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}