CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.com] Problem installing OpenFoam-v1912 from source

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By alexeym
  • 1 Post By alexeym
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2020, 14:29
Default Problem installing OpenFoam-v1912 from source
  #1
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Hi everyone.
I have a problem installing Openfoam-v1912 (in mac-catalina) from source through the following link:https://www.openfoam.com/download/install-source.php

I have followed the steps as given in the above link, that is:
I have installed the necessary .tgz:
mkdir $HOME/OpenFOAM && tar -xzf OpenFOAM-v1912.tgz -C $HOME/OpenFOAM && tar -xzf ThirdParty-v1912.tgz -C $HOME/OpenFOAM

but I get the following flag when I am sourcing the OpenFoam environment: (source ~/OpenFOAM/OpenFOAM-v1912/etc/bashrc)
Darwin support is clang/llvm only

Hence, I installed both the clang and llvm: (below I give the proof for that)

============
clang --version
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

brew info llvm
lvm: stable 9.0.1 (bottled), HEAD [keg-only]
.....
build -error: 0 (30 days)
===============

But I still get the same flag.
As a result, I get the folllowing error when I test the system readiness in the Compilation section of the guide: https://www.openfoam.com/code/build-guide.php

================
foamSystemCheck

Checking basic system...
-----------------------------------------------------------------------
Shell: /bin/bash
Host: Kotsioss-MacBook-Pro.local
ERROR: Incompatible operating system "Darwin".
OpenFOAM v1912 is currently available for
Linux, LinuxAMD64 and SunOS only.

User: kotsios


System check: FAIL
==================
Your system is not currently compatible with OpenFOAM installation
requirements. Review the error messages and consult the documentation
for further instructions.
=====================


Any advice?
madgeogr is offline   Reply With Quote

Old   March 26, 2020, 05:22
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You can try to ignore the error Since foamSystemCheck utility is not adapted for macOS installations (maybe you should submit a bug report):

Code:
# check os
OSTYPE=$(uname -s)
case "$OSTYPE" in
Linux | LinuxAMD64 | SunOS )
    echo "$(fixlen OS: $WIDTH) $OSTYPE version $(uname -r)"
    ;;
*)
    echo "ERROR: Incompatible operating system \"$OSTYPE\"."
    echo "       OpenFOAM $WM_PROJECT_VERSION is currently available for "
    echo "       Linux, LinuxAMD64 and SunOS only."
    echo
    fatalError=true
    ;;
esac
Do you have case-sensitive file system in your home folder?

UPD. There is compilation problem, so you can not, in fact, install this version without patching.
alexeym is offline   Reply With Quote

Old   March 26, 2020, 13:37
Default
  #3
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Hi alexeym,
thanks for the advice. I will consider installing another version.
In the process, I have also encountered another issue, related to Catalina version (again).
In particular, "Apple has changed the default shell to zsh. Therefore you have to rename your configuration files. .bashrc is now .zshrc and .bash_profile is now .zprofile."
https://stackoverflow.com/questions/...ed-by-my-shell
I have created a .zshrc file, but I am confused on how to move forward from there.
madgeogr is offline   Reply With Quote

Old   March 26, 2020, 14:50
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Modification, necessary to fix compilation, is quite small, in fact. Clang can't resolve certain templates, so call to std::max_element produces an error. Another error, which can be ignored, is in cfMesh and is related to OpenMP.

So ad-hoc fix is something like (later HashTable::iterator code should be fixed)

Code:
diff -r a/src/OpenFOAM/containers/Bits/bitSet/bitSetTemplates.C b/src/OpenFOAM/containers/Bits/bitSet/bitSetTemplates.C
78c78,85
<     const auto max = std::max_element(first, last);
---
> #ifdef __APPLE__
>     auto max = first;
>     for(; first != last; ++first)
>         if (*max < *first) max = first;
> #else
>     auto const max = std::max_element(locations.begin(), locations.end());
> #endif
>     // const auto max = std::max_element(first, last);
diff -r a/src/OpenFOAM/containers/HashTables/HashOps/HashOps.C b/src/OpenFOAM/containers/HashTables/HashOps/HashOps.C
82a83,89
> #ifdef __APPLE__
>     labelHashSet::const_iterator first = std::begin(locations);
>     labelHashSet::const_iterator last = std::end(locations);
>     labelHashSet::const_iterator max = first;
>     for(; first != last; ++first)
>         if (*max < *first) max = first;
> #else
83a91
> #endif
There was no such error in v1812. Did not try v1906.

Concerning zsh, you can add

Code:
export BASH_SILENCE_DEPRECATION_WARNING=1
to your .bash_profile (or .profile) to remove warning and continue to use bash. Also IIRC zsh was quite happy to source OpenFOAM's bashrc.
alexeym is offline   Reply With Quote

Old   March 26, 2020, 16:17
Default
  #5
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Hi,
thanks for your help.
I follow your advice, meaning that I included the additional code in the .C files,
and I also added "export BASH_SILENCE_DEPRECATION_WARNING=1" in the
.bash_profile at the home directory. Then I sourced the environment. But when I use ./Allwmake, I got the following:

gcc=/usr/bin/gcc
clang=/usr/bin/clang
mpirun=/usr/local/bin/mpirun
make=/usr/bin/make
cmake=/usr/local/bin/cmake
wmake=/Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake/wmake
m4=/usr/bin/m4
flex=/usr/bin/flex

compiler=/usr/bin/cc
Apple clang version 11.0.0 (clang-1100.0.33.17)

========================================
2020-03-26 23:12:09 +0200
Starting compile OpenFOAM-v1912 Allwmake
Gcc system compiler
darwin64GccDPInt32Opt, with SYSTEMOPENMPI openmpi-system
========================================

/Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake/rules/General/general:33: /Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake/rules/darwin64Gcc/general: No such file or directory
make: Failed to remake makefile `/Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake/rules/darwin64Gcc/general'.
lemon.c -o /Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake/platforms/darwin64Gcc/lemon
make: lemon.c: No such file or directory
make: *** [/Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake/platforms/darwin64Gcc/lemon] Error 1
madgeogr is offline   Reply With Quote

Old   March 27, 2020, 01:46
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

As it was said in warning during "source etc/bashrc" step, currently there are build rules only for Clang on macOS. Yet, for some reason you are trying to access Gcc build rules:

Code:
...
.../OpenFOAM-v1912/wmake/rules/General/general:33: .../OpenFOAM-v1912/wmake/rules/darwin64Gcc/general: No such file or directory
...
Could you post output of

Code:
export | grep WM_
after you sourced etc/bashrc?
alexeym is offline   Reply With Quote

Old   March 27, 2020, 03:38
Default
  #7
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Sure,
after I sourced the OpenFoam environment:

Kotsioss-MacBook-Pro:OpenFOAM-v1912 kotsios$ source etc/bashrc
Darwin support is clang/llvm only

I execute the following command:

Kotsioss-MacBook-Pro:OpenFOAM-v1912 kotsios$ export | grep WM_
declare -x WM_ARCH="darwin64"
declare -x WM_COMPILER="Gcc"
declare -x WM_COMPILER_TYPE="system"
declare -x WM_COMPILE_OPTION="Opt"
declare -x WM_DIR="/Users/kotsios/OpenFOAM/OpenFOAM-v1912/wmake"
declare -x WM_LABEL_OPTION="Int32"
declare -x WM_LABEL_SIZE="32"
declare -x WM_MPLIB="SYSTEMOPENMPI"
declare -x WM_OPTIONS="darwin64GccDPInt32Opt"
declare -x WM_PRECISION_OPTION="DP"
declare -x WM_PROJECT="OpenFOAM"
declare -x WM_PROJECT_DIR="/Users/kotsios/OpenFOAM/OpenFOAM-v1912"
declare -x WM_PROJECT_USER_DIR="/Users/kotsios/OpenFOAM/kotsios-v1912"
declare -x WM_PROJECT_VERSION="v1912"
declare -x WM_THIRD_PARTY_DIR="/Users/kotsios/OpenFOAM/ThirdParty-v1912"



Thanks again
madgeogr is offline   Reply With Quote

Old   March 27, 2020, 04:01
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
The problem is here:

Code:
WM_COMPILER="Gcc"
Som either you source bashrc like this:

Code:
WM_COMPILER="Clang" source etc/bashrc
or you create $HOME/.OpenFOAM/prefs.sh with corresponding export. Mine is like this:

Code:
WM_COMPILER=Clang
WM_COMPILE_OPTION=Opt
WM_MPLIB=SYSTEMOPENMPI
WM_PRECISION_OPTION=DP
WM_LABEL_SIZE=32
export WM_NCOMPPROCS=$(sysctl -n hw.ncpu)
madgeogr likes this.
alexeym is offline   Reply With Quote

Old   March 27, 2020, 12:20
Default
  #9
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Hi,
sorry again for bothering you, but it still does not work. I did as you said, meaning:
WM_COMPILER="Clang" source etc/bashrc

and I got again the following flag:
Darwin support is clang/llvm only

Then, I went into to the bashrc and I changed the compiler there from Gcc to clang:
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-5] | Gcc7[1-4] | Gcc8[12] |
# Clang | Clang3[7-9] | Clang[4-6]0 | Icc | Cray | Arm | Pgi
export WM_COMPILER=Clang

but still nothing happened. Then, I created the prefs.sh in $HOME, and I paste inside
---------
WM_COMPILER=Clang
WM_COMPILE_OPTION=Opt
WM_MPLIB=SYSTEMOPENMPI
WM_PRECISION_OPTION=DP
WM_LABEL_SIZE=32
export WM_NCOMPPROCS=$(sysctl -n hw.ncpu)
---------

But nothing again. To be honest, I do not understand what I am doing. Do you recommend any other version of OpenFoam that I might avoid all these troubles?
And thank you very much again for your help, it is appreciated
madgeogr is offline   Reply With Quote

Old   March 27, 2020, 12:37
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Whole idea behind this forum is to bother people

It is not quite clear what do you expect. You will always get this message:

Code:
Darwin support is clang/llvm only
Since it is always displayed on macOS. Surely it would be nice if ESI adds WM_COMPILER variable reset for Darwin in future releases.

As soon as you have WM_COMPILER set to Clang you can try to compile software.

You choose OpenFOAM version according to required functionality. There are certain things only available in ESI's OpenFOAM. If you can not compile software, you can always use it inside Docker image (https://openfoam.com/download/install-binary-mac.php).

Personally I use Foundation's OpenFOAM flavour. You can easily find native build guide for macOS using preferred search engine.
madgeogr likes this.
alexeym is offline   Reply With Quote

Old   March 27, 2020, 13:12
Default
  #11
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Alexey,
I also changed the compiler to "Clang" in the cshrc file, I sourced the environment, and I "./Allwmake". The last five minutes the OpenFoam was compiling, until I got the following error:

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstring:89:9: error: no member named 'strtok' in the global namespace
using ::strtok;
~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [/Users/kotsios/OpenFOAM/OpenFOAM-v1912/build/darwin64ClangDPInt32Opt/src/OSspecific/POSIX/POSIX.o] Error 1

At least there is progress i guess

Any further advice?


PS: Regarding docker: At first I installed docker, and the code worked fine. But I need to implement a turbulence model in the code, thus I needed the source code as well.
madgeogr is offline   Reply With Quote

Old   March 27, 2020, 14:56
Default
  #12
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Alexey,
I show an another thread a similar issue as mine:
OpenFOAM 5.x (mrklein patch) and macOS High Sierra
in which the same error occurred:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:89:9: error: no member named 'strtok' in the global namespace

It is mentioned that the problem was solved after a clean installation.
In order to do that, I found on the internet that I have to implement the follow steps:
$> cd $WM_PROJECT_DIR
• $> ./wcleanAll
• $> ./Allwmake

The problem is that I do not find wcleanAll (i found different "cleans" in wmake folder):
./wcleanAll
-bash: ./wcleanAll: No such file or directory

Any additional patches?
madgeogr is offline   Reply With Quote

Old   March 27, 2020, 15:17
Default
  #13
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
And we have arrived to the question, I have asked in my first reply [1]: is your home folder located on a case-sensitive file system?

Usually on macOS it is case-preserving but case-insensitive. So, for example, string.h and string.H point to the same file (the reason for your error). string.h is a system header, string.H is OpenFOAM's header file. Later you will encounter errors due to time.h and Time.H name clash.

Guess, the way to proceed is to clean OpenFOAM folder. Create disk image with case-sensitive file system (you can find necessary commands here: https://github.com/mrklein/openfoam-os-x/wiki). Mount this disk image into $HOME/OpenFOAM and restart build process.

1. Problem installing OpenFoam-v1912 from source
madgeogr likes this.
alexeym is offline   Reply With Quote

Old   March 27, 2020, 15:22
Default
  #14
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Thanks Alexey,
I will try that.
Have a good night!
madgeogr is offline   Reply With Quote

Old   March 28, 2020, 13:32
Default
  #15
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Hi Alexey,
I have a problem (again) when i am following the instructions as given in https://github.com/mrklein/openfoam-...ase-&-Homebrew
In particular, I have followed the steps without any problem until when I had to apply the patch with git:
git apply OpenFOAM-v1912.patch
When I opened the patch file, I show the flag: 404: Not Found. Where can I find the patch? When I visited your site, I show that you have patches for different versions of OpenFoam, but not for v1912.
If I download the most recent one, "OpenFOAM-7-0ebbff061.patch" and execute "git apply OpenFOAM-7-0ebbff061.patch" instead, do you think it will be OK?
madgeogr is offline   Reply With Quote

Old   March 31, 2020, 16:12
Default
  #16
New Member
 
Kostas
Join Date: May 2018
Posts: 18
Rep Power: 7
madgeogr is on a distinguished road
Thanks Alexey,
I eventually used your patches for Openfoam 6 and now OF works properly. Thank you very much for your time!
madgeogr is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 09:17
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


All times are GMT -4. The time now is 19:34.