-
-
Notifications
You must be signed in to change notification settings - Fork 33
Binary archives
The guide still assumes that you use Homebrew to manage third party software. Maybe in the future I also pack dependencies in the archives and there will be no need in package manager.
From time to time I think it is awful to install Homebrew, then install third party packages (OpenMPI, boost, etc), then wait 2 hour for OpenFOAM(R) being compiled and then finally run icoFoam to check that compilation was not quite successful. In fact the first part of installation usually takes 10 minutes, yet the last is 2-3 hours long.
So to avoid the step with compilation I have decided to upload archives of binaries that were produced during test compilation that I run to check patches.
To install "binary" version of software you still need to...
-
Create disk image with case sensitive file system. Though binaries names are in general case-insensitive, you need source to use certain features and compile own solvers/utilities, and as you know source code naming scheme is case-sensitive.
-
Download OpenFOAM(R) sources. Depending on the version you would like to install it is either downloading source tarball from <openfoam.org> or checking out sources from git repository.
-
Download archive with binaries. Archive name template is
v<OF version>-r<Darwin kernel version>-[ls<WM_LABEL_SIZE value>]-<compile option>.tar.bz2
.<OF version>
is OpenFOAM version you would like to install;<Darwin kernel version>
is the string you get withuname -r
;ls<WM_LABEL_SIZE>
part is available only for archives of OF 3.0.0 and higher and its value corresponds to the value ofWM_LABEL_SIZE
variable; finally<compile option>
is eitheropt
,debug
, orprof
. -
Extract archive into your OpenFOAM folder.
-
Create lnInclude folders, so include paths are valid,
coded
things work as expected, and you can build your own solvers. -
Use installation.
In the terms of shell commands the process looks like (put desired version instead of ):
$ brew tap homebrew/science
$ brew install open-mpi --without-fortran
$ brew install scotch
$ brew install boost --without-single --with-mpi
$ brew install cgal
$ brew install metis
$ brew install parmetis
$ brew install https://raw.githubusercontent.com/mrklein/openfoam-os-x/master/formulae/parmgridgen.rb
$ cd
$ hdiutil create -size 8.3g -type SPARSEBUNDLE -fs HFSX -volname OpenFOAM -fsargs -s test.sparsebundle
$ mkdir -p OpenFOAM
$ hdiutil attach -mountpoint $HOME/OpenFOAM OpenFOAM.sparsebundle
$ cd OpenFOAM
At this point you have disk image with case sensitive file system mounted at $HOME/OpenFOAM. Then either download source archive and extract it:
$ curl -L http://downloads.sourceforge.net/foam/OpenFOAM-<VER>.tgz > OpenFOAM-<VER>.tgz
$ tar xzf OpenFOAM-<VER>.tgz
$ mv OpenFOAM-4.x-version-4.0 OpenFOAM-4.0 # if <VER> is 4.0
$ rm OpenFOAM-<VER>.tgz
or clone sources from git repository:
$ git clone https://github.com/OpenFOAM/OpenFOAM-<VER>.x.git
Then apply patch on the downloaded source
$ cd OpenFOAM-<VER>
$ curl -L https://raw.githubusercontent.com/mrklein/openfoam-os-x/master/OpenFOAM-<VER>.patch > OpenFOAM-<VER>.patch
$ git apply OpenFOAM-<VER>.patch
if you are installing release, or
$ cd OpenFOAM-<VER>
$ curl -L https://raw.githubusercontent.com/mrklein/openfoam-os-x/master/OpenFOAM-<VER>-<commit>.patch > OpenFOAM-<VER>-<commit>.patch
$ git checkout -b local-install <commit>
$ git apply OpenFOAM-<VER>-<commit>.patch
if you are installing git-version.
Then download binary archive from Github and extract it. Template of the name of the archive is v<OF version>-r<Darwin kernel release>[-ls<WM_LABEL_SIZE>]-<compilation option>.tar.bz2
, where <OF version>
is OpenFOAM version you are installing, <Darwin kernel release>
is output of uname -r
, <WM_LABEL_SIZE>
is available only in version 3.0.0 and above and directly correspond to the value of the environment variable; finally <compilation option>
is one of the following: opt
, debug
, prof
. Though since binaries are byproduct of compilation testing, usually only opt variant is available.
$ curl -L https://github.com/mrklein/openfoam-os-x/releases/download/v0.6.2/vA.B.C-r15.2.0-ls32-opt.tar.bz2 > vA.B.C-r15.2.0-ls32-opt.tar.bz2
$ tar xjf vA.B.C-r15.2.0-ls32-opt.tar.bz2
At this point you have patched source tree for compilation of your own extensions and pre-compiled binaries. The last thing is to create lnInclude
folders in src
and applications
, this is done with
$ wmakeLnIncludeAll src applications
command.
On OS X paths to libraries are compiled into binaries, for example:
$ otool -L chtMultiRegionSimpleFoam
chtMultiRegionSimpleFoam:
$FOAM_LIBBIN/openmpi-system/libPstream.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libfiniteVolume.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libcompressibleTransportModels.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libfluidThermophysicalModels.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libsolidThermo.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libspecie.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libturbulenceModels.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libcompressibleTurbulenceModels.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libradiationModels.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libfvOptions.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libregionModels.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libsampling.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libmeshTools.dylib (compatibility version 0.0.0, current version 0.0.0)
$FOAM_LIBBIN/libOpenFOAM.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
and there is DYLD_LIBRARY_PATH
environment variable with a list of folders where dynamic loader looks for libraries BEFORE it tries to load library from compiled-in path. So to make binaries movable from user to user we just need to remove $FOAM_LIBBIN part from paths in libraries and binaries. To do this install_name_tool
utility is used.
To automate the procedure (create backup of platforms folder, strip paths, and create archives) I have written https://github.com/mrklein/openfoam-os-x/blob/master/files/strip_binaries.py script.
This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM(R) and OpenCFD(R) trade marks.
OPENFOAM(R) is a registered trade mark of OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com.