Difference between revisions of "TestWyldckat"

From OpenFOAMWiki
Line 7: Line 7:
  
 
== Get OpenFOAM packages ==
 
== Get OpenFOAM packages ==
 
+
<ol>
#In your Linux machine, open a terminal window and create the folder '''$HOME/OpenFOAM'''.
+
<li>In your Linux machine, open a terminal window and create the folder '''$HOME/OpenFOAM'''.</li>
#Get '''OpenFOAM-1.6.General.gtgz''' and '''ThirdParty-1.6.General.gtgz''' from the [http://www.opencfd.co.uk/openfoam/linux.html OpenCFD's website] and move them to the folder '''$HOME/OpenFOAM'''.
+
<li>Get '''OpenFOAM-1.6.General.gtgz''' and '''ThirdParty-1.6.General.gtgz''' from the [http://www.opencfd.co.uk/openfoam/linux.html OpenCFD's website] and move them to the folder '''$HOME/OpenFOAM'''.</li>
#Extract both files, by running in a terminal:
+
<li>Extract both files, by running in a terminal:
<blockquote><cpp>cd $HOME/OpenFOAM
+
<bash>cd $HOME/OpenFOAM
 
tar xzf OpenFOAM-1.6.General.gtgz
 
tar xzf OpenFOAM-1.6.General.gtgz
tar xzf ThirdParty-1.6.General.gtgz
+
tar xzf ThirdParty-1.6.General.gtgz</bash></li>
</cpp></blockquote>
+
</ol>
  
 
== Optional: Using a specific gcc version for building the wmake binaries ==
 
== Optional: Using a specific gcc version for building the wmake binaries ==
 
This is optional, because the current patch will use the system's gcc for building them (more specifically '''gcc''' as compiler name).
 
This is optional, because the current patch will use the system's gcc for building them (more specifically '''gcc''' as compiler name).
  
#Edit $HOME/.bashrc and add the following line to the end of it:<cpp>. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc</cpp>NOTE: sometimes the leading dot doesn't work, so use the following instead:<cpp>source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc</cpp>
+
#Edit $HOME/.bashrc and add the following line to the end of it:<bash>. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc</bash>NOTE: sometimes the leading dot doesn't work, so use the following instead:<bash>source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc</bash>
##You might want to edit '''$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc''' and set the Linux architecture correctly, namely '''WM_ARCH_OPTION''' to '''32''' or '''64'''.
+
##You might want to edit '''$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc''' and set the Linux architecture correctly, namely '''WM_ARCH_OPTION''' to '''32''' or '''64'''.<br><br>
 
#Two possibilities are now available:
 
#Two possibilities are now available:
 
##Use the system's gcc - edit '''$HOME/OpenFOAM/OpenFOAM-1.6/etc/settings.sh''' and change '''compilerInstall=OpenFOAM''' to '''compilerInstall=System'''.
 
##Use the system's gcc - edit '''$HOME/OpenFOAM/OpenFOAM-1.6/etc/settings.sh''' and change '''compilerInstall=OpenFOAM''' to '''compilerInstall=System'''.
 
##Use the gcc that comes with the '''ThirdParty-1.6.General.gtgz''' package - again, two choices:
 
##Use the gcc that comes with the '''ThirdParty-1.6.General.gtgz''' package - again, two choices:
###You can compile the gcc by running the following line:<cpp>(cd $HOME/OpenFOAM/ThirdParty-1.6 && makeGcc gcc-4.3.3)</cpp>
+
###You can compile the gcc by running the following line:<bash>(cd $HOME/OpenFOAM/ThirdParty-1.6 && makeGcc gcc-4.3.3)</bash>
 
###Or by getting the available compiled version for your Linux version ( [http://www.opencfd.co.uk/openfoam/linux.html ThirdParty-1.6.linuxGcc.gtgz] or [http://www.opencfd.co.uk/openfoam/linux64.html ThirdParty-1.6.linux64Gcc.gtgz] from [http://www.opencfd.co.uk OpenCFD's website]).
 
###Or by getting the available compiled version for your Linux version ( [http://www.opencfd.co.uk/openfoam/linux.html ThirdParty-1.6.linuxGcc.gtgz] or [http://www.opencfd.co.uk/openfoam/linux64.html ThirdParty-1.6.linux64Gcc.gtgz] from [http://www.opencfd.co.uk OpenCFD's website]).
##launch a new terminal and run the following line, thus building '''wmkdep''' and '''dirToString''':<cpp>(cd $HOME/OpenFOAM/OpenFOAM-1.6/wmake/src && make)</cpp>
+
##launch a new terminal and run the following line, thus building '''wmkdep''' and '''dirToString''':<bash>(cd $HOME/OpenFOAM/OpenFOAM-1.6/wmake/src && make)</bash>
 +
 
 +
== Applying patches ==
 +
<ol>
 +
<li>Copy the [[File:PatchesNBatches.tar.gz]] file into the '''$HOME/OpenFOAM''' folder. Then unpack it by running:
 +
<bash>tar -xzf PatchesNBatches.tar.gz</bash></li>
 +
<li>A new folder is created, named '''pnb'''. Now to apply the patches, run from the '''$HOME/OpenFOAM''' folder:<bash>patch -p0 < pnb/OpenFOAM-1.6_patch
 +
patch -p0 < pnb/ThirdParty-1.6_patch</bash></li>
 +
<li>Still have to do some '''chmod'''''ding'', for new scripts to run properly. Run the following lines in the terminal:
 +
<bash>chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw32
 +
chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w32
 +
chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w64
 +
chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w64-45
 +
chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/makeGcc44
 +
chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/get-mpich2
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/src/mingwFunctions
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/src/Allclean
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32-prof
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32S
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64-45
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64-prof
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/applications/utilities/parallelProcessing/Allwmake
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/bin/tutowin
 +
chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamDiff
 +
</bash></li>
 +
</ol>
 +
 
  
==  ==
+
[[User:Wyldckat|Wyldckat]] 17:12, 10 November 2009 (UTC)

Revision as of 17:12, 10 November 2009

1 Introduction

This is a step by step guide on how to cross-compile OpenFOAM in Linux for Windows, for both 32 and 64 bits architectures (to and from), using the patches available File:PatchesNBatches.tar.gz.

These patches were based on Symscape's "v3" patch for OpenFOAM available here. They differ substantially from that patch, as well as the more recent one available here. The build scripts for mingw were also based on the build-script available on the 1.5.x link.

With this guide and available patches, you should be able to cross-compile the whole OpenFOAM library and applications, using MPICH2 instead of Open MPI for parallel computing. You can cross-compile using mingw32 and/or mingw-w64. These enable you to build OpenFOAM 1.6 for Windows 32 and 64 bit versions, from Linux 32 and 64bit architectures.

2 Get OpenFOAM packages

  1. In your Linux machine, open a terminal window and create the folder $HOME/OpenFOAM.
  2. Get OpenFOAM-1.6.General.gtgz and ThirdParty-1.6.General.gtgz from the OpenCFD's website and move them to the folder $HOME/OpenFOAM.
  3. Extract both files, by running in a terminal:
    cd $HOME/OpenFOAM
    tar xzf OpenFOAM-1.6.General.gtgz
    tar xzf ThirdParty-1.6.General.gtgz

3 Optional: Using a specific gcc version for building the wmake binaries

This is optional, because the current patch will use the system's gcc for building them (more specifically gcc as compiler name).

  1. Edit $HOME/.bashrc and add the following line to the end of it:
    . $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
    NOTE: sometimes the leading dot doesn't work, so use the following instead:
    source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
    1. You might want to edit $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc and set the Linux architecture correctly, namely WM_ARCH_OPTION to 32 or 64.

  2. Two possibilities are now available:
    1. Use the system's gcc - edit $HOME/OpenFOAM/OpenFOAM-1.6/etc/settings.sh and change compilerInstall=OpenFOAM to compilerInstall=System.
    2. Use the gcc that comes with the ThirdParty-1.6.General.gtgz package - again, two choices:
      1. You can compile the gcc by running the following line:
        (cd $HOME/OpenFOAM/ThirdParty-1.6 && makeGcc gcc-4.3.3)
      2. Or by getting the available compiled version for your Linux version ( ThirdParty-1.6.linuxGcc.gtgz or ThirdParty-1.6.linux64Gcc.gtgz from OpenCFD's website).
    3. launch a new terminal and run the following line, thus building wmkdep and dirToString:
      (cd $HOME/OpenFOAM/OpenFOAM-1.6/wmake/src && make)

4 Applying patches

  1. Copy the File:PatchesNBatches.tar.gz file into the $HOME/OpenFOAM folder. Then unpack it by running:
    tar -xzf PatchesNBatches.tar.gz
  2. A new folder is created, named pnb. Now to apply the patches, run from the $HOME/OpenFOAM folder:
    patch -p0 < pnb/OpenFOAM-1.6_patch
    patch -p0 < pnb/ThirdParty-1.6_patch
  3. Still have to do some chmodding, for new scripts to run properly. Run the following lines in the terminal:
    chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw32
    chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w32
    chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w64
    chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/build-mingw-w64-45
    chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/makeGcc44
    chmod 744 $HOME/OpenFOAM/ThirdParty-1.6/get-mpich2
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/src/mingwFunctions
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/src/Allclean
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32-prof
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w32S
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64-45
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw-w64-prof
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/applications/utilities/parallelProcessing/Allwmake
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/bin/tutowin
    chmod 744 $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamDiff


Wyldckat 17:12, 10 November 2009 (UTC)