Closed BrushXue closed 4 years ago
I managed to fix this error by changing it to
return std::pow(magQ, power)*exp(powq);
Then here comes the second similar error:
extrudeModel/extrudeModel.C:82:18: error: call to 'pow' is ambiguous
(1.0-pow(expansionRatio_, layer))
It is not possible to manually fix all pow() functions in OpenFOAM. How should I fix all of them?
Hi,
I will try to reproduce the error and either correct the patch or demand additional information.
No, you should not substitute pow with std::pow everywhere, since usually it should be Foam::pow.
@BrushXue unfortunately I was not able to reproduce your error. I have tried with two different clangs: one from CL Tools, one from Xcode. Both compile OpenFOAM-7 without any difficulties.
Could you run xcrun c++ --version
instead of clang++ --version
?
$ xcrun c++ --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
Could you add more context around errors? I.e. could you post your build log file (or just a part around errors).
I forgot to mention that I used WM_LABEL_SIZE=64(with metis64 and scotch64 you provided). Is that a problem for mac to compile with 64bit label? I'm attaching the log file. log.txt
Quite a significant addition. In fact, I have not tested 64-bit label builds for a long time, they can be broken. According to the log, you have attached, there are certain missing definitions. I will take a look and update the patch as necessary.
I'm testing it with 32bit label. Seems like it will go through so there must be something broken with 64bit integers.
EDIT: I was able to compile almost everything on 32bit, except for this one.
wmake MGridGenGamgAgglomeration
wmakeLnIncludeAll: running wmakeLnInclude on dependent libraries:
wmakeLnInclude error: base directory EXE_INC does not exist
wmakeLnInclude error: base directory += does not exist
wmakeLnInclude error: base directory /MGridGen/Lib/ does not exist
wmakeLnInclude error: base directory EXE_INC does not exist
wmakeLnInclude error: base directory += does not exist
wmakeLnInclude error: base directory /MGridGen/IMlib/ does not exist
Hi,
If you need this to be fixed ASAP, then you can use attached patch to add necessary bits to Scalar. Or you can wait till I update patch in the repository. Below is the attached patch, basically it adds pow functions with scalar and int64_t.
diff --git a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H
index 86e5484b5..5852ef13a 100644
--- a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H
+++ b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H
@@ -100,6 +100,10 @@ MAXMINPOW(Scalar, Scalar, int)
MAXMINPOW(Scalar, int, Scalar)
MAXMINPOW(Scalar, Scalar, long)
MAXMINPOW(Scalar, long, Scalar)
+#if defined(darwin64) && WM_LABEL_SIZE == 64
+MAXMINPOW(Scalar, Scalar, int64_t)
+MAXMINPOW(Scalar, int64_t, Scalar)
+#endif
MAXMINPOW(Scalar, Scalar, float)
MAXMINPOW(Scalar, float, Scalar)
diff --git a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H
index f427b0109..582116e68 100644
--- a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H
+++ b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H
@@ -98,6 +98,10 @@ inline double pow(const type1 s, const type2 e) \
MAXMINPOW(Scalar, Scalar, Scalar)
MAXMINPOW(Scalar, Scalar, int)
MAXMINPOW(Scalar, int, Scalar)
+#if defined(darwin64) && WM_LABEL_SIZE == 64
+MAXMINPOW(Scalar, Scalar, int64_t)
+MAXMINPOW(Scalar, int64_t, Scalar)
+#endif
MAXMINPOW(Scalar, Scalar, long)
MAXMINPOW(Scalar, long, Scalar)
diff --git a/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H b/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H
index d2a5ff849..a82a28509 100644
--- a/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H
+++ b/src/OpenFOAM/primitives/Scalar/longDoubleScalar/longDoubleScalar.H
@@ -105,6 +105,10 @@ inline double pow(const type1 s, const type2 e) \
MAXMINPOW(Scalar, Scalar, Scalar)
MAXMINPOW(Scalar, Scalar, int)
MAXMINPOW(Scalar, int, Scalar)
+#if defined(darwin64) && WM_LABEL_SIZE == 64
+MAXMINPOW(Scalar, Scalar, int64_t)
+MAXMINPOW(Scalar, int64_t, Scalar)
+#endif
MAXMINPOW(Scalar, Scalar, long)
MAXMINPOW(Scalar, long, Scalar)
MAXMINPOW(Scalar, Scalar, float)
diff --git a/src/fvAgglomerationMethods/Allwmake b/src/fvAgglomerationMethods/Allwmake
index 48abdf020..c7d4ff303 100755
--- a/src/fvAgglomerationMethods/Allwmake
+++ b/src/fvAgglomerationMethods/Allwmake
@@ -7,7 +7,8 @@ cd ${0%/*} || exit 1 # Run from this directory
if [ "$(uname -s)" = "Darwin" ]
then
[ -e "/usr/local/opt/parmgridgen/lib/libmgrid.a" -a \
- "$WM_LABEL_SIZE" -ne "64" ] \
+ "$WM_LABEL_SIZE" -ne "64" -a \
+ "$WM_PRECISION_OPTION" != "LP" ] \
&& wmake $targetType MGridGenGamgAgglomeration
elif [ -e "$FOAM_LIBBIN/libMGridGen.so" ]
then
Thanks for the patch. It works like a charm!
Hello,
I was installing OpenFOAM-7-0ebbff061 following your tutorial and got an error:
My system information
3rd party:
Is my software version too new?