User:Hoogs/Installation

From OpenFOAMWiki

1 1.6.x

Now that I routinely make additions and modifications of my local code, and OpenCFD provide a git repository, I no longer use a system wide installation (I now appreciate the wisdom of the OpenCFD recommendation to go with a local installation). Here are notes from a local installation on openSUSE 11.1 with WM_PROJECT_INST_DIR=$HOME/OpenFOAM. I have rarely had a problem-free compilation process (due mainly to differences between linux systems), but usually the errors are easily resolved with a little patience, and the scripting automation has improved. Compared to some packages, OpenCFD do a very good job of making the installation process generally painless.

cd $WM_PROJECT_INST_DIR
git clone git://repo.or.cz/OpenFOAM-1.6.x.git

This created $WM_PROJECT_INST_DIR/OpenFOAM-1.6.x and $WM_PROJECT_INST_DIR/ThirdParty-1.6. To avoid a warning and because the system compiler is usually adequate, I changed "OpenFOAM" to "System" in the settings,

File: $WM_PROJECT_INST_DIR/OpenFOAM-1.6.x/etc/settings.sh
...
# Select compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# compilerInstall = OpenFOAM | System
compilerInstall=System
...

The environment needs to be updated so I added

File: $HOME/.bashrc
...
source $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc
...

and re-sourced

source ~/.bashrc

then jumped into the OpenFOAM directory and ran the Allwmake script:

cd $WM_PROJECT_INST_DIR/OpenFOAM-1.6.x
./Allwmake 2>&1 > log.wmake.00 &
tail -f log.wmake.00

1.1 First error

The end of the log showed failure

7244 make[2]: *** [/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/mixtureAdiabaticFlameT] Error 1
7245 make[2]: Leaving directory `/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/thermophysical/mixtureAdiabaticFlameT'
7246 make[1]: *** [mixtureAdiabaticFlameT] Error 2
7247 make[1]: Target `application' not remade because of errors.
7248 make[1]: Leaving directory `/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/thermophysical'
7249 make: *** [thermophysical] Error 2
7250 make: Target `application' not remade because of errors.

But the original error was found by searching for the first appearance of the word "Error", which indicated that mpi.h could not be found to build libPstream. The problem was that the git clone operation had created the directory ThirdParty-1.6 but $WM_THIRD_PARTY_DIR was set to $WM_PROJECT_INST_DIR/ThirdParty-1.6.x. When the directory was renamed, mpi.h was found in $WM_PROJECT_INST_DIR/ThirdParty-1.6.x/openmpi-1.3.3/platforms/linux64GccDPOpt/include. So tried again:

./Allwmake 2>&1 > log.wmake.01 &
tail -f log.wmake.01

Actually, a better solution is probably to use a symlink

ln -s $WM_PROJECT_INST_DIR/ThirdParty-1.6 $WM_PROJECT_INST_DIR/ThirdParty-1.6.x

1.2 Second error

2853 g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-      >depth-40 -I/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/src /thermophysicalModels/specie/lnInclude -IlnInclude -I. -I/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/       >src/OpenFOAM/lnInclude -I/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude   -fPIC Make/linux64GccDPOpt/mixtureAdiabaticFlameT.o -      >L/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt \
2854          -lspecie -lOpenFOAM -liberty -ldl   -lm -o /home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linux64GccDPOpt/mixtureAdiabaticFlameT
2855 make[2]: Leaving directory `/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/thermophysical/mixtureAdiabaticFlameT'
2856 make[1]: Leaving directory `/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/thermophysical'
2857 make: Target `application' not remade because of errors.

The first sign of a problem was

2531 + cd PV3FoamReader
2532 + mkdir -p Make/linux64GccDPOpt
2533 + cd Make/linux64GccDPOpt
2534 + cmake ../..
2535 ./Allwmake: line 14: cmake: command not found
2536 + make
2537 make[3]: Entering directory `/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/Make/         >linux64GccDPOpt'
2538 make[3]: *** No targets specified and no makefile found.  Stop.
2539 make[3]: Leaving directory `/home/hoogland/OpenFOAM/OpenFOAM-1.6.x/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/Make/          >linux64GccDPOpt'
2540 make[2]: *** [PV3FoamReader] Error 2

This was not really an error, since Paraview needs to be built first. So following the README, i.e.

160 * Compiling Paraview 3.6.1 and the PV3FoamReader module
161   If there are problems encountered with ParaView, then it may be necessary to
162   compile ParaView from sources.  The compilation
163   is a fairly simple process using the supplied makeParaView script that
164   has worked in our tests with other packages supplied in the ThirdParty
165   directory, namely cmake-2.6.4 and gcc-4.3.3.  Execute the following:
166   + cd $WM_THIRD_PARTY_DIR
167   + rm -rf paraview-3.6.1/platforms
168   + makeParaView

I got

ParaView_DIR=/home/hoogland/OpenFOAM/ThirdParty-1.6.x/paraview-3.6.1/platforms/linux64Gcc
removing old build/install directory
----
Configuring paraview-3.6.1 (major version: 3.6)
    MPI    support : false
    Python support : false
    MESA   support : false
    Qt dev support : true
    Source         : /home/hoogland/OpenFOAM/ThirdParty-1.6.x/paraview-3.6.1
    Target         : /home/hoogland/OpenFOAM/ThirdParty-1.6.x/paraview-3.6.1/platforms/linux64Gcc
----

cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/hoogland/OpenFOAM/ThirdParty-1.6.x/paraview-3.6.1/platforms/linux64Gcc -DVTK_USE_TK=FALSE -DBUILD_SHARED_LIBS:BOOL=ON -DVTK_USE_RPATH:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DPARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON -DPARAVIEW_BUILD_QT_GUI=ON ../..

----
...

because cmake-2.6.4 was not present in the ThirdParty-1.6 directory of the git repo. Apparently cmake is available in the 32-bit ThirdParty download, but I couldn't see it. The easiest thing to do was install a system wide version as root:

cd /tmp
wget  wget http://download.opensuse.org/distribution/11.1/repo/oss/suse/x86_64/cmake-2.6.2-2.19.x86_64.rpm
rpm -ivh cmake-2.6.2-2.19.x86_64.rpm

I wanted to build Paraview with python and mesa support (for off screen rendering) and modified the make script accordingly

File: $WM_PROJECT_INST_DIR/ThirdParty-1.6.x/makeParaView
 44 # Python support:
 45 # note: script will try to determine the appropriate python library.
 46 #       If it fails, specify the path using the PYTHON_LIBRARY variable
 47 withPYTHON=true
 48 #PYTHON_LIBRARY=""
 49 PYTHON_LIBRARY="$HOME/opt/Python-2.5.4/lib/libpython2.5.so.1.0"
 50 PYTHON_INCLUDE="$HOME/opt/Python-2.5.4/include/python2.5"
 51 
 52 # MESA graphics support:
 53 withMESA=true
 54 MESA_INCLUDE="/usr/include/GL"
 55 MESA_LIBRARY="/usr/lib64/libOSMesa.so"

I added PYTHON_INCLUDE because I have a non-standard Python installation

File: $WM_PROJECT_INST_DIR/ThirdParty-1.6.x/tools/makeParaViewFunctions
114         if [ -n "$PYTHON_INCLUDE" ]
115         then 
116             pythonInclude=$PYTHON_INCLUDE
117             # check $PYTHON_INCLUDE if it has been set
118             if [ ! -d "$pythonInclude" ]
119             then 
120                 echo "*** Error: python include dir not found at location specified " \
121                      "by PYTHON_INCLUDE=$pythonInclude"
122             fi
123         else
124             pythonInclude=/usr/include/python$pythonMajor
125             if [ ! -e "$pythonInclude" ]
126             then
127                echo "*** Error: Unable to determine path to python include dir."
128             fi
129         fi

I ran the script and it worked well, although a sed error showed up at the end which I did not capture in a log. I jumped back into the 1.6.x directory and ran Allwmake for the third time. This ran through ok, and finally the ParaFoam reader was compiled,

cd $FOAM_UTILITIES/postProcessing/graphics/PV3FoamReader
./Allwclean
./Allwmake

Running foamInstallationTest showed a problem with the compiler path. So I modified the settings file to better handle a "System" selection for the compiler

File: $WM_PROJECT_INST_DIR/ThirdParty-1.6.x/tools/makeParaViewFunctions
133 System) # JDH {{{
134     WM_COMPILER=Gcc # This is used to label executable directories
135     compilerName=gcc # This is the real local compiler name
136     # WM_COMPILER_DIR needs to remove the /bin component of the path, so snip twice
137     WM_COMPILER_DIR=$(dirname $(dirname $(which $compilerName)))
138     if [ ! -d "$WM_COMPILER_DIR/bin" ]
139     then
140         echo
141         echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
142         echo "    Cannot find $WM_COMPILER_DIR/bin installation."
143         echo "    Please manually specify WM_COMPILER, WM_COMPILER_DIR,"
144         echo "    and WM_COMPILER_LIB in this file"
145         echo
146     fi
147 
148     compilerBin=$WM_COMPILER_DIR/bin/$compilerName
149 
150     WM_COMPILER_LIB=$(dirname $(ldd $compilerBin \
151                                 | grep 'libc\.so' | awk '{print $3}'))
152 
153     compilerLib=$WM_COMPILER_LIB
154 
155     export WM_COMPILER
156     export WM_COMPILER_DIR
157     export WM_COMPILER_LIB
158     #}}}

1.3 ParaFoam problem

The cavity icoFoam test case worked fine but when ParaFoam was activated up came a popup with

A reader for '...' could not be found.  Please choose one:

I've had this problem previously, too. The Qt version being used was

> qmake --version
QMake version 2.01a
Using Qt version 4.3.1 in /home/hoogland/opt/Trolltech/Qt-4.3.1/lib

The annoying thing here is that neither Paraview nor the PV3FoamReader gave any errors or hints during compilation. Encouraged by success reported by others in using a newer Qt version, I downloaded and compiled Qt-4.3.5,

cd $HOME/opt
wget ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.gz
tar xzvf qt-x11-opensource-src-4.3.5.tar.gz
cd qt-x11-opensource-src-4.3.5
./configure -prefix $HOME/opt/Trolltech/Qt-4.3.5
make
make install

The path needed to be adjusted from Qt-4.3.1 to Qt-4.3.5,

File: $HOME/.bashrc
...
export PATH=$HOME/opt/Trolltech/Qt-4.3.5/bin:$PATH
...

Paraview then PV3FoamReader and just to be sure OpenFOAM-1.6.x/Allwmake were rebuilt. The compilation output was quite different for Paraview between Qt 4.3.1 and 4.3.5. paraFoam then worked perfectly.