CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [OpenFOAM.org] Trying to build OpenFOAM 3.0.x with MacPorts (https://www.cfd-online.com/Forums/openfoam-installation/166359-trying-build-openfoam-3-0-x-macports.html)

jjstickel November 17, 2015 17:24

Trying to build OpenFOAM 3.0.x with MacPorts
 
gschaider have you made a patch for 3.0.x? Thanks.

[Moderator note: Posts on this topic were moved from here: http://www.cfd-online.com/Forums/ope...oam-2-4-a.html]

wyldckat November 22, 2015 10:01

Quote:

Originally Posted by jjstickel (Post 573759)
gschaider have you made a patch for 3.0.x? Thanks.

Quick answer: I can't answer for Bernhard, but I believe he's been pretty busy with a ton of work, based on what I've seen of his time spent here on the forum lately. Which in a sense is great, because it can mean that this way he's able to put more time into PyFoam and swak4Foam :)

Either way, Bernhard did mention in the past that he would happy to let anyone take over the work of providing said patches (I can't find the post for it right now :(). And I know that Alexey Matveichev has been putting a lot of work into maintaining patches for both OpenFOAM and foam-extend: https://github.com/mrklein/openfoam-os-x/wiki - Alexey's patches are designed to work with Homebrew, but due to how there have been recent issues with Macports (something something db48 something something), it might be best to switch to Homebrew and using Alexey's patches.

jjstickel November 30, 2015 11:56

Quote:

Originally Posted by wyldckat (Post 574414)
Quick answer: I can't answer for Bernhard, but I believe he's been pretty busy with a ton of work, based on what I've seen of his time spent here on the forum lately. Which in a sense is great, because it can mean that this way he's able to put more time into PyFoam and swak4Foam :)

Either way, Bernhard did mention in the past that he would happy to let anyone take over the work of providing said patches (I can't find the post for it right now :(). And I know that Alexey Matveichev has been putting a lot of work into maintaining patches for both OpenFOAM and foam-extend: https://github.com/mrklein/openfoam-os-x/wiki - Alexey's patches are designed to work with Homebrew, but due to how there have been recent issues with Macports (something something db48 something something), it might be best to switch to Homebrew and using Alexey's patches.

It is understandable when folks become too busy to continue with volunteer contributions. I am rather vested in using Macports (for several other computational science applications), and unfortunately Macports and Homewbrew do not mix well. BTW, the db48 Macports issue is really a nonissue (I didn't see it; others that did reported they could ignore it and OpenFOAM still worked). Nonetheless, I tried adapting the patch from mrklein for OpenFOAM-3.x and Macports without success.

Ideally, we should work on a patch that applies to both Homebrew and Macports. I'm willing to help, but doing it on my own is beyond me.

alexeym November 30, 2015 13:38

Hi,

Things to be adapted between patches:

1. Paths to third-party packages
2. wmake rules

Since you are "rather invested" in Macports I gues, you can retrieve package installation prefix using port command. wmake rules could be taken from earlier OpenFOAM versions (or adapted from Linux rules). IIRC conditional compilation rules with __clang__ symbol are used only to suppress diagnostics in certain places.

What were you problems during adaptation?

jjstickel December 1, 2015 10:46

Quote:

Originally Posted by alexeym (Post 575679)
Hi,

Things to be adapted between patches:

1. Paths to third-party packages
2. wmake rules

Since you are "rather invested" in Macports I gues, you can retrieve package installation prefix using port command. wmake rules could be taken from earlier OpenFOAM versions (or adapted from Linux rules). IIRC conditional compilation rules with __clang__ symbol are used only to suppress diagnostics in certain places.

What were you problems during adaptation?

To be consistent with my other Macports-installed software, I'd like to compile OpenFOAM with gcc(-49). The previous Macports-enabled OpenFOAM patches have extensive additions to etc/config/settings.sh to help with this, along with files in wmake/rules. I tried copying this stuff over to your (homebrew with clang) patch, but I either messed it up or there is some subtle difference with OpenFOAM-3.x. I've botched my build tree since my attempt, and so I can't report the build error at the moment.

I do see the homebrew specific lines in the other /etc/config/ files and was able to adapt them to Macports. I don't think that is the issue.

ChGr February 7, 2016 12:13

OpenFOAM 3.0.x on Mac OS X and Macports
 
Hey!

I'm looking for a way to compile OF 3.0.x on Mac OS X with Macports. Mr. Klein is providing a way of compiling OF 3.0.x using Homebrew (https://github.com/mrklein/openfoam-os-x).

Is there a patch for compiling with Macports instead of Homebrew?

jjstickel February 19, 2016 17:02

success with MacPorts!
 
1 Attachment(s)
Working from Alexey's patch (with Homebrew focus), I have successfully compiled OpenFOAM-3.0.1 with MacPorts-supplied dependencies. This is with OS X Yosemite, 10.10.5; Xcode-7.2.1. Patch attached.

Important note: this patch has a few things hardcoded and needs improvement to apply to different use cases. For example, cgal, metis, and scotch version numbers are hardcoded in their respective config files in etc/config. It also presumes that Macports is located in /opt/local/.

Also, perhaps of more significance, this patch only works for Apple Clang as the compiler, and with openmpi (not mpich). The previous 2.x patches provided by Bernhard Gschaider had a lot of extra code to enable use of gcc and either mpich or openmpi. I do not have the bandwidth to get that stuff included (I barely got this far).

From Macports, you will need:
Code:

scotch -mpich +openmpi
cgal
metis
ccache
bison
boost

Note the lack of compiler variants, especially on scotch. If you add a compiler variant, it will get the compiler from Macports and will likely cause trouble with building openfoam using apple clang. I got an error with macports' flex installed, so I uninstalled it.

Good luck!

gigilentini8 March 18, 2016 05:27

Any idea why is it not working with clang-3.8 from macports?

(EDIT: I actually get the same errors even if I use the apple clang compiler. any clue?)

Code:

OpenFOAM/OpenFOAM-3.0.x/platforms/darwin64ClangDPInt32Opt/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L.C:5494:8: error: member reference
      type 'std::istream *' (aka 'basic_istream<char> *') is a pointer; maybe you meant to use '->'?
                        yyin.rdbuf(std::cin.rdbuf());

and many others similar to this...

Quote:

Originally Posted by jjstickel (Post 586034)
Working from Alexey's patch (with Homebrew focus), I have successfully compiled OpenFOAM-3.0.1 with MacPorts-supplied dependencies. This is with OS X Yosemite, 10.10.5; Xcode-7.2.1. Patch attached.

Important note: this patch has a few things hardcoded and needs improvement to apply to different use cases. For example, cgal, metis, and scotch version numbers are hardcoded in their respective config files in etc/config. It also presumes that Macports is located in /opt/local/.

Also, perhaps of more significance, this patch only works for Apple Clang as the compiler, and with openmpi (not mpich). The previous 2.x patches provided by Bernhard Gschaider had a lot of extra code to enable use of gcc and either mpich or openmpi. I do not have the bandwidth to get that stuff included (I barely got this far).

From Macports, you will need:
Code:

scotch -mpich +openmpi
cgal
metis
ccache
bison
boost

Note the lack of compiler variants, especially on scotch. If you add a compiler variant, it will get the compiler from Macports and will likely cause trouble with building openfoam using apple clang. I got an error with macports' flex installed, so I uninstalled it.

Good luck!


jjstickel March 18, 2016 11:46

Quote:

Originally Posted by gigilentini8 (Post 590396)
Any idea why is it not working with clang-3.8 from macports?

(EDIT: I actually get the same errors even if I use the apple clang compiler. any clue?)

Code:

OpenFOAM/OpenFOAM-3.0.x/platforms/darwin64ClangDPInt32Opt/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L.C:5494:8: error: member reference
      type 'std::istream *' (aka 'basic_istream<char> *') is a pointer; maybe you meant to use '->'?
                        yyin.rdbuf(std::cin.rdbuf());

and many others similar to this...

Sorry, I don't know. I found that OpenFOAM throws various errors for different compilers. Did you apply the patch? Are you sure you are using Apple clang? What is the output of "which clang"?

gigilentini8 March 18, 2016 18:14

Quote:

Originally Posted by jjstickel (Post 590485)
Sorry, I don't know. I found that OpenFOAM throws various errors for different compilers. Did you apply the patch? Are you sure you are using Apple clang? What is the output of "which clang"?

yep
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

are you using repos version or 3.0.1?

jjstickel March 21, 2016 08:37

Quote:

Originally Posted by gigilentini8 (Post 590514)
yep
are you using repos version or 3.0.1?

OpenFOAM-3.0.1


All times are GMT -4. The time now is 02:03.