|
|
(77 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | == Introduction ==
| + | This test page is mostly empty for now, to stay out of the search engines. |
− | 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|here]]. | + | |
| | | |
− | These patches were based on [http://www.symscape.com Symscape's] "v3" patch for OpenFOAM available [http://www.symscape.com/openfoam-1-5-x-on-windows here]. They differ substantially from that patch, as well as the more recent one available [http://www.symscape.com/openfoam-1-6-x-on-windows here]. The build scripts for [http://www.mingw.org mingw] were also based on the build-script available on the 1.5.x link.
| + | Personal note used when creating new installation guides: |
| | | |
− | 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 [http://www.mingw.org mingw32] and/or [http://www.cadforte.com mingw-w64]. These enable you to build OpenFOAM 1.6 for Windows 32 and 64 bit versions, from Linux 32 and 64bit architectures.
| + | <span style="font-size:180%">'''WARNING: These instructions are currently being written and under testing!'''</span> |
− | | + | |
− | Versions these patches apply to:
| + | |
− | {{version1.6}}
| + | |
− | | + | |
− | == Get OpenFOAM packages ==
| + | |
− | <ol> | + | |
− | <li>In your Linux machine, open a terminal window and create the folder '''$HOME/OpenFOAM'''.</li>
| + | |
− | <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 copy/move them to the folder '''$HOME/OpenFOAM'''.</li>
| + | |
− | <li>Extract both files, by running in a terminal:
| + | |
− | <bash>cd $HOME/OpenFOAM
| + | |
− | tar xzf OpenFOAM-1.6.General.gtgz
| + | |
− | tar xzf ThirdParty-1.6.General.gtgz</bash></li>
| + | |
− | </ol>
| + | |
− | | + | |
− | == 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).
| + | |
− | | + | |
− | #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'''.<br><br>
| + | |
− | #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 gcc that comes with the '''ThirdParty-1.6.General.gtgz''' package - again, two choices:
| + | |
− | ###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]).
| + | |
− | ##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/move the [[:File:PatchesNBatches.tar.gz|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>
| + | |
− | | + | |
− | == Getting Windows version of MPICH2 into the '''ThirdParty-1.6''' folder in Linux ==
| + | |
− | #There are two ways of getting MPICH2 into your Linux+OpenFOAM set up:
| + | |
− | ##Use the '''get-mpich2''' script, that requires [http://www.wine.org Wine] to be installed. With [http://www.wine.org Wine] installed and with '''msiexec''' executable from the terminal, then the '''get-mpich2''' script should work. To check whether you have '''msiexec''' accessible in the terminal, run: <bash>which msiexec</bash> If it returns the full path to the executable, then it is ready to use.
| + | |
− | ##Copy MPICH2 files from a Windows Installation. Three steps for this part:
| + | |
− | ##*Download and install in Windows the MPICH2, version 1.1.1p1 Win32 IA32 from [http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.1.1p1/ here]. Get and install the 64bit version, if you wish to build OpenFOAM for Windows x64.
| + | |
− | ##*Create the folder '''ThirdParty-1.6/mpich2-1.1.1p1''' in your Linux set up.
| + | |
− | ##*Copy the folders '''bin''', '''include''' and '''lib''' from the installed version of MPICH2 in Windows, into the folder '''ThirdParty-1.6/mpich2-1.1.1''' in Linux.
| + | |
− | :::The '''Allwmake''' script at the folder '''ThirdParty-1.6''' will take care of the rest. For now, the tough part is that, this way, you can only build one version of OpenFOAM (32 or 64bit) at a time.
| + | |
− | | + | |
− | == Tweaking environment options ==
| + | |
− | <ol>
| + | |
− | <li>Choose which version you want to use:
| + | |
− | :;mingw32 : for getting a 32bit version of OpenFOAM, that builds on Linux i?86, using mingw;
| + | |
− | :;mingw-w32 : for getting a 32bit version of OpenFOAM, that builds on Linux i686 and x86_64, using mingw-w64;
| + | |
− | :;mingw-w64 : for getting a 64bit version of OpenFOAM, that builds on Linux i686 and x86_64, using mingw-w64;
| + | |
− | | + | |
− | Variants of the "bashrc" file that is inside the folder "OpenFOAM-1.6/etc", have been created, to meet the most likely options. These are:
| + | |
− | :;sample - <bashrc-version> : configured for <compiler>, <mingw version>, <MPI option>, <WM_COMPILE_OPTION>, <WM_ARCH_OPTION>
| + | |
− | :;bashrc-mingw32 : configured for gcc-4.3.3, mingw32, MPI with MPICH2, Opt, DP, 32
| + | |
− | :;bashrc-mingw-w32 : configured for gcc-4.4.2, mingw-w32, MPI with MPICH2, Opt, DP, 32
| + | |
− | :;bashrc-mingw-w32-prof : configured for gcc-4.4.2, mingw-w32, No MPI, Prof, DP, 32
| + | |
− | :;bashrc-mingw-w32S : configured for gcc-4.4.2, mingw-w32, MPI with MPICH2, Opt, SP, 32
| + | |
− | :;bashrc-mingw-w64 : configured for gcc-4.4.2, mingw-w64, MPI with MPICH2, Opt, DP, 64
| + | |
− | :;bashrc-mingw-w64-prof : configured for gcc-4.4.2, mingw-w64, No MPI, Prof, DP, 64
| + | |
− | :;bashrc-mingw-w64-45 : configured for gcc-4.5.0, mingw-w64, MPI with MPICH2, Opt, DP, 64</li>
| + | |
− | <li>After choosing the version you wish to build, edit the file '''$HOME/.bashrc''' and add to the end of it, a line analogous to the following line:
| + | |
− | <bash>. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32</bash>
| + | |
− | '''NOTE''': sometimes the leading dot doesn't work, so use the following instead:
| + | |
− | <bash>source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-mingw32</bash></li>
| + | |
− | <li>Before launching a new terminal, edit the picked file '''$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc-''mingw version'''''. You have two additional variables that are configurable and non standard to the original OpenFOAM version:
| + | |
− | *'''WM_PSTREAMLINK''' - this variable allows control over the linking method that is with the '''Pstream''' library. Two options are available:
| + | |
− | *#If set to '''DONTLINKTOPSTREAM''', then depending on the variable '''WM_MPLIB''' being set to '''"NONE"''' or '''"MPICH"''', then OpenFOAM will be statically linked with that version, being able only without MPI capabilities or only to run with MPICH2 installed, respectively.
| + | |
− | *#If '''LINKTOPSTREAM''', then DLLs of the library Pstream are created, both '''dummy''' and '''MPICH2''' versions; this allows you to choose which version to use in Windows, without rebuilding OpenFOAM again, allowing one build to be used in multiple installations.
| + | |
− | | + | |
− | *'''WM_GETMPICH2''' - this variable controls whether MPICH2 is setup automatically or manually. The two options are:
| + | |
− | *#If set to '''GETMPICH2''', then '''wget''' is used for downloading the MPICH2 installation packages, and Wine will be used to unpack the '''".msi"''' files.
| + | |
− | *#If '''DONTGETMPICH2''', then the script will assume that the steps at 4.1.2 were taken.</li>
| + | |
− | <li>Optional - If you want to use a version of MPICH2 other than '''1.1.1p1''', then edit the file '''$HOME/OpenFOAM/OpenFOAM-1.6/etc/settings.sh''' and find the line that has '''mpi_version=mpich2-1.1.1p1''' and change to the <u>version</u> you want, as show [http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/ here].</li>
| + | |
− | </ol>
| + | |
− | | + | |
− | == Build the cross compiler ==
| + | |
− | <ol>
| + | |
− | <li>Open a new terminal window or tab, so the edited file '''$HOME/.bashrc''' is executed, thus setting up the chosen OpenFOAM development environment (see [[#Tweaking environment options]]).</li>
| + | |
− | <li>Now go to the '''ThirdParty-1.6''' folder, in your new terminal:<bash>cd $WM_THIRD_PARTY_DIR</bash></li>
| + | |
− | <li></li>
| + | |
− | | + | |
− | [[User:Wyldckat|Wyldckat]] 18:05, 10 November 2009 (UTC)
| + | |
This test page is mostly empty for now, to stay out of the search engines.