Skip to content
Snippets Groups Projects
Forked from Nektar / Nektar
15270 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
compile_osx.html 22.45 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" -->
    
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    
  <link rel="shortcut icon" href="images/favicon.ico">
<!-- InstanceBeginEditable name="doctitle" -->
    


    
  <title>Nektar++ - OS X Compile Instructions</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" href="style.css">
  <style type="text/css">
<!--
#menu_CompileOSX {
	font-weight: bold;
}
-->
  </style><!-- InstanceEndEditable --><!--[if IE]>
    <style type="text/css"> 
      .twoColHybLt #sidebar1 { padding-top: 30px; margin-top: 20px; }
      .twoColHybLt #mainContent { zoom: 1; padding-top: 15px; }
    </style>
    <![endif]--><!-- InstanceParam name="LibraryMenu" type="boolean" value="false" --><!-- InstanceParam name="CompileMenu" type="boolean" value="true" -->
</head>


  <body class="twoColHybLt">

    
<div id="container">
      
<div id="sidebar1">
        
<h3 style="text-align: center;"><a href="index.html" id="menu_Nektar"><img src="images/nektar.png" alt="Nektar++" height="38" width="155"></a></h3>


<p><a href="downloads.html" id="menu_Downloads">Downloads</a></p>
<p><a href="compile.html" id="menu_Compile">Compilation Instructions</a>
          <br/>
          &nbsp;&nbsp;&nbsp;<a href="compile_linux.html" id="menu_CompileLinux">Linux</a><br/>
          &nbsp;&nbsp;&nbsp;<a href="compile_windows.html" id="menu_CompileWindows">Windows</a><br/>
          &nbsp;&nbsp;&nbsp;<a href="compile_osx.html" id="menu_CompileOSX">Mac OS X</a><br/>
          &nbsp;&nbsp;&nbsp;<a href="compile_unit_tests.html" id="menu_CompileUnitTests">Unit Tests</a><br/>
          &nbsp;&nbsp;&nbsp;<a href="compile_regression_tests.html" id="menu_CompileRegressionTests">Regression Tests</a><br/>
          &nbsp;&nbsp;&nbsp;<a href="compile_documentation.html" id="menu_CompileDocumentation">Documentation</a><br/>
    </p>
<p><a href="usage.html" id="menu_Usage">Example Usage</a></p>
<p><a href="educational_material.html" id="menu_EducationalMaterial">Educational
Material</a></p>
<p><a href="code/index.html" id="menu_Library">Documentation</a></p>
<p><a href="team.html" id="menu_Team">Team Members</a></p>
<p><a href="publications.html" id="menu_Publications">Publications</a></p>
<p><a href="license.html" id="menu_License">License</a></p>
<p><a href="acknowledgments.html" id="menu_Acknowledgments">Acknowledgments</a></p>
<p><a href="mailto:nektar-inquiry@sci.utah.edu" id="menu_Contact">Contact</a></p>
        
<p style="font-size: 9px;">Last Revision:<br>
$Date: 2010/01/11 18:36:38 $</p>

      </div>

      
<div id="mainContent">
        <!-- InstanceBeginEditable name="Title" -->
    
<h1>Compile Instructions</h1>

	
<h2>Mac OS X - GCC / Xcode</h2>

      
<hr>

 
<ul>
  <li>
    <h3 align="left"><small><a href="#Setting_up_GCC">Setting up GCC</a></small></h3>
  </li>
  <li>
    <h3 align="left"><small><a href="#Organizing_the_ThirdParty_Source_Files">Organizing the ThirdParty Source Files</a></small></h3>
  </li>
  <li>
    <h3><small><a href="#Generating_the_GCC_Makefiles_with_CMake">Generating the GCC Makefiles with CMake</a></small></h3>
  </li>
  <li>
    <h3><small><a href="#Compiling_the_library_">Compiling the library</a></small></h3>
  </li>
  <li>
    <h3><a href="#Compiling_the_Solvers_and_Utilities"><small>Compiling the Solvers and Utilities</small></a></h3>
  </li>
  <li>
    <h3><a href="#Compiling_Regression_Tests"><small>Compiling the Regression Tests</small></a></h3>
  </li>
</ul>

        
<hr>
        <!-- InstanceBeginEditable name="BodyText" -->
        
<h3 align="left"><a name="Setting_up_GCC"></a>Setting up GCC</h3>

        
<p align="left">In order to compile Nektar++, you must have GCC installed.
The GCC compiler comes with Apple's XCode package. You can download
this from <a href="http://connect.apple.com/" target="_blank">http://connect.apple.com/</a> (you are required to have an Apple Developer Connection account).</p>

        
<h3 align="left"><a name="Organizing_the_ThirdParty_Source_Files"></a>Organizing the ThirdParty Source Files</h3>

        
<p align="left">You will be given a <em>Nektar++</em> directory and a <em>ThirdParty</em>
directory (includes needed libraries from other sources). These need to
be organized into the correct directory hierarchy for CMake to find all
of the required files. I will indicate a directory by following its
name with a forward slash.</p>

        
<ol>

          <li>Put the <em>ThirdParty/</em> directory in <em>Nektar++/</em>. (This will mean <em>library/</em> and <em>ThirdParty/</em> are both sub-directories of the original <em>Nektar++/</em>.)</li>

          <li>At the terminal in <em>ThirdParty/</em>, extract the tinyxml_2_4_3.zip archive with 
<div class="code"><pre>unzip tinyxml_2_4_3.zip</pre></div>
This will create <em>tinyxml/</em>. </li>

          <li>Extract the loki-0.1.3.tar.bz2 archive with 
<div class="code"><pre>tar -xjvf loki-0.1.3.tar.bz2</pre></div>
This will create <em>loki-0.1.3/</em>.
           

          </li>

          <li>CMake is an open-source, cross-platform make file
generator system. It can be used to generate the correct GCC Makefiles.
We must now build the CMake executable.
    <ol>

              <li>In <em>ThirdParty/</em>, extract the CMake.tar.bz2 archive with 
<div class="code"><pre>tar -xjvf CMake.tar.bz2</pre></div></li>

              <li>Change to the <em>CMake/</em> directory, and type
<div class="code"><pre>./configure</pre></div> 
After configuration is complete,
type <div class="code"><pre>make</pre></div></li>

            
    </ol>

          </li>

          <li>In <em>ThirdParty/</em>, extract the zlib-1.2.3.tar.bz2 archive with 
<div class="code"><pre>tar -xjvf zlib-1.2.3.tar.bz2</pre></div>
This will create <em>zlib-1.2.3/</em>.
            
    <ol>

                <li>You must set the ZLIB_SOURCE and NO_BZIP2 environment variables in order to tell Boost (step 7) to use zlib and not bzip2.
                  
        <ul>

                      <li>Bash or KSH Shells<br>

                        Type 
<div class="code"><pre>export ZLIB_SOURCE=../../../../zlib-1.2.3<br>export NO_BZIP2=0</pre></div></li>

                    <li>CSH or Tcsh Shells<br>

                      Type 
<div class="code"><pre>setenv ZLIB_SOURCE ../../../../zlib-1.2.3<br>setenv NO_BZIP2 0</pre></div></li>

                  
        </ul>

                </li>

            
    </ol>

          </li>

          <li>The next step is to compile bjam, which will allow for the building and installation of Boost.
            
    <ol>

              <li>In <em>ThirdParty/</em>, extract the boost-jam-3.1.17.tgz archive with 
<div class="code"><pre>tar -xzvf boost-jam-3.1.17.tgz</pre></div>
This will create <em>boost-jam-3.1.17/</em>.</li>

              <li>Change to the <em>boost-jam-3.1.17/</em> directory and type 
<div class="code"><pre>./build.sh</pre></div> to build the bjam executable</li>

            
    </ol>

          </li>

          <li>The next step is to extract and compile the correct libraries for <em>Boost</em>.
            
    <ol>

                <li>In <em>ThirdParty/</em>, extract the boost_1_40_0.tar.bz2 archive with 
<div class="code"><pre>tar -xjvf boost_1_40_0.tar.bz2</pre></div>
This will create <em>boost_1_40_0/</em>.</li>
              <li>Change to the <em>boost_1_40_0/</em> directory, and
type
<div class="code"><pre>../boost-jam-3.1.17/bin.macosxx86/bjam --prefix=../boost --build-type=complete --with-thread --with-iostreams --with-test --with-date_time --with-filesystem --with-system --layout=versioned --toolset=darwin install</pre></div>
This will place the
compiled libraries and include files in the correct
path. (<em>Note:</em> that for a 64 bit operating system, such as Mac
OSX 10.6, it may be necessary to use "../boost-jam-3.1.17/bin.macosxx86_64/bjam" instead of
"../boost-jam-3.1.17/bin.macosxx86/bjam")
        <ol>

                      <li>The "--with-*" compiles Boost with only the
libraries required by Nektar++. This is just meant to save time. You
can leave the flag off and it will compile all the libraries, if you
wish</li>

                
        </ol>

              </li>

            
    </ol>

          </li>

	        <li>The following step is to extract and compile the sparse matrix library developed by <em>NIST</em>. (For more information about this library, see <a href="http://math.nist.gov/spblas/original.html" target="_blank">http://math.nist.gov/spblas/original.html</a>)
                  
                  <ol>
                    
                    <li>In <em>ThirdParty/</em>, extract the
                      spblastk0.9b.tar.bz2 archive with 
		      <div class="code"><pre>tar -xjvf spblastk0.9b.tar.bz2</pre></div>
                      This will create the directory <em>spblastk0.9b/</em>.</li>
                    
                    <li>Change to the directory <em>spblastk0.9b/build/</em></li>
                    
                    <li>Compile the library using the previously installed <em>CMake</em></li>
                    
                    
                    <ol>
                      
		      <li>Generate the makefiles using the command <div class="code"><pre>../../CMake/bin/cmake ../</pre></div></li>
                      
		      <li>Build and install the library by typing <div class="code"><pre>make install</pre></div></li>
                      
                      
                    </ol>
                    
                    
                    
                  </ol>
                  
	        </li>

	        <li>
                  The last step is to extract and compile the graph partitioning package <em>METIS</em>. As we use a modified version of the 
                  standard METIS distribution, you are required to link against this version rather than the standard version possibly
                  available on your system. (For more information about the original METIS library, see <a href="http://www.cs.umn.edu/~karypis/metis" 
                                                                                                           target="_blank">http://www.cs.umn.edu/~karypis/metis</a>,
                  for more information about the modified version, click <a href="./metisandnektar++.txt" 
                                                                            target="_blank">here</a>)
                  
                  <ol>
                    
                    <li>
                      In <em>ThirdParty/</em>, extract the modmetis-4.0.tar.bz2 archive with <div class="code"><pre>tar -xjvf  modmetis-4.0.tar.bz2</pre></div> This will create the directory <em>modmetis-4.0/</em>.
                    </li>
                    
                    <li>
                      Change to the directory <em>modmetis-4.0/build/</em>
                    </li>
                    
                    <li>Compile the library using the previously installed <em>CMake</em></li>
                    
                    
                    <ol>
                      
		      <li>Generate the makefiles using the command <div class="code"><pre>../../CMake/bin/cmake ../</pre></div></li>
                      
		      <li>Build and install the library by typing <div class="code"><pre>make install</pre></div> </li>
                      
                      
                    </ol>
                    
                    
                    
                  </ol>
                  
	        </li>
                
                
    </ol>
    
    
    <h3><a name="Generating_the_GCC_Makefiles_with_CMake"></a>Generating the GCC Makefiles with CMake</h3>

        
<p>Now that all of the required libraries are setup in the correct
paths, we can use CMake to generate the Makefiles that GCC requires, or
the project files that Xcode requires.</p>

        
<ol>

          <li>From the terminal, change to the directory <em>Nektar++/builds/</em>. This is the directory where the library will be built.</li>

          <li>CMake can generate both GCC Makefiles, or Xcode project files.
            
    <ul>

                <li>GCC Makefiles
                  
        <ul>

                      <li>Type in <div class="code"><pre>../ThirdParty/CMake/bin/cmake -i ../library/</pre></div>
                        
            <ul>

                            <li>The "-i" indicates that you want to use the wizard mode.</li>

                        
            </ul>

                      </li>

                      <li>Would you like to see advanced options? <strong>No</strong></li>

                  
        </ul>

                </li>

              <li>Xcode Project Files
                
        <ul>

                      <li>Type in <div class="code"><pre>../ThirdParty/CMake/bin/cmake -i -G Xcode ../library/</pre></div>
                        
            <ul>
                          <li>The "-i" indicates that you want to use the wizard mode.</li>

                        
            </ul>

                  </li>

                      <li>Would you like to see advanced options? <strong>No</strong></li>

                
        </ul>

              </li>

            
    </ul>

          </li>

          <li>For most of the questions, you will be able to select
the default value by just pressing enter. Most of the configuration
will be locating the files you setup earlier in <em>ThirdParty/</em>,
but it should find these files automatically. If you have a different
setup, you may need to enter the paths manually if they couldn't be
found. Below I will list some of the options that you need to pay
attention to.
    <ul>
      <li><strong>CMAKE_BUILD_TYPE</strong>
                
        <ul>

                  <li>This option sets the appropriate GCC flags for
the different build types: Debug, Release, etc. For this tutorial, I'll
choose Release, in order to get full optimizations.</li>

                
        </ul>

              </li>

      <!--      <li><strong>EXECUTABLE_OUTPUT_PATH</strong>
                  
        <ul>

                    <li>This is the path GCC will put the generated executable files - it can be anywhere you wish.</li>

                  
        </ul>

            </li>

            <li><strong>LIBRARY_OUTPUT_PATH</strong>
                  
        <ul>

                    <li>This is the path GCC will put the generated *.a library files.</li>

                  
        </ul> -->

            </li>

            
    </ul>

          </li>

        
</ol>
        
<h3><a name="Compiling_the_library_"></a>Compiling the library&nbsp;</h3>

        
<p>Now that CMake generated the appropriate Makefiles, it can be
compiled with GCC. If you chose to generate a Xcode project, you can
open <em>Nektar++.xcodeproj/</em> now, and skip the GCC instructions below.</p>

        
<ol>

          <li>To compile the project, simply type <div class="code"><pre>make</pre></div> from the project directory (i.e. <em>Nektar++/builds/</em>).
            
    <ul>

                <li>If you have multiple processors/cores, it might be
beneficial to use <div class="code"><pre>make -j &lt;num_procs/cores&gt;</pre></div> The "-j" options
starts that many jobs, so all of the processors will be utilized, and
it will compile faster</li>

            
    </ul>

          </li>

        <!--  <li>The executable files will be located in the path you specified in the CMake utility.</li> -->
  <li>Type <div class="code"><pre>make install</pre></div> to put all of the compiled
libraries into a dist directory that can then be used by the solvers
and utilities</li>

        
</ol>

        
<h3><a name="Compiling_the_Solvers_and_Utilities"></a>Compiling the Solvers and Utilities</h3>
<br>
To compile the solvers and the utilities you first need to have
compiled the library and typed "make install" to place all of the
Nektar++ and ThirdParty libraries into the dist directory under the
library builds directory (i.e. <em>Nektar++/Builds/dist</em>)</br>
<p>Once again we use CMake to generate the Makefiles that GCC requires, or
the project files that Xcode requires.</p>

        
<ol>
  <li>From the terminal, change to the build directory of the solvers, i.e. <em>Nektar++/solvers/builds</em>.</li>
  <li>CMake can generate both GCC Makefiles, or Xcode project files.
            
    <ul>
      <li>GCC Makefiles
                  
        <ul>
          <li>Type in <div class="code"><pre>../../ThirdParty/CMake/bin/cmake -i ../</pre></div>
                        
            <ul>
              <li>The "-i" indicates that you want to use the wizard mode.</li>
            </ul>

                      </li>
          <li>Would you like to see advanced options? <strong>No</strong></li>
        </ul>

                </li>
      <li>Xcode Project Files
                
        <ul>
          <li>Type in <div class="code"><pre>../../ThirdParty/CMake/bin/cmake -i -G Xcode ../</pre></div>
                        
            <ul>
              <li>The "-i" indicates that you want to use the wizard mode.</li>
            </ul>

                  </li>
          <li>Would you like to see advanced options? <strong>No</strong></li>
        </ul>

              </li>
    </ul>

          </li>
  <li>As before for
most of the questions, you will be able to select the default value by
just pressing enter. Most of the configuration will be locating the
files you setup earlier in <em>ThirdParty/</em>, but it should find
these files automatically. If you have a different setup, you may need
to enter the paths manually if they couldn't be found. Below I will
list some of the options that you need to pay attention to.
    <ul>
      <li><strong>CMAKE_BUILD_TYPE</strong>
                
        <ul>
          <li>This
option sets the appropriate GCC flags for the different build types:
Debug, Release, etc. For this tutorial, I'll choose Release, in order
to get full optimizations.</li>
        </ul>
        </li>
      
      
    <!--  <li><strong>EXECUTABLE_OUTPUT_PATH</strong>
                  
        <ul>
          <li>This is the path GCC will put the generated executable files - it can be anywhere you wish.<span style="font-weight: bold;"></span></li>
        </ul>
      </li> -->
    </ul>
  </li>
  <li>Now you have generated the Makefiles, you can compile the solvers by entering 
<div class="code"><pre>make</pre></div> from the command line in the directory <em>Nektar++/solvers/builds/</em>. If you chose to compile the solvers with Xcode, open the project "SOLVERS.xcodeproj". 
    </span></li>
     <li>The solvers need also installation to be properly used by the regression tests. You can do it by entering 
<div class="code"><pre>make install</pre></div> from the command line in the directory <em>Nektar++/solvers/builds/</em>. It will create a new directory <em>Nektar++/solvers/builds/dist/bin/</em> where all the solvers executables are collected. 
    </span></li>
</ol>
To compile the utilities you follow an identical set of instructions but replace solvers in the above text with utilities.


<h3><a name="Compiling_Regression_Tests"></a>Compiling the Regression Tests</h3>
<br>
To compile the regression tests you first need to have
compiled the Nektar++ library and Solvers </br>

<p>Once again we use CMake to generate the Makefiles that GCC requires, or
the project files that Xcode requires.</p>

<ol>
  <li>From the terminal, change to the build directory of the regressionTests, i.e. <em>Nektar++/regressionTests/builds</em>.</li>
  <li>CMake can generate both GCC Makefiles, or Xcode project files.
            
    <ul>
      <li>GCC Makefiles
                  
        <ul>
          <li>Type in <div class="code"><pre>../../ThirdParty/CMake/bin/cmake -i ../</pre></div>
                        
            <ul>
              <li>The "-i" indicates that you want to use the wizard mode.</li>
            </ul>

                      </li>
          <li>Would you like to see advanced options? <strong>No</strong></li>
        </ul>

                </li>
      <li>Xcode Project Files
                
        <ul>
          <li>Type in <div class="code"><pre>../../ThirdParty/CMake/bin/cmake -i -G Xcode ../</pre></div>
                        
            <ul>
              <li>The "-i" indicates that you want to use the wizard mode.</li>
            </ul>

                  </li>
          <li>Would you like to see advanced options? <strong>No</strong></li>
        </ul>

              </li>
    </ul>

          </li>
  <li>As before for most of the questions, you will be able to select
the default value by just pressing enter. Most of the configuration
will be locating the files you setup earlier in <em>ThirdParty/</em>,
but it should find these files automatically. If you have a different
setup, you may need to enter the paths manually if they couldn't be
found. Below I will list some of the options that you need to pay
attention to.
    <ul>
      <li><strong>CMAKE_BUILD_TYPE</strong>
                
        <ul>
          <li>This
option sets the appropriate GCC flags for the different build types:
Debug, Release, etc. For this tutorial, I'll choose Release, in order
to get full optimizations.</li>
        </ul>
        </li>
    </ul>
  </li>
  <li>Now you have generated the Makefiles, you can compile the regression tests by typing 
<div class="code"><pre>make</pre></div> from the command line in any of the sub-directories of the current build location. For example to compile the regression tests for <em> Demos/StdRegions</em>, move to this directory and type <div class="code"><pre>make</pre></div> This will generate an executable called <em>StdRegionsDemoTest</em>. Executing this file will run a series of demos located in the <em>Nektar++/library/Demos/StdRegions</em> directory and check them against known solutions for these demos. 
    </span></li>
  <li> If you are modifying the regression tests by adding or removing tests you can generate a new master ".ok" file by answering  <strong>No</strong> to the <em> "Would you like to see advanced options?"</em> in step 2 and setting the variable <em>REGRESSION_MAKE_OK_FILES_EXEC</em> to <em>ON</em>. This will, for example, generate the executable <em>StdRegionsDemoMakeOKFile</em> which when executed will execute a series of demos and make the updated .ok files. 
   </span></li>
</ol>

<h3><br>

The entire Nektar++ package should now have been succesfully compiled. Instructions on how to use Nektar++ are described on the <a href="usage.html" id="menu_Usage">usage</a> page.
  </h3>      

        
<p><br class="clearfloat">
</p>

      </div>

    </div>

  <!-- InstanceEnd -->
</body>
</html>