CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64 (https://www.cfd-online.com/Forums/openfoam-installation/72813-cross-compiling-openfoam-1-6-linux-windows-32-64bits-mingw-w64.html)

wyldckat October 26, 2012 18:32

Hi gerritgroot,

You can find your posts by clicking on the menu "User Panel", then on the "Your Profile" link and then on the statistics tab you should find a link for listing the posts you've made.

As for the error you got, it took me a while to notice the following message:
Quote:

Code:

configure: error: The cat command does not ignore carriage return characters.
 Please either mount the build directory in binary mode


"binary mode" is defined in the step #8 on this section: http://openfoamwiki.net/index.php/Ti...#Setting_it_up

Best regards,
Bruno

gerritgroot October 27, 2012 15:18

Thank you very much Bruno, especially for making me find my posts.

I went all the way back to the step you indicated (I guess something went wrong there) and, just in case started all over again with everything clean, when trying to untar the openfoam code with
Code:

tar xzf OpenFOAM-1.7.0.gtgz
I get
Code:

$ tar xzf OpenFOAM-1.7.0.gtgz
tar (child): OpenFOAM-1.7.0.gtgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

While I DO have the zipped files placed in the OpenFOAM directory, since "dir" gives:
Code:

Microsoft Windows XP [Versión 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\cygwin\home\root\OpenFOAM>dir

 Directory C:\cygwin\home\root\OpenFOAM

27/10/2012  20:59    <DIR>          .
27/10/2012  20:59    <DIR>          ..
22/10/2012  19:06        38,998,257 OpenFOAM-1.7.0.gtgz
22/10/2012  19:08        55,390,881 ThirdParty-1.7.0.gtgz
              2 files      94,389,138 bytes
              2 dirs  3,723,649,024 bytes free

C:\cygwin\home\root\OpenFOAM>

So the files ARE there....
...I remember why I gave up with Linux two years ago after a try....

gerritgroot October 27, 2012 15:21

With "ls" in cygwin I don't see the files by the way
Code:

root@MyComputer ~/OpenFOAM
$ ls

root@MyComputer ~/OpenFOAM


wyldckat October 27, 2012 15:35

Well, you better at least read the Cygwin "Using" instructions: http://cygwin.com/cygwin-ug-net/using.html

The following command should get you a better feel for where your current folder really is:
Code:

cygpath -w $PWD
Source: http://cygwin.com/cygwin-ug-net/usin...s.html#cygpath

Good luck!

gerritgroot October 29, 2012 11:09

Cross compiling for mortals
 
Thank you Bruno,

Standing at the prompt without being in any subdirectoy, gives me

Code:

$ cygpath -w $PWD
C:\cygwin\home\root

Perfect I guess, as the prompt is pictured as "~" only, while

Code:

$ cygpath -u $PWD
/home/root

So far so good, an equivalent directory that makes sense, and when I gave the command
Code:

mkdir OpenFoam
the directory "OpenFOAM" appeared indeed in windows under
"c:\cygwin\home\root" as a new empty directory, great! That makes sense!

However, as soon as I switch to the "Tip Cross Compiling OpenFOAM 1.7 in Linux For Windows with MinGW" instructions page and give the command:

Code:

cd $HOME/OpenFOAM
I get:

Code:

$ cygpath -u $PWD
/home/root/OpenFOAM

and

Code:

$ cygpath -w $PWD
C:\o

So it didn't move to
Code:

C:\home\root\OpenFOAM
This looks like quantum physics to me, being at two different places at the same time.:confused:

I guess that line that was added to "/etc/fstab" has something to do with it and tells windows to go to "C:\o" when it's standing in the OpenFOAM directory in cygwin.

Anyway, I placed the whole "OpenFOAM" directory under "C:\o" so cygwin could see it and to get it working, unpacked the zipped files successfully and started the script:
Code:

./build-mingw44
After a while, I get the same error as before, namely:

Code:

Configuring binutils
make of binutils failed - log available: /home/root/OpenFOAM/buildLogs/binutils-mingw32_configure.log

But this time, after your comment on this, I took very good care about step 8 in the "Tip Using Cygwin for cross-compiling OpenFOAM" page, I checked whether

Code:

C:/o /home/root/OpenFOAM ntfs binary,posix=1 0 0
C:/dump /tmp ntfs binary,posix=1 0 0

has been added to etc/fstab and... yes, it's there, exactly like in the example except for the user's name of course, which is "root" in my case (...and saying something about binary, so ehh.. gues that's allright).

Again I type:

Code:

set -o igncr
export SHELLOPTS

as advised in the log file, run the script again and...

get the same error! ???:mad:

By the way, in step 9, after:
Code:

ln -s /usr/bin/cpp /lib/cpp
it complains that cpp is an existing file, namely: cpp.exe, so I renamed that to _cpp.exe guessing that I installed too much maybe.

Best regards,

Gerrit

wyldckat October 31, 2012 13:33

Hi Gerrit,

It's been years since I've written those instructions. Cygwin has evolved and things might not be working as they were in the past.

Which Windows version are you using? I'll see if I can do a quick test to it this coming weekend.

As for step #9, you only need to do it once. And possibly with the latest Cygwin versions, you don't need to do it at all!

Best regards,
Bruno

gerritgroot November 5, 2012 04:40

Thanks a lot!!!

In the mean time, I was considering to run the LiveCD in a VM, but, though that's easy to get it working, it goes so much worse than just an own OS executable, that I tried this. Another option would be to install CAE_Linux directly on a separate computer, but that's costly as you need an extra computer for that.

I'm running on XP. Thank you for being willing to help. Apart from that, I wonder (in general) whether there is going to be an update of this cross compilation for either newer versions of OF, CygWin or the third party software.

I am also surprised that the OF people themselves stick so much to Linux, they can reach sooo much more people if they would only be willing to bring a standard windows executable directly from the OF page. I really think that, the latter can make the difference of having OF for a very small (and closed) academic community or as a careful competitor to commercial packages.

Best Regards,

Gerrit

wyldckat November 5, 2012 15:57

Hi Gerrit,

Sorry, but I didn't manage to take a look at the latest Cygwin this past weekend :( I'll try to look at it in the coming days...

Quote:

Originally Posted by gerritgroot (Post 390269)
In the mean time, I was considering to run the LiveCD in a VM, but, though that's easy to get it working, it goes so much worse than just an own OS executable, that I tried this. Another option would be to install CAE_Linux directly on a separate computer, but that's costly as you need an extra computer for that.

Sorry to say that everything has a cost: whether is time or money, there is always a cost!
It all really depends on what your resources and limitations are. If you need your simulations to run fast, then you should seriously think about having a good machine running Linux. It should pay for itself after some time, assuming it's worth the effort.

As for using/building OpenFOAM directly on Windows, you have several options already, as listed here: http://openfoamwiki.net/index.php/Ti...mportant_Links
(mental note: I've gotta update some of those links...)
(edit: I've updated that section of the wiki.)

As for virtualization, you can also use VMPlayer: http://openfoamwiki.net/index.php/Ho..._VMware_Player

Quote:

Originally Posted by gerritgroot (Post 390269)
I'm running on XP. Thank you for being willing to help. Apart from that, I wonder (in general) whether there is going to be an update of this cross compilation for either newer versions of OF, CygWin or the third party software.

That I'm aware of: no, there are no plans to update the instructions for Cygwin. I do want to give it a spin on Cygwin to see what still needs to be fixed, but time is currently very short on my side :(

The current endeavor from my side (and from the company where I work) is to focus on building directly in MSys (it's sort-of a minimal version of cygwin) and possibly directly in Windows Command Line. For more:
  • blueCFD - a product/service that provides a custom port of OpenFOAM for Windows: http://www.bluecape.com.pt/blueCFD/
    It was with this very same project that these particular Cygwin instructions were brought to light!
  • blueCFD-SingleCore - the open-source side of blueCFD, which currently provides the complete source code, but as for binaries, it only provides those for running in single-core: http://code.google.com/p/bluecfd-singlecore/
    Documentation is limited here, due to funding/time constraints :( Which is why said documentation is only provided with blueCFD, since it's a paid service.

Quote:

Originally Posted by gerritgroot (Post 390269)
I am also surprised that the OF people themselves stick so much to Linux, they can reach sooo much more people if they would only be willing to bring a standard windows executable directly from the OF page. I really think that, the latter can make the difference of having OF for a very small (and closed) academic community or as a careful competitor to commercial packages.

Caution: You've triggered a rant ;)

[RANT]
There are so many reasons that Linux is "better" for science, that it's hard to figure out where to start! :)
Let's see a couple:
  1. http://i.top500.org/stats - From the top 500 supercomputers at June 2012, 83.8% were running Linux.
  2. http://www.gnu.org/software/gsl/ - From the GNU Scientific Library, (which uses the license GPL, as does OpenFOAM):
    Quote:

    Unlike the licenses of proprietary numerical libraries the license of GSL does not restrict scientific cooperation. It allows you to share your programs freely with others.
The list could go on and on ;)


As for OpenFOAM itself, if you did a little research, you would find this:
Quote:

Originally Posted by http://www.openfoam.com/legal/open-source.php
Our belief in free, open source software goes beyond our promise to the OpenFOAM users. Primarily, we think people should have a right to modify and redistribute software they use and that they should have a guarantee that they will be able to use it indefinitely; free, open source software, gives them this. We believe in open file formats; we oppose software patents; and, we do not work on operating systems, such as Windows, Mac OSX and iOS, that limit people’s freedom to use computers and software the way they want to.

But even if they did support Windows... and even if they had the resources and patience to support such an annoying OS (I'm talking from personal experience, but then again, all OS' can be annoying :D), there would be one simple detail that would always be hard to deal with: Windows users like to use the mouse! And "the mouse" is something OpenFOAM doesn't handle by default ;)
[/RANT]

Best regards,
Bruno

gerritgroot November 6, 2012 05:13

Thank you Bruno,

No worries about the update. After all, it's a free favor. I nevertheless hope that, if you happen to have some time, that more people will take advantage of the same update.

About Linux... ...yeah, it's the everlasting discussion. I tried many versions in vain, I am simply not willing to read a 300 pages book to get my USB stick working, as a matter of speeking (I'd rather spend that time reading something on aerodynamics for example, or a good novel haha). Linux users seem to see there OS as some sort of religion rather than an OS only (sorry guys). I'm also a huge advocate of free software, free OS-es and so on, but I'm even a bigger advocate of user friendlynesss and accepting reality. It's getting slowly off topic, but take OpenOffice for example, it's for free, but reads and writes native word docs as well. That philosophy is, in my opinion, the only way to reach the "hordes" (of which I don't exclude myself) and to seriously compete.

And lastly about the mouse... ...Fluent works in a prompt as well, so it shouldn't be too hard to beat that, at least when it comes to functionality (I don't know about validation cases on the solver itself).

I'll have a look at Bluecape!

Gerrit

wyldckat November 9, 2012 19:07

Hi Gerrit,

OK, I've done some testing and I think I figured out the problems:
  1. dash is good for speed, but binutils and gcc can't be cross-compiled on Cygwin, unless bash is used. Therefore, the fix is:
    Code:

    cp /bin/bash /bin/sh
    After building gcc, you can restore dash to make OpenFOAM build faster:
    Code:

    cp /bin/dash /bin/sh
  2. In the latest Cygwin, you'll need to also install this package: libiconv
  3. Points 5 and 6 have been added to this chapter: http://openfoamwiki.net/index.php/Ti...plying_patches
By the way, I've found once again Kojani's blog which gives instructions on compiling 1.7.x directly on Windows with MSys... the link is provided in this list already as well: http://openfoamwiki.net/index.php/Ti...g_instructions

Best regards,
Bruno

gerritgroot November 14, 2012 10:02

Thanks a lot Bruno,

The gcc compiler seems to build without any error (unless I missed something, but I didn't see anything strange).

In spite of having used
Code:

./build-mingw44
I get:
Code:

gcc versión 4.5.3
when asking for
Code:

gcc -v
after building, while the unzipped directory to be found in the ThirdParty directory really is: "gcc-4.4.4"

So, believing "gcc -v" gives me the real answer, just in case I give the command
Code:

cd $WM_DIR/rules sed -i -e 's=-O2 -DNDEBUG=-O2 -DNDEBUG -fno-strict-aliasing=' "$WM_ARCH$WM_COMPILER/c++Opt"
And when standing in the $WM_PROJECT_DIR directory (which turns out to be OpenFoam-1.7.0 indeed), I say:

Code:

./Allwmake
This, however, is full of errors, of which I post only the first ones in case you're interested.
Code:

Makefile:119: recipe for target `common_file_compress.o' failed
make[2]: *** [common_file_compress.o] Error 1
make[2]: *** Se espera a que terminen otras tareas....
rm -f common2.c
make[2]: se sale del directorio `/home/root/OpenFOAM/ThirdParty-1.7.0/scotch_5.1/src/libscotch'
Makefile:58: recipe for target `scotch' failed
make[1]: *** [scotch] Error 2
make[1]: se sale del directorio `/home/root/OpenFOAM/ThirdParty-1.7.0/scotch_5.1/src/libscotch'
Makefile:91: recipe for target `scotch' failed
make: *** [scotch] Error 2

I may have been close, but, honestly, I give up!

Don't worry about answering, or if you do, you may answer for someone else reading these messages. As far as I am concerned, I am out of patience with Linux for about the 4th time in my life ...and, no I am not willing to read a 300 pages book on the Linux OS and all its possible flavours. Things that don't work out of the box, don't work at all.

Nevertheless, thank you sincerely for all your answers, and goodbye Linux church!


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