Patches for OpenFOAM(R) compilation on macOS. Detailed installation instructions can be found in wiki.
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.
Added patch for OpenFOAM 9.
Added patch for OpenFOAM v2012. Slight correction of the patch for the previous
version. OpenQBBM
fixed obsolete gamma
function issue, yet, decided to
leave alphaMax
constructor issue in
JohnsonJacksonParticleSlipFvPatchVectorField.C
where it was.
Added OpenFOAM 8 and OpenFOAM v2006 patches.
In case of OpenFOAM 8 it is simple adaptation of the previous patch.
For OpenFOAM v2006 due to external modules it was necessary to make more changes:
has_adios
script). Instead of looking
for header and library, look up adios2-config
utility and check if
cxx-flags and cxx-libs are not empty.ntohl
inline function, yet does not check it is already
defined. So on OS X compilation stops with rather misleading messages about
missing braces.OpenQBBM
module uses obsolete gamma
function. Decided to change it into
tgamma
. NOTE! Maybe it should be changed to lgamma
instead, if original
author meant to calculate logarithm of gamma (as in glibc).Updated version OpenFOAM(R) 5.x, 6, and 7 patches. Added OpenFOAM(R) v1912 patch. Notes:
C++14
in wmake
rules due to CGAL
5.0. It started to
requite C++14 and became header only.csh
initialisation scripts, so users of tcsh
can use source etc/cshrc
to initialise environment.Small note on WM_LABEL_SIZE=64
: since all Mac OS X installations are
performed on personal notebooks I do not see a point in using 64-bit labels. So
I won't test this configuration any more. Though I am open to suggestions and
reasoning behind using 64-bit labels.
Added version 7 patch. Updated patches for 5.x and 6.
Updated version 6 and dev patches.
Added patches for version 6.
Someone in the Foundation hates versioning, so now it is impossible to distinguish release (let's call it 6.0) from bug-fixes version (6.x). Guess, next step will be to abandon versions at all.
Updated dev patch.
dev branch wmkdep
now makes certain substitutions in dep files (-R command
line switches). It fails to do it properly if -R /
is passed to the command.
There were two possibilities: either to modify wmake/rules/General/transform
by removing line -R '$(WM_THIRD_PARTY_DIR)/' '$$(WM_THIRD_PARTY_DIR)/' \
, or
add check for /
search pattern in wmkdep.l
. Opted for latter.
wmkdep
were made, so I have decided
to postpone patch update for this version.Updated 5.x and dev patches.
Updated 5.x and dev patches. Since Foundation decided to abandon version numbering, 5.0 patch will not receive any updates or corrections.
Update
WM_QUIET_RULES
are temporary gone in 5.x series.
wmake unification made it simpler to update patches, so returned 3.0.x and dev into tree (it seems 3.0.x is still widely used), updated foamJob script to account for macOS releases greater than 15.
Update.
WM_QUIET_RULES
, to reduce noise in
log-files).-Wno-undefined-var-template
to avoid
excess of warnings.Build process was tested on
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.4
BuildVersion: 16E195
with
$ clang++ --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
and the following third-party software
$ brew list --versions
...
boost 1.63.0
cgal 4.9.1
eigen 3.3.3
gmp 6.1.2
gnuplot 5.0.6
isl 0.18
libmpc 1.0.3
metis 5.1.0
mpfr 3.1.5
open-mpi 2.1.0
parmetis 4.0.3_4
scotch 6.0.4_4
...
Following recent bug-reports updated dev
patch (up to commit 37c5d28
).
Major changes:
Usage of CLT utilities are forced (using xcrun
), hope this will resolve
problems of third party cpp
s and flex
es.
Draft of WM_SILENT_RULES
, so build log files now look like
+ wmake dummy
/Users/alexey/OpenFOAM/OpenFOAM-dev/src/Pstream/dummy
LN ./lnInclude
DEP UIPread.C
DEP UPstream.C
DEP UOPwrite.C
CC UPstream.C
CC UIPread.C
CC UOPwrite.C
LD libPstream.dylib
->> libPstream.dylib
IOobject
's writeEndDivider
is modified to emit mode line for vim.
Added patch for version 4.1 (it is almost the same as 4.x-7dce081
patch).
Updated 4.x patch. Build process was tested on
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12
BuildVersion: 16A323
with
$ clang --version
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
and the following third-party packages
$ brew list --versions
...
boost 1.61.0_1
cgal 4.9
eigen 3.2.9
gmp 6.1.1
libmpc 1.0.3
metis 5.1.0
mpfr 3.1.5
open-mpi 2.0.1
parmetis 4.0.3_4
parmgridgen 0.0.2
scotch 6.0.4_4
...
Updated 2.4.x (problem with /usr/include
in -I flags for CGAL) and 4.x
(new commits in this branch) patches.
Patches for 4.0 and 4.x (well, slight modification of the last -dev patch).
Updated 3.0.x and dev patches. Currently by default foamyMesh is not built, if
you need it, set FOAMY_HEX_MESH
environment variable to non-empty value (for
example add export FOAMY_HEX_MESH=Y
to prefs.sh
).
Build process was tested on
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.5
BuildVersion: 15F34
with
$ clang++ --version
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
and the following third-party packages:
$ brew list --versions
boost 1.60.0_2
cgal 4.7
gmp 6.1.0
metis 5.1.0
mpfr 3.1.4
open-mpi 1.10.2_1
parmetis 4.0.3_3
parmgridgen 0.0.2
scotch 6.0.4_1
Updated 3.0.1 and 3.0.x patches to fix problem on CLT only systems (reported by Nikolai Tauber), this includes:
xcrun --show-sdk-path
returned empty string
remove part of CC
command).Allwmake
script to set up environment if it is not.
Since any way Allwmake
script should be run from $WM_PROJECT_DIR
, we
could source etc/bashrc
in the beginning to remedy quite confusing
./Allwmake: line 7: /wmake/scripts/AllwmakeParseArguments: No such file or directory
.Build process was tested on
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.4
BuildVersion: 15E65
with
$ clang++ --version
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
and the following third-party software (there is still problem with new Homebrew's METIS, so, no METIS this time)
$ brew list --versions
boost 1.60.0_1
cgal 4.7
gmp 6.1.0
mpfr 3.1.3
open-mpi 1.10.2
scotch 6.0.4_1
Though OpenCFD distributes Docker images for OS X, to me native compilation looks more convenient (for people who does not like compilation, there are precompiled binaries). Installation guide is almost the same as for any other release (OpenFOAM(R) release & Homebrew), except:
$FOAM_SRC/postProcessing/functionObjects/graphics
) depend on VTK. You can install the library with Homebrew (right now there is Python library path problem with bottled version, so either install using --build-from-source
flag, or edit $(brew --prefix)/opt/vtk/lib/cmake/vtk-6.3/Modules/vtkPython.cmake
so it points to valid Python installation).Updated patch for development OpenFOAM(R) branch.
Major update.
Changed wmake rules for Darwin. ~~Hopefully this solves problems with missing symbols (1, 2). Though, since I never had this problem on my laptop it is a question of external testing.~~ No, it did not solve the problem.
Fixed bugs and typos in RunFunctions, also added overwrite flag from dev-repository (now run(Application|Parallel) functions have -f, -force, --force, -overwrite flags to run application overwriting log-file, and -a, -append, --append flags to run application and append to log-file).
Just for fun added emulation of "silent rules" in 3.0.x. To turn this
feature on you need to set WM_SILENT_RULES
to non-empty value (export WM_SILENT_RULES=y
in prefs.sh
will do the trick). And instead of
daphne:icoFoam$ wmake
$WM_PROJECT_DIR/applications/solvers/incompressible/icoFoam
Making dependency list for source file icoFoam.C
xcrun c++ -arch x86_64 -Ddarwin64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wno-unused-parameter -Wno-overloaded-virtual -Wno-unused-variable -Wno-unused-local-typedef -Wno-invalid-offsetof -Wno-c++11-extensions -O3 -DNoRepository -ftemplate-depth-100 -I$WM_PROJECT_DIR/src/finiteVolume/lnInclude -I$WM_PROJECT_DIR/src/meshTools/lnInclude -IlnInclude -I. -I$WM_PROJECT_DIR/src/OpenFOAM/lnInclude -I$WM_PROJECT_DIR/src/OSspecific/POSIX/lnInclude -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -c icoFoam.C -o $WM_PROJECT_DIR/platforms/darwin64ClangDPInt64Opt/applications/solvers/incompressible/icoFoam/icoFoam.o
xcrun c++ -arch x86_64 -Ddarwin64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wno-unused-parameter -Wno-overloaded-virtual -Wno-unused-variable -Wno-unused-local-typedef -Wno-invalid-offsetof -Wno-c++11-extensions -O3 -DNoRepository -ftemplate-depth-100 -I$WM_PROJECT_DIR/src/finiteVolume/lnInclude -I$WM_PROJECT_DIR/src/meshTools/lnInclude -IlnInclude -I. -I$WM_PROJECT_DIR/src/OpenFOAM/lnInclude -I$WM_PROJECT_DIR/src/OSspecific/POSIX/lnInclude -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -Wl,-execute,-undefined,dynamic_lookup $WM_PROJECT_DIR/platforms/darwin64ClangDPInt64Opt/applications/solvers/incompressible/icoFoam/icoFoam.o -L$WM_PROJECT_DIR/platforms/darwin64ClangDPInt64Opt/lib \
-lfiniteVolume -lmeshTools -lOpenFOAM -ldl \
-lm -o $WM_PROJECT_DIR/platforms/darwin64ClangDPInt64Opt/bin/icoFoam
you will get
daphne:icoFoam$ wmake
$WM_PROJECT_DIR/applications/solvers/incompressible/icoFoam
[CC] icoFoam.C
[LD] icoFoam
As usual, build was tested on:
daphne:openfoam-os-x$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.2
BuildVersion: 15C50
with the following compiler:
daphne:openfoam-os-x$ clang++ --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
and the following thrid party packages:
daphne:openfoam-os-x$ brew list --versions
boost 1.59.0
cgal 4.6.3
eigen 3.2.6
gmp 6.1.0
metis 5.1.0
mpfr 3.1.3
open-mpi 1.10.1
parmetis 4.0.3_3
parmgridgen 0.0.2
scotch 6.0.4_1
Added patch for swak4Foam and wiki page with installation guide. Maybe one day it will be imported into Mercurial repository, I do not have plans to open pull request on Sourceforge.
Updated patches to include
Updated 3.0.0 and 3.0.x patches to include build logic for Scotch and METIS
with 64-bit index types. Libraries can be installed using files (scotch64.rb
and metis64.rb
) from formulae
folder. See OpenFOAM 3.0.(0|x) & WM_LABEL_SIZE=64.
Initial commit of 3.0.0 and 3.0.x patches (at this point they are identical). For 32 bit labels nothing changed in installation procedure. For 64 bit labels currently Scotch and METIS decomposition methods along with MGridGenGamgAgglomeration agglomeration method are disabled. They could be enabled in the future patches after testing 64 bit indexes in Scotch and METIS.
Update for 2.2.x, 2.3.1, 2.3.x, 2.4.0, and 2.4.x patches that includes fixes in printStack function.
Dropped 2.1.x patch (you can find it in earlier releases/commits) as I do have enough resources to support it. Temporarily removed -dev patch, currently it is equal to 3.0.x.
Build was tested on
alexey at daphne in openfoam-os-x$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.11.1
BuildVersion: 15B42
with
alexey at daphne in openfoam-os-x$ clang++ --version
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
and these third party libraries
alexey at daphne in openfoam-os-x$ brew list --versions
boost 1.59.0
cgal 4.6.3
gmp 6.0.0a
metis 5.1.0
mpfr 3.1.3
open-mpi 1.10.0
parmetis 4.0.3_2
parmgridgen 0.0.1
scotch 6.0.4_1
Being upset by sigSegv in renumberMesh (guess segmentation violations happen in other places as well, yet I found it in renumberMesh), copied NullObject concept from -dev repository. Now everything seems to be OK (at least renumberMesh works).
Made additional cosmetic corrections (like SloanRenumber build script, so it checks for library with dylib extension instead of so).
Build process was tested on
alexey at daphne in openfoam-os-x$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.5
BuildVersion: 14F27
with the following compiler:
alexey at daphne in openfoam-os-x$ clang --version
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
and these third party packages:
alexey at daphne in openfoam-os-x$ brew list --versions
boost 1.58.0
cgal 4.6.1
metis 5.1.0
open-mpi 1.8.4_1
parmetis 4.0.3
parmgridgen 0.0.1
Updated patches for OpenFOAM(R) 2.3.1 and 2.4.0.
Updated patches for 2.3.x and 2.4.x (forgot certain things). Added patches for
2.2.x and 2.1.x (reinterpret_cast<const void*>
solution for reference address seems to solve memory corruption
problem).
Test platform and third party software versions did not change since September 5.
Updated patches for 2.3.x (OpenFOAM-2.3.x-2f9138f.patch
) and 2.4.x
(OpenFOAM-2.4.x-8685344.patch
) versions. This time decided not to be too
invasive, so ended up with 50k patches (with stats). There were 3 general types
of modifications:
-Wno-...
flag, yet I have chosen
reinterpret_cast
way. The second problem is solved by conditional
compilation and pragmas.Cause these patches were "fresh start", finally paid attention to and implemented SetNaN functionality; simplified sigFpe code; implemented dlLoaded function. Also printStack.C was a little bit revised to contract HOME and PWD in library file names (in previous version HOME and PWD paths was replaced only in resolved source files).
And since the corrections are mostly in the old files, hope creation of patches for new versions will become much easier.
Build was tested on:
alexey at daphne in ~$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.5
BuildVersion: 14F27
with the following compiler
alexey at daphne in ~$ clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
and the following third party packages:
alexey at daphne in ~$ brew list --versions
boost 1.58.0
cgal 4.6.1
gmp 6.0.0a
libmpc 1.0.3
metis 5.1.0
mpfr 3.1.3
open-mpi 1.8.4_1
parmetis 4.0.3
parmgridgen 0.0.1
Added patch for OpenFOAM-dev
(commit 40310a5). Though this time patch is less
invasive, so maybe it will work with later commits.
The patch is a continuation of an attempt to build OpenFOAM(TM) with -Wall -Wextra -std=c++11
flags.
p
, yet for consistency I have decided
to use comments everywhere). Patch was submitted upstream.WM_LABEL_SIZE=64
, since it requires recompilation of Scoth. Maybe later
I will create special Homebrew formula for this version.if (mag(A > B))
instead of if (mag(A) > B)
), they were fixed. Patches are
submitted upstream.Since the patch is a fresh start compared to 2.3.x and 2.4.x versions, there could be certain bugs, which were not revealed by quick tutorials check. Use github Issues functionality to report them.
Build process was tested on:
alexey at daphne in ~$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.4
BuildVersion: 14E46
with the following compiler
alexey at daphne in ~$ clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
and with the following third party package versions:
alexey at daphne in ~$ brew list --versions
boost 1.57.0
cgal 4.6
gmp 6.0.0a
metis 5.1.0
mpfr 3.1.2-p11
open-mpi 1.8.4_1
parmetis 4.0.3
parmgridgen 0.0.1
scotch 6.0.4_1
Added patches for OpenFOAM(R) 2.4.0 and 2.4.x (commit b750988).
The patches are an attempt to build OpenFOAM with -Wall -Wextra -std=c++11 flags. The following appears after addition of the flags:
#include "readTimeControls.H"
in the beginning of the
solver, though not all created variables are used. Solved the problem by
introducing readInitialTimeControls.H
file and partially pruning unused
chunks of code.postProcessing/functionObjects
library
is an example of the problem). Solved by either declaring and implementing
correct methods, or by "using Class::method" addition.As usual, build was tested on:
alexey at daphne in ~$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.3
BuildVersion: 14D136
with the following compiler
alexey at daphne in ~$ clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
and with the following third party package versions:
boost 1.57.0
cgal 4.6
gmp 6.0.0a
metis 5.1.0
mpfr 3.1.2-p11
open-mpi 1.8.4_1
parmetis 4.0.3
parmgridgen 0.0.1
scotch 6.0.4_1
Build was tested on
alexey at daphne in ~$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.3
BuildVersion: 14D136
With the following versions of third party packages
alexey at daphne in ~$ brew ls --versions
bison27 2.7.1
boost 1.57.0
cgal 4.6
gmp 6.0.0a
hwloc 1.9
libmpc 1.0.3
mesquite 2.1.2
metis 5.1.0
mpfr 3.1.2-p11
open-mpi 1.8.4
parmetis 4.0.3
parmgridgen 0.0.1
scotch 6.0.3
Added patch for OpenFOAM(TM) 2.3.1. Build was tested on:
myself at daphne in openfoam-os-x$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.1
BuildVersion: 14B25
myself at daphne in openfoam-os-x$ clang --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix