Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newbie Problems #71

Open
wallbob opened this issue Nov 12, 2021 · 10 comments
Open

Newbie Problems #71

wallbob opened this issue Nov 12, 2021 · 10 comments

Comments

@wallbob
Copy link

wallbob commented Nov 12, 2021

I have a Mac mini with Apple Silicon and I'm trying to build a native instance of OpenFOAM v9. I followed the directions located here:

https://github.com/mrklein/openfoam-os-x/wiki/OpenFOAM(R)-release-&-Homebrew

Everything works fine until I get to the following command:

git apply OpenFOAM-9.patch

I receive the following error:

error: patch failed: etc/bashrc:154
error: etc/bashrc: patch does not apply

Any suggestions?

@mrklein
Copy link
Owner

mrklein commented Nov 12, 2021

I would suggest to use more recent OpenFOAM-9 source code. Either checkout sources from git repository, or use patch release, as described here: https://openfoam.org/news/v9-patch/.

The problem is that between release 9 and time when patch was created, there was source code change:

# Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify alternative pref files
export FOAM_SETTINGS="$@"
_foamEval $@

was changed to

# Evaluate command-line parameters of the form "param=keyword" or unset
# parameters with "param="
export FOAM_SETTINGS="$@"
_foamParams $@

And this breaks application of the patch.

@wallbob
Copy link
Author

wallbob commented Nov 12, 2021

So, I tried the following:

  1. download the latest dev version of the source code:

curl -L http://dl.openfoam.org/source/9 > OpenFOAM-9.20211007.tgz

  1. download the latest version of the patch

curl -L https://raw.githubusercontent.com/mrklein/openfoam-os-x/master/OpenFOAM-9-2b1d7d67c.patch > OpenFOAM-9.patch

However, when I run the command "git apply OpenFOAM-9.patch" I get the same error:

error: patch failed: etc/bashrc:154
error: etc/bashrc: patch does not apply

@mrklein
Copy link
Owner

mrklein commented Nov 12, 2021

Correct URL for patch release is http://dl.openfoam.org/source/9.20211007. So, you do:

$ curl -L http://dl.openfoam.org/source/9.20211007 | tar xz
$ mv OpenFOAM-9-20211007 OpenFOAM-9
$ cd OpenFOAM-9
$ curl -LO https://raw.githubusercontent.com/mrklein/openfoam-os-x/master/OpenFOAM-9-2b1d7d67c.patch
$ git apply OpenFOAM-9-2b1d7d67c.patch

With your command

curl -L http://dl.openfoam.org/source/9 > OpenFOAM-9.20211007.tgz

you just downloaded release 9 Into a file with the name OpenFOAM-9.20211007.tgz. And as a result, you got the same error.

@wallbob
Copy link
Author

wallbob commented Nov 13, 2021

Thanks for the help. Now it is compiling!

Next error:

When I run Allwmake it goes for a long time then stops when trying to compile scotch. Here is the error:

using SCOTCH_ARCH_PATH=/usr/local

wmake scotchDecomp
Making dependency list for source file scotchDecomp.C
could not open file scotch.h for source file scotchDecomp.C due to No such file or directory
xcrun c++ -arch x86_64 -std=c++14 -Ddarwin64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wno-unused-parameter -Wno-overloaded-virtual -Wno-unused-variable -Wno-unused-local-typedef -Wno-invalid-offsetof -Wno-deprecated-register -Wno-undefined-var-template -O3 -DNoRepository -ftemplate-depth-100 -DOMPI_SKIP_MPICXX -I/usr/local/Cellar/open-mpi/4.1.1_2/include -I/usr/local/include -I../decompositionMethods/lnInclude -IlnInclude -I. -I/Users/rditlrmw/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude -I/Users/rditlrmw/OpenFOAM/OpenFOAM-9/src/OSspecific/POSIX/lnInclude -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -c scotchDecomp.C -o /Users/rditlrmw/OpenFOAM/OpenFOAM-9/platforms/darwin64ClangDPInt32Opt/src/parallel/decompose/scotchDecomp/scotchDecomp.o
scotchDecomp.C:36:10: fatal error: 'scotch.h' file not found
#include "scotch.h"
^~~~~~~~~~
1 error generated.
make: *** [/Users/rditlrmw/OpenFOAM/OpenFOAM-9/platforms/darwin64ClangDPInt32Opt/src/parallel/decompose/scotchDecomp/scotchDecomp.o] Error 1
bash-3.2$

@mrklein
Copy link
Owner

mrklein commented Nov 14, 2021

This one is caused by new Homebrew package installation location on M1. On x86_64 Homebrew links formulae in /usr/local/opt, on M1 it is different. So, you open etc/config.sh/mac/scotch (and then etc/config.sh/mac/metis) and put there location of Scotch and METIS (SCOTCH_ARCH_PATH and METIS_ARCH_PATH). Guess, in future patch versions search logic should be adapted to use brew --cellar.

@massisenergy
Copy link

Hello,

Thanks for posting the problems, I faced similar issues (M1Pro 10 core, 32GB RAM) and this helped. But when I tried to test the installation, it returned such errors:

$ mkdir -p "$FOAM_RUN"
$ run
$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity .
$ cd cavity
$ foamRunTutorials
dyld[50136]: symbol not found in flat namespace '_MPI_Abort'
Running blockMesh on /Users/massisenergy/OpenFOAM/massisenergy-9/run/cavity
/Volumes/OpenFOAM/OpenFOAM-9/bin/tools/RunFunctions: line 56: 50140 Abort trap: 6           $APP_RUN "$@" > log.$LOG_SUFFIX 2>&1
Running  on /Users/massisenergy/OpenFOAM/massisenergy-9/run/cavity

log.Allwmake_backUp.txt

From the log, I could not see any obvious error that can be related to dyld ..., what is the issue here?

@mrklein
Copy link
Owner

mrklein commented Jan 5, 2022

Last time similar problem was reported, the was a problem of mixing Rosetta and native code. This also can be a problem of SIP. Did you try to run foamRunTutorials commands from command line? Since, there is no Allrun script in cavity tutorial, foamRunTutorials command runs these two: blockMesh and icoFoam. Could you run them from command line?

@massisenergy
Copy link

Thanks for your response.

I am not sure what do you mean by 'commands from command line'. Any OpenFOAM commands must be run from command line AFAIK. I attach screenshots from my terminal (iTerm2), if that helps.
Screenshot 2022-01-05 at 22 01 02
Screenshot 2022-01-05 at 21 59 24
How do I go about 'mixing Rosetta and native code'?

I'll disable SIP and then try again.

@mrklein
Copy link
Owner

mrklein commented Jan 5, 2022

foamRunTutorials is a script, which is quite simple: either it runs Allrun script in the current folder, or it creates mesh with blockMesh and runs solver (which is extracted from controlDict).

If there is a problem with SIP, usually it manifests when a case is run from script (like foamRunTutorials) due to cleaned DYLD_LIBRARY_PATH. If you simply enter commands one by one (i.e. blockMesh, icoFoam) usually everything works.

Concerning Rosetta (https://en.wikipedia.org/wiki/Rosetta_(software)) I was referencing this thread: #62 (comment). Since I do not use M1, I do not encounter these problems, so I can not help you any further.

@massisenergy
Copy link

I ran blockMesh and icoFoam individually. The result is same. I'll try to understand and adopt according to the issue you've mentioned, thanks.

Also I should mention that in stead of mounting using hdutil, I have used ln -s /Volumes/OpenFOAM $HOME/OpenFOAM, can that be causing those issues?
Screenshot 2022-01-06 at 19 02 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants