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

OpenFoam for MS windows

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 29, 2004, 14:56
Default Hi, Has any one tried to
  #1
Madhav Gentela (Gentela)
Guest
 
Posts: n/a
Hi,

Has any one tried to compile openFoam for MS Windows using Bash shell (which has all gnu utilities which are available on linux)?

Madhav.
  Reply With Quote

Old   January 3, 2005, 12:02
Default It is going to be way too har
  #2
Hrvoje Jasak (Hjasak)
Guest
 
Posts: n/a
It is going to be way too hard. Here's a few problems:

- you need to rename all the files. global.C in Microsoft is the same as global.c, so the c compiler gets called instead of C++

- some .C files (with template definitions) are included into other files: also needs changing

- Microsoft does not have sym links, so the lnInclude mechanics will not work. You will probably need full include paths everywhere

- be careful what compiler you choose: intel may be a better choice that the Microsoft (which costs money)

- the shared library loading mechanism is different: you will need tons of dllopen-s to load the libraries you need.

- the operating system/linker (not sure) do not allow cyclic dependency between shared libraries and I believe we've got lots of those. In order to sort this out you will need to re-factor all the libraries

- finally (a killer for me): Micro***t does not expose all parts of a shared library to the outside users of it. This is regulated by having dll export and dll import statements before all class definitions and global functions and operators. This is done with ifdefs and requires editing the whole of the code! I give up.

There may be other problems I've forgotten about, but my advide would be to give up because that operating system is simply too crap for the job.

Hrv
  Reply With Quote

Old   January 3, 2005, 22:32
Default I believe Madhav may have bee
  #3
Damian Merrick (Merrick)
Guest
 
Posts: n/a
I believe Madhav may have been referring to Cygwin (see www.cygwin.com), the free set of unix tools available under Windows platforms. I think using Cygwin's unix environment, g++ etc would solve many of the problems you mentioned, although perhaps some would still remain. It would certainly be a much easier route to take than to try and port to VC++. I haven't tried compiling yet with cygwin, however... I suspect it would still require a bit of effort to get working.


Damian.
  Reply With Quote

Old   January 4, 2005, 11:12
Default Yup. I was referring to Cygwi
  #4
Madhav Gentela (Gentela)
Guest
 
Posts: n/a
Yup. I was referring to Cygwin, which has a whole bunch of unix tools available, It simulates whole unix environment and is free. I agree with Damian, this is definitely easy route, although we need to modify Makefiles for Cygwin support (like adding Cygwin OS). Some of the command line return messages (e.g., ssh, rsh, etc) from Cygwin differ from linux shells. I am wondering if any one has already tried on Cygwin?

Madhav.
  Reply With Quote

Old   January 4, 2005, 13:32
Default Hi, I recently had a go at
  #5
Andy Stone (Stone)
Guest
 
Posts: n/a
Hi,

I recently had a go at compiling with Cygwin, but eventually gave up. I solved some problems with the compilation process, but I think I came up against the cyclic dependency problem mentioned in an earlier post - as I understand it OpenFOAM compiles lots of UNIX shared objects (.so) which are similar to dlls, except that dlls require you to define all symbols at link time whereas a shared object doesn't - they can somehow be picked up from another shared object when they are both loaded into memory (excuse the vague explanation, I don't fully understand it myself). Cygwin doesn't support Unix style shared objects - it pretends to but really in the background it uses dlls, which is fine most of the time, except in the case we have here of two shared objects depending on each other.

Anyhow, here are some of the problems I did manage to solve in case you want to carry on where I gave up (this is from memory because the notes that I made at the time are elsewhere right now - if you still want to give it a go let me know and I'll give a more complete description):

To solve the install script problems I changed bits in scripts where it did something like:
machinename=`uname -s` to:
machinename=Linux (i.e. fixed it so the scripts thought they were on a Linux system).

It seems that in the source I downloaded a precompiled Linux binary had crept into the wmake directory (wmake\rules\linux\wmkdep) - I just deleted it and it was remade as part of the compilation process.

There are some problems where OpenFOAM has some headers that are called things like string.H, which on a case sensitive file system is fine, but on Cygwin causes clashes with the standard string.h header (there's a couple of others but I forget exactly which). This can be fixed by renaming to something like string_openfoam.H and using some kind of script to replace instances of #include "string.H" in the source files.

When compiling LAM using Cygwin on Win2000 (I think XP is ok) problems occur with the configure script. This requires obtaining a slightly modified bash.exe (I forget where from exactly, but if you want to know let me know and I'll find out).

The symbolic links work fine in Cygwin by the way.

I was stepping through the src\Allwmake script line by line and got to the part just after lam is compiled and installed (in the compiling Pthreads part I think) when I started getting lots of error messages about undefined symbols (which I think is down to the previously mentioned cyclic dependency). That's where I gave up and installed Linux!

Andy
  Reply With Quote

Old   January 4, 2005, 13:42
Default Thanks Andy. That was good tr
  #6
Madhav Gentela (Gentela)
Guest
 
Posts: n/a
Thanks Andy. That was good try. About 4 years ago, I tried cyclic dependency on MS windows. There is some way, but it was very tedious. I think one of the examples with VC++ distribution, is cyclic dependent. I have to dig through my memory, MSDN and internet search, on how to build cyclic dependent DLL's. I will try and let you know, then we can start building on CYGWIN again.

Madhav
  Reply With Quote

Old   January 7, 2005, 10:54
Default Hi, just out of curiosity:
  #7
Mattijs Janssens (Mattijs)
Guest
 
Posts: n/a
Hi,

just out of curiosity: do you guys use dlltool?

Mattijs
  Reply With Quote

Old   August 4, 2005, 16:41
Default I am about to start building/c
  #8
New Member
 
Louis le Grange
Join Date: Mar 2009
Posts: 7
Rep Power: 8
louis is on a distinguished road
I am about to start building/compiling FOAM for Windows. I have noted the problem areas given by Hrvoje. I have ideas how to solve some of the problems by 'converting' the files, include files and filenames by using scripts in a generic way. Are there any other problems you forsee running MSWindows apart from possibly re-engineering some of the code to make it work on a Windows based C++ compiler?
louis is offline   Reply With Quote

Old   August 5, 2005, 06:47
Default Do yourself a favour and start
  #9
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
Do yourself a favour and start by porting it to cygwin or some other windows based linux emulator. That way you only have to address one or two problems at a time. (Case sensitivity and dynamic symbolic links, I think.)
eugene is offline   Reply With Quote

Old   August 5, 2005, 07:02
Default Whatever you do, you will hit
  #10
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Whatever you do, you will hit a problem of cyclic dependency of libraries at link-time. From what I have heard it is possible to solve this problem on a Windows platform but I could not get the details on how it's actually done. Usually, people solve this be re-arranging the libraries until they are no longer cyclically dependent on each other, but that's going to be jolly hard with 350 thousand lines of code we've got in FOAM right now.

Also, you will have tons of trouble with DLL_IMPORT and DLL_EXPORT, which means you will have to change every single source file by hand.

I'd be grateful if you could keep the forum posted on your progress.

Good luck,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 5, 2005, 12:17
Default For DLL_IMPORT and DLL_EXPORT
  #11
gentela
Guest
 
Posts: n/a
For DLL_IMPORT and DLL_EXPORT you can have separate file with proper syntax to specify which functions can have import and export.

Refer MSDN page : Export from a DLL Using .DEF Files
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_ core_export_from_a_dll_using_..def_files.asp
  Reply With Quote

Old   August 5, 2005, 12:25
Default Thanks for that. This link sa
  #12
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Thanks for that. This link says "Page Cannot Be Found" for me - could you please check it. Do I need to be logged in?

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 5, 2005, 13:30
Default Link worked just fine on my fi
  #13
gentela
Guest
 
Posts: n/a
Link worked just fine on my firefox browser. If it does not work for you, just search in gooble with following key word: "Export from a DLL Using .DEF Files" and click on first link you should see the same page.

Thanks
Madhav.
  Reply With Quote

Old   August 8, 2005, 09:05
Default The definition is in Vector.H,
  #14
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 13
henry is on a distinguished road
The definition is in Vector.H, you are quoting vector.H.
henry is offline   Reply With Quote

Old   August 8, 2005, 09:20
Default Hmmm :-( When unzipping in
  #15
New Member
 
Louis le Grange
Join Date: Mar 2009
Posts: 7
Rep Power: 8
louis is on a distinguished road
Hmmm :-(

When unzipping in Windows vector.H and Vector.H were overwritten ending up with only Vector.H having the contents of vector.H ....

Thanks! :-)
louis is offline   Reply With Quote

Old   August 8, 2005, 12:27
Default Yes, and this has already been
  #16
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, and this has already been mentioned in the 'cygwin' discussion

http://www.cfd-online.com/OpenFOAM_D...ges/1/639.html

and I can say it again, you need to unpack the files in a case-insensitive environment.

Although I have to admit that as of today, I'm now in a position where I HAVE to solve this problem, being forced to work in winblows (oops Freduian type-o)

N
niklas is offline   Reply With Quote

Old   April 14, 2009, 01:05
Smile OpenFOAM for MS windows
  #17
New Member
 
Join Date: Mar 2009
Posts: 3
Rep Power: 8
julian is on a distinguished road
Take a look at sourceforge.net/projects/openfoam-mswin. It was said that a fully functional binary release, running natively without emulations, with ParaView 3.4.0, will be available next month.
julian 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
How to install OpenFoam in Windows XP robert_dekker OpenFOAM Installation 4 October 20, 2010 21:15
OpenFOAM 15x MinGW Windows Port gocarts OpenFOAM Installation 1 April 17, 2009 10:41
OpenFOAM Windows Binaries in Sourceforge philippose OpenFOAM Installation 2 March 19, 2009 04:48
OpenFOAM users in Munich OpenFOAM benutzer in M%c3%bcnchen jaswi OpenFOAM 0 August 3, 2007 13:11
A new Howto on the OpenFOAM Wiki Compiling OpenFOAM under Unix mbeaudoin OpenFOAM Installation 2 April 28, 2006 08:54


All times are GMT -4. The time now is 13:52.