CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Installation on Windows, Mac and other Unsupported Platforms

2.0.x on Mac OSX

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   June 21, 2011, 14:01
Default 2.0.x on Mac OSX
  #1
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 19
niklas will become famous soon enough
I'm trying to compile 2.0.x on Mac OS X (Snow Leopard) and in
src/OSspecific/POSIX/POSIX.C
there is an include for "link.h" that I cant figure out which package it comes from.

Commenting it out yields an

POSIX.C:1216:47: error: 'dl_iterate_phdr' was not declared in this scope

which is a clue, but i still cant find out if there is a macports package that supply this.

Anyone know?
N
niklas is offline   Reply With Quote

Old   June 21, 2011, 16:59
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by niklas View Post
I'm trying to compile 2.0.x on Mac OS X (Snow Leopard) and in
src/OSspecific/POSIX/POSIX.C
there is an include for "link.h" that I cant figure out which package it comes from.

Commenting it out yields an

POSIX.C:1216:47: error: 'dl_iterate_phdr' was not declared in this scope

which is a clue, but i still cant find out if there is a macports package that supply this.

Anyone know?
N
That is stuff for listing the dynamic libraries which is not implemented in MacOS (or differently). Comment it out. The coded stuff probably won't work (I havn't finished my port yet, so I can't tell for sure)

Bernhard
gschaider is offline   Reply With Quote

Old   June 21, 2011, 21:16
Default
  #3
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by niklas View Post
I'm trying to compile 2.0.x on Mac OS X (Snow Leopard) and in
src/OSspecific/POSIX/POSIX.C
there is an include for "link.h" that I cant figure out which package it comes from.

Commenting it out yields an

POSIX.C:1216:47: error: 'dl_iterate_phdr' was not declared in this scope

which is a clue, but i still cant find out if there is a macports package that supply this.

Anyone know?
N
As noted in the other posting I just commented the offending lines out (will have a look on how to port this to Mac OS X later. Unless somebody is faster. I sincerely hope so). This patch makes the whole thing compile on MacOSX. The damBreak-case (blockMesh/setFields/interFoam) worked without problems. As always I didn't bother to make paraFoam work (in difference to the the coded stuff I currently have no intention to do so).

In the attached tar you'll find three files:
- patch to OpenFOAM itself.
- patch to the thirdParty-directory
- A file that goes to ~/OpenFOAM/site/2.0.x/ This tells OF that it should use the system-OpenMPI and gcc 4.5 from MacPorts (the Apple gcc 4.2 chockes on some SubField-stuff)

An comments/improvements welcome

Bernhard
Attached Files
File Type: gz OpenFOAM.2.0.xMacPatches.tar.gz (8.5 KB, 286 views)
gschaider is offline   Reply With Quote

Old   June 22, 2011, 11:39
Default
  #4
Senior Member
 
Pierre-Olivier Dallaire
Join Date: Mar 2009
Location: Montreal, Quebec, Canada
Posts: 185
Rep Power: 8
podallaire is on a distinguished road
Thank you Bernhard,

tested the patches and used gcc-4.3 to compile it / worked perfectly !

Regards,

PO
podallaire is offline   Reply With Quote

Old   June 22, 2011, 11:56
Default
  #5
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 19
niklas will become famous soon enough
Yes, worked like a charm.
thanks for that, saved me lots of time
(Im using gcc-mp-4.6)

N
niklas is offline   Reply With Quote

Old   June 22, 2011, 13:10
Default
  #6
Senior Member
 
Pierre-Olivier Dallaire
Join Date: Mar 2009
Location: Montreal, Quebec, Canada
Posts: 185
Rep Power: 8
podallaire is on a distinguished road
I'm wondering if files src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C (line 337) and src/OSspecific/POSIX/POSIX.C (line 1118) should be modified for the *.so ?

It looks that loading the shared libs from the controlDcit using extension *.so does not work / I understand that dlLibraryTable.C cannot be anymore tweaked the way you did it for 1.7.x

Thanks

PO

Last edited by podallaire; June 22, 2011 at 13:25. Reason: missing one file
podallaire is offline   Reply With Quote

Old   July 5, 2011, 17:56
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by podallaire View Post
I'm wondering if files src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C (line 337) and src/OSspecific/POSIX/POSIX.C (line 1118) should be modified for the *.so ?

It looks that loading the shared libs from the controlDcit using extension *.so does not work / I understand that dlLibraryTable.C cannot be anymore tweaked the way you did it for 1.7.x

Thanks

PO
Well. That fix was quite simple (basically the same only the names have changed). That and a fix that makes the codestreams work (as always: replace .so with .dylib ) are found in the attached dylibMac-patch for those who applied the previous patch. The accumulated wisdom (the old patch with the dylib merged in) can be found in the _v2-patch.

I didn't port the dlLoaded-function (that would have been more work) because I found no code that uses that

Bernhard
Attached Files
File Type: gz dylibMac-2.0.x.patch.gz (855 Bytes, 103 views)
File Type: gz OpenFOAM-2.0.x-Mac_v2.patch.gz (7.2 KB, 187 views)
gschaider is offline   Reply With Quote

Old   July 15, 2011, 01:05
Thumbs up Perfect!
  #8
Member
 
sushant's Avatar
 
Join Date: Mar 2009
Location: Switzerland
Posts: 42
Rep Power: 8
sushant is on a distinguished road
Compiled *out of the box*. Couldn't have been more perfect. It'll hardly be any effort even for brand new users!

Still, if anyone needs the readymade binaries on a disk image, please see the link in my signature.

More power to you, BG

(gcc-mp-45, OS X 10.6.7)
__________________
If you only have a hammer, you tend to see every problem as a nail.

Last edited by sushant; July 15, 2011 at 01:07. Reason: mentioned gcc/system version
sushant is offline   Reply With Quote

Old   July 25, 2011, 03:18
Default OF on Lion?
  #9
New Member
 
Felipe
Join Date: Apr 2010
Posts: 13
Rep Power: 7
fippo_dk is on a distinguished road
Hi guys.

Great work the one you have been doing here with these images.

I would like to hear if any of you have tested these images of OF1.7 and OF2.0 on Lion OS X.

I tried to used the images, but they don't work.

Any suggestions?

Best regards,

Felipe
fippo_dk is offline   Reply With Quote

Old   July 25, 2011, 09:18
Default
  #10
Senior Member
 
Pierre-Olivier Dallaire
Join Date: Mar 2009
Location: Montreal, Quebec, Canada
Posts: 185
Rep Power: 8
podallaire is on a distinguished road
Quote:
Originally Posted by fippo_dk View Post
Hi guys.

Great work the one you have been doing here with these images.

I would like to hear if any of you have tested these images of OF1.7 and OF2.0 on Lion OS X.

I tried to used the images, but they don't work.

Any suggestions?

Best regards,

Felipe
I would suggest to compile it from scratch under Lion. I tried that last week and it worked. However, you need to install or build gcc 4.3 at least. You can use MacPort or build it from sources. If you build it from sources, use "clang" instead of the gcc-4.2.

regards,

PO
podallaire is offline   Reply With Quote

Old   July 25, 2011, 12:43
Default
  #11
New Member
 
Felipe Sanchez
Join Date: Jul 2009
Posts: 2
Rep Power: 0
fippodk is on a distinguished road
Ok, I will try that.

Although I tried with gcc 4.5.3 and it did not work.

I'll post the results later on.

Thanks for your answer,

Felipe
fippodk is offline   Reply With Quote

Old   July 26, 2011, 11:44
Default
  #12
New Member
 
Caleb Gingrich
Join Date: Jul 2011
Posts: 2
Rep Power: 0
calebg is on a distinguished road
Hi

I am also trying to compile OpenFOAM 2.0.x on Mac OS 10.7, and having difficulties. I am using GCC 4.4 from MacPorts, XCode 4.1, and OpenMPI compiled on my machine from the source code (as 10.7 no longer includes OpenMPI).

I've applied the patches, after updating the OpenFOAM_V2 patch to use gcc-mp-4.4. When I compile, I get several errors, but the most common one is that header files cannot be opened when making dependency lists. Once the compile is done, I will upload the output of the terminal.

Any suggestions would be most appreciated, as well as your patience as I am unfamiliar with compiling code.

Thanks,
Caleb

Last edited by calebg; July 26, 2011 at 12:00.
calebg is offline   Reply With Quote

Old   July 26, 2011, 12:40
Default
  #13
New Member
 
Caleb Gingrich
Join Date: Jul 2011
Posts: 2
Rep Power: 0
calebg is on a distinguished road
Hi

So an update: I'm confused. After the compile completed, I ran the foamInstallationTest script. There were 2 critical errors, but the first was the OS. The second was the gcc version - it found 4.2.1. I set the patch to use gcc-mp-4.4.

I can run blockMesh and icoFOAM, so maybe things installed correctly?

Anyone know why I was getting the "could not open file *.H for source *.C" messages?

Here is a sample of the messages:
+ wmake libso OpenFOAM
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file global/global.Cver
Making dependency list for source file global/argList/argList.C
Making dependency list for source file global/clock/clock.C
Making dependency list for source file primitives/bools/bool/bool.C
Making dependency list for source file primitives/bools/bool/boolIO.C
Making dependency list for source file primitives/bools/Switch/Switch.C
Making dependency list for source file primitives/bools/Switch/SwitchIO.C
Making dependency list for source file primitives/bools/lists/boolList.C
could not open file HashSet.H for source file global/global.Cver
could not open file Map.H for source file global/global.Cver
could not open file primitiveMeshI.H for source file global/global.Cver
could not open file pointIOField.H for source file global/global.Cver
could not open file faceIOList.H for source file global/global.Cver
could not open file labelIOList.H for source file global/global.Cver
could not open file polyBoundaryMesh.H for source file global/global.Cver
could not open file boundBox.H for source file global/global.Cver
could not open file pointZoneMesh.H for source file global/global.Cver
could not open file faceZoneMesh.H for source file global/global.Cver
could not open file cellZoneMesh.H for source file global/global.Cver

I also got this message many times, early on:
UPstream.C:266: warning: use of old-style cast

Thanks,
Caleb
calebg is offline   Reply With Quote

Old   July 27, 2011, 10:55
Default
  #14
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by calebg View Post
Hi

So an update: I'm confused. After the compile completed, I ran the foamInstallationTest script. There were 2 critical errors, but the first was the OS. The second was the gcc version - it found 4.2.1. I set the patch to use gcc-mp-4.4.

I can run blockMesh and icoFOAM, so maybe things installed correctly?

Anyone know why I was getting the "could not open file *.H for source *.C" messages?

Here is a sample of the messages:
+ wmake libso OpenFOAM
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file global/global.Cver
Making dependency list for source file global/argList/argList.C
Making dependency list for source file global/clock/clock.C
Making dependency list for source file primitives/bools/bool/bool.C
Making dependency list for source file primitives/bools/bool/boolIO.C
Making dependency list for source file primitives/bools/Switch/Switch.C
Making dependency list for source file primitives/bools/Switch/SwitchIO.C
Making dependency list for source file primitives/bools/lists/boolList.C
could not open file HashSet.H for source file global/global.Cver
could not open file Map.H for source file global/global.Cver
could not open file primitiveMeshI.H for source file global/global.Cver
could not open file pointIOField.H for source file global/global.Cver
could not open file faceIOList.H for source file global/global.Cver
could not open file labelIOList.H for source file global/global.Cver
could not open file polyBoundaryMesh.H for source file global/global.Cver
could not open file boundBox.H for source file global/global.Cver
could not open file pointZoneMesh.H for source file global/global.Cver
could not open file faceZoneMesh.H for source file global/global.Cver
could not open file cellZoneMesh.H for source file global/global.Cver
That was a compilation from a "fresh" source or a compilation in a directory that already had a compiled OF (before the 10.6-times). In the first case I'd say you're OK (I can't reproduce it because I'd have to scratch my installation for that, but I think that always happens during the first compilation). In the second case you might experience subtle versions of DLL-hell and I'd recommend compiling from a fresh source directory

Quote:
Originally Posted by calebg View Post
I also got this message many times, early on:
UPstream.C:266: warning: use of old-style cast
That is only a warning. If it was serious god would have created it as an error
gschaider is offline   Reply With Quote

Old   August 3, 2011, 17:20
Default
  #15
New Member
 
Join Date: Jul 2011
Posts: 19
Rep Power: 6
of_user_ is on a distinguished road
may i ask how to run this this .path file? i tired:

patch -p0 < ThirdParty-2.0.0-Mac.patch

but it does not work
of_user_ is offline   Reply With Quote

Old   August 4, 2011, 07:23
Default
  #16
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by of_user_ View Post
may i ask how to run this this .path file? i tired:

patch -p0 < ThirdParty-2.0.0-Mac.patch

but it does not work
Could you enlighten us about the way in which it doesn't work? Error message would be helpful
gschaider is offline   Reply With Quote

Old   August 4, 2011, 16:06
Default
  #17
New Member
 
Join Date: Jul 2011
Posts: 19
Rep Power: 6
of_user_ is on a distinguished road
i put "ThirdParty-2.0.0-Mac.patch" in thirdparty dictionary and tried to run it using:

Quote:
patch -p0 < ThirdParty-2.0.0-Mac.patch --verbose
than i get this:

Quote:
Hmm... Looks like a unified diff to me...
can't find file to patch at input line 7
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|# HG changeset patch
|# Parent b8c70d03f7807a6331a9af62c0d1dfee850f7ca8
|
|diff --git a/Allwmake b/Allwmake
|--- a/Allwmake
|+++ b/Allwmake
--------------------------
File to patch:
how do i go on? i tried typing Allwmake after the file to patch prompt and hit enter. but i do not know how i should run this patch. never ran a patchfile before...

Last edited by of_user_; August 4, 2011 at 16:35.
of_user_ is offline   Reply With Quote

Old   August 4, 2011, 17:01
Default
  #18
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,251
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

@of_user_: Try this command instead:
Code:
patch -p1 < ThirdParty-2.0.0-Mac.patch
The reason why it should work is because of this path description:
Code:
|--- a/Allwmake
|+++ b/Allwmake
a and b are folders that do not exist in real life. The "-p" option reads this in the man patch page:
Quote:
Originally Posted by http://linux.die.net/man/1/patch
-pnum or --strip=num
Strip the smallest prefix containing num leading slashes from each
file name found in the patch file. A sequence of one or more adja‐
cent slashes is counted as a single slash. This controls how file
names found in the patch file are treated, in case you keep your
files in a different directory than the person who sent out the
patch.
It continues, but I think it wasn't worth it pasting everything...

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   August 28, 2011, 02:59
Smile For OS X 10.7+
  #19
Member
 
sushant's Avatar
 
Join Date: Mar 2009
Location: Switzerland
Posts: 42
Rep Power: 8
sushant is on a distinguished road
For those who want to simply get it working on Lion:
  • Install Apple's developer tools
  • Install Macports for Lion (2.0.1 as of this post)
  • Do a 'sudo port install gcc46' (gcc44/45 may have some issues while building)
  • Extract OpenFOAM and ThirdParty on a case-sensitive disk image
  • Use Bernhard's above patches (latest), edit the OpenFOAM patch file and replace 'Gcc45' with 'Gcc46', '-mp-4.5' with '-mp-4.6'. Apply the patches.
  • In ~/OpenFOAM/site/2.0.x/prefs.sh change Gcc45 to Gcc46. Comment out the WM_MPLIB line, or change SYSTEMOPENMPI to simply OPENMPI (have to build your own MPI, Lion isn't shipping with one)
  • Do ./Allwmake in ~/OpenFOAM/OpenFOAM-2.0.x

(I had to do the last step twice; Pstream didn't compile on the first try)

Use the new 10.7 ParaView 3.10.1 binary on Kitware's website. (yay!)

Side note: Even though WM_COMPILER=Gcc46 in site/2.0.x/prefs.sh sometimes 'gcc' is invoked instead of 'gcc-mp-4.6'. Why is this so? This calls Apple's gcc or llvm-gcc 4.2 which spits out furious errors on some files. (to work around it, do 'sudo port select gcc mp-gcc46' then switch back when done)
__________________
If you only have a hammer, you tend to see every problem as a nail.

Last edited by sushant; August 28, 2011 at 03:16. Reason: patch edits
sushant is offline   Reply With Quote

Old   September 13, 2011, 21:41
Default
  #20
New Member
 
Nathan Woods
Join Date: Sep 2011
Posts: 2
Rep Power: 0
woodscn is on a distinguished road
Perhaps unsurprisingly, the patch provided above doesn't work with ThirdParty-2.0.1, which is what's available now.

Is there a place I can find the old files? Is there a timeline for a new patch?
woodscn is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fluent @ Mac OSx ignazio FLUENT 11 March 20, 2014 07:17
foamToTecplot360 on mac osx 10.6 SL mohanamuraly OpenFOAM 0 April 27, 2011 00:26
Mac OSX and Homebrew egp OpenFOAM Installation 1 February 15, 2011 11:21
OpenFOAM13 for Mac OSX Darwin 104 hjasak OpenFOAM Installation 70 September 24, 2010 05:06
OpenFOAM on mac OSX Nick Colam Main CFD Forum 3 January 27, 2009 01:06


All times are GMT -4. The time now is 17:07.