Compilation error with OpenFOAM 2.1.x
Hello,
I would like to compile OpenFOAM (from git repository), but I'm getting a compilation error right at the start: Code:
fileMonitor.C:308:13: warning: use of old-style cast [-Wold-style-cast] I updated the sources today. My compiler is gcc 4.7 I have 2 more questions: - what do I have to set/configure to use a different compiler (clang/intel)? - it looks like my only friend to search for keywords in the source code is 'grep'. Is there a way of using OpenFOAM from within Qtcreator/KDevelop or some other ide so that the code browsing is easier? Thank you very much. Best regards, Martin Vymazal |
Greetings Martin and welcome to the forum!
Knowing which operating system you are using also helps. Mainly because we don't know which packages you might need to install. And AFAIK gcc 4.7 is currently untested with OpenFOAM. Every major release of gcc has needed some sort of adjustment, sometimes due to gcc, others to the linking system. For a full log of the list of errors, the usual recommendation made is to run like this: Code:
./Allwmake > make.log 2>&1 As for the compiling error, that might not be the main reason for the failed compilation. This is why I mention that the first error is usually the one to be blamed. As for changing compiler, see "OpenFOAM-2.1.x/etc/bashrc" the variable "WM_COMPILER". As for IDE: http://openfoamwiki.net/index.php/Ho...M_with_Eclipse Best regards, Bruno |
Hello Bruno,
thank you for your reply. I redirected the error output in a log file in a similar fashion as you mentioned. The error I posted previously is the very first error in that log file. I can post the whole log, but there's really nothing more to see. My system is Archlinux. I agree that the new gcc can be a problem, but I don't really see why an error regarding an undeclared function 'read' would be related to a missing package in my linux distribution. Do you have an idea where is this function 'read' supposed to come from (i.e. do you know where is it declared)? Best regards, Martin Vymazal |
According to the source code of the file where the error occurs, that function should be defined somewhere in these included files:
Code:
# include <sys/inotify.h> |
@wyldcat_: Thank you for redirecting me here. This is to confirm that I have exactly the same problem.
@Martin_: Have you managed to solve this issue perhaps? There's an OpenFOAM package in AUR. Have you tried it? |
2 Attachment(s)
Greetings to all!
I got curious about Arch Linux and Gcc 4.7.0 that is has and I managed to install the latest stable 2011.08.19 x86_64. I used the net install ISO and installed all of the essential tools needed for building OpenFOAM 2.1.x, without the need to do any changes to the code. Attached are two lists:
By the way, I didn't try building ParaView, simply because I didn't bother installing X.org ;) Best regards, Bruno |
Thanks for doing the cross-check and providing your pacman output.
I can confirm that I have all the relevant packages. The only differences from out pacman -Q commands were dash and xinetd. I also thought that it might be something with my environmental variables because I am sourcing university profile that allows me to run some other applications, but removed that temporarily and I am currently recompiling and I am still seeing the same errors: 'read' was not declared. It's really frustrating. Also, I can confirm that so far the libOSSpecific.o fix didn't show any negative behaviour. My other compilation seems to be working fine. |
Hi Robert,
Mmm... OK, there are only a few things that come to my mind:
Bruno |
Hello!
I am happy to report that it works. In the end, it was missing dependencies. What I did was to vimdiff the file and I was actually installing the few missing packages as I was scanning the file comparison. I was missing some gcc packages so compared with your file I was missing gc gcc-ada gcc-go gcc-objc The errors were appearing on the first compilation but my comment above was a bit precipitate because they vanished on the second compilation. It's all fine. Thank you for your help. |
Hello Robert & Bruno,
I managed to compile OF 2.1.x following these steps: 1) run ./Allwmake in OpenFOAM root directory 2) when the error message about undefined 'read' function appears, stop compilation and do as Bruno said: Code:
cd src I was not able to skip step 1) and directly start with 2). I guess the Allwmake does something (set links, environment variables?) that enables the library in 2) to compile. In my system, installing/not installing the packages gc gcc-ada gcc-go gcc-objc didn't make any difference. The 'read' function error is always present. I tested this on 2 machines with Archlinux (laptop and desktop). I also tried to compile paraFoam. At one point, I got the following error: Code:
In file included from OpenFOAM/ThirdParty-2.1.x/ParaView-3.12.0/Qt/Core/pqServerManagerSelectionModel.h: and replacing Code:
ClearAndSelect = Clear | Select Code:
ClearAndSelect = static_cast<int>(Clear) | static_cast<int>(Select) After that, paraFOAM compiled and I was able to run a sample test case and visualize results. Best regards, Martin Vymazal |
I am sorry. My above post is not valid.
I would like to confirm Martin_'s observation. It is not a dependency issue. The truth is that I have done these things in the same time and compiled successfully. Now I have made a double check and it is the compilation of OSSpecific that is the necessary step for successful compilations not the dependencies that I outlined. @Martin_: Many thanks for your assiduity. |
FYI: OpenFOAM 2.1.x has had some additional updates that make things more compatible with Gcc 4.7, so I advise you guys to update!
The updates:
Code:
git pull |
Guys,
Just ran into this error myself on Archlinux. I was responding to a request for help with the AUR package. The read() function used in src/OSspecific/POSIX/fileManager.C, which throws that error, is defined in the <unistd.h> header file. That file is not in the includes for fileManager.C. All I can imagine is that something else pulls it in somehow when you recompile it get it to work. For now I'm simply patching that file manually to add "#include <unistd.h>" in the AUR package, along with assorted other fixes, so it builds in one pass. Obviously some significant changes in gcc 4.7. EDIT: I haven't tried the latest git clones; looking at the github the same patch I made is in there so Im sure they're fine. This is all based off of the stable 2.1 download. Maybe I have to add an OpenFOAM-git AUR package version. |
Hi,
I tried Bruno's suggestion to Code:
cd src I then went back to OpenFOAM-2.1.1/src and requested: Code:
wmake libso OpenFOAM Code:
/usr/bin/ld: cannot find -lPstream Thanks,:) Chris |
Greetings Chris and welcome to the forum!
Since you're trying to build OpenFOAM 2.1.1 and using Debian 6.0.3, I believe that the following instructions should work for you: http://openfoamwiki.net/index.php/In...u#Ubuntu_10.04 Best regards, Bruno |
Stuck on step 3
Hi Bruno,
Thanks for the link. The apt-get line was good except for openmpi-bin, Step 3 is not working too well for me. I'm following the 32 bit instructions since Code:
uname -m Code:
fisichel@debian:~$ source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=2 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32 Code:
fisichel@debian:~$ find . -name mpicc-wrapper-data.txt -print I think there is an easy solution to this, but I don't want to muck up the installation. Have you run into this before? If so, could you offer some advice? Thanks, Chris |
Hi Chris,
Quote:
Nonetheless, if you do not wish to use the system's Open-MPI, then you can try and use the custom build of Open-MPI 1.5.3 which you apparently already have. For that, you'll need to remove "WM_MPLIB=SYSTEMOPENMPI" from the source line, which would result in this: Code:
source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=2 WM_ARCH_OPTION=32 Additionally, to play it safe, it's best to start a new terminal window/tab, so that you'll have a clean shell environment. Last but not least, I've finished testing today with Debian 6.0.3 x86_64 in a virtual machine and have adapted the instructions here: http://openfoamwiki.net/index.php/In...ian#Debian_6.0 Best regards, Bruno |
Hi Bruno,
I was not clear. After checking, I realized I did not install openmpi-bin, but then I did make sure I installed it. After, I had problems. I went back to the OpenFOAM source installation. It worked. I explicitly changed the OpenFOAM-2.1.1/etc/bashrc entry for architecture to 32 bit, so I could have an invocation of ./Allwmake that did not have any extra parameters. I have not run any test problems yet, so I might still not be out of the woods. There was an error in the build of scotch. It said it was ignoring the error. I'm going to wipe the drive and try it again just to make sure the process works. I will check out your experiences, too. Thanks, Chris |
Hi Bruno,
My compilation ended up not working. I started in with the tutorials and paraview did not work. I reinstalled Debian 6.0.3 (32 bit) on one machine and 6.0.6 (64 bit) on another machine. The instructions provided in the link worked for both installations. Thanks for making that available. I hope others find it as useful as I did. Thanks, Chris |
Hi Bruno,
When you have a chance, I would recommend changing the instructions for the Debian build to include building OpenMPI. SYSTEMOPENMPI is not working correctly: "dummy Pstream library. This dummy library cannot be used in parallel mode." FYI, Chris |
Hi Chris,
Many thanks for the feedback and my apologies for not having tested this properly back then :(. The fix for you should be to simply run the respective commands in the new step #3: http://openfoamwiki.net/index.php/In...ian#Debian_6.0 By following the new commands, they will write the necessary custom variables into the "etc/prefs.sh" file, therefore making it the standard settings, therefore making it properly read in the remote shells. And don't forget to run them from the base OpenFOAM folder, namely "$HOME/OpenFOAM". The previous problem is now described here (if you're curious about it ;)): http://www.openfoam.org/mantisbt/view.php?id=231#c1846 - comment #1846 Best regards, Bruno |
prefs.sh
3 Attachment(s)
Hi Bruno,
Thanks for suggesting that fix. I have two machines that use the new instructions. They both have OpenFOAM-2.1.1/etc/prefs.sh. One is a 64 bit machine and the other is a 32 bit machine. The two machines are referred to as 192.168.1.20 and 192.168.1.21. The .20 machine is the master and the .21 is the slave. Both have two cores. I can't seem to get this work: Code:
foamJob -p -s Test-parallel in the laminar directory, I created: laminar/node0 laminar/node1 laminar/node2 laminar/node3 I modified the damBreak example in the following way: 1. I edited decomposeParDict to request distributed computation. I am attaching that file. I see sometimes after 'root' some documentation says nroots, I noticed you don't have that in yours, but I tried both. I removed a '3' that was previously after roots 2. I copied alpha1.org to alpha1 3. setFields 4. blockMesh 5. decomposePar 6. created a machines file. I'll attach that, too. 7. Each node? directory got a copy of the modified damBreak flle set. 8. I temporarily renamed machines to machines.bak and the following works: Code:
foamJob -p -s Test-parallel Code:
$ foamJob -p -s Test-parallel When I rename machines.bak to machines, foamJob picks it up and I get the following error: Code:
$ foamJob -p -s Test-parallel a. I open a root terminal on the slave machine via Gnome, and type 'which Test-parallel', and it points to the correct one. I think the environment is there. b. The node2 and node3 directories were created from the mount command. They actually reside on the slave machine (.21), but I made them part of the master file system to more accurately model your setup. The settings for the mount command were (rw,sync,no_subtree_check) c.I did have to make changes to etc/bashrc that went beyond what the directions recommends for end users. I need to remove where root was being inserted into the path. I replaced it with my username. d. I googled the problem and it appears the solution is to go back to openmpi/mpirun 1.4.3. (mantisbt 296) I think I am misapplying that patch, however. I don't see why I should be getting that error when I introduce a machines file. Any ideas? Your thoughts would be appreciated. Thanks, Chris Attachment 18000 Attachment 18001 Attachment 18002 |
Hi Chris,
:eek: these are a lot of tests and files... I can't figure out from your post if you tested using the two machines with your own user and without using the distributed folders method. I don't have much time to go into details, so I'll try to summarize the suggestions:
Best regards, Bruno |
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
Hi Chris,
A quick reply:
Bruno |
Hi Bruno,
A quick response! Quote:
Quote:
Quote:
Thanks, Chris |
Hi Bruno,
I tried your ideas. Your notes are very useful. There were a couple of links that were talking about dealing with non-interactive shells, and that was one my problems. For a default Debian installation, I had to go into my .bashrc and comment out the line that exits if it detects a non-interactive shell. Also, I uninstalled the SYSTEMOPENMPI software, and brought in OpenMPI 1.6.3. That is their latest release and they are claiming application binary interface compatibility with 1.5.3. I went into the OpenFOAM file OpenFOAM-2.1.1/etc/config/settings.sh and changed 1.5.3 to 1.6.3 to make sure I included all of OpenFOAM's requirements for the builds, notably GridEngine. (i.e. I used ./Allwmake) I am hoping GridEngine is supported in 1.6.3 as I noticed it is not working in OpenMPI 1.5.3. I setup a hosts file for the two machines: 192.168.1.25 debian5 192.168.1.26 debian6 I did not try a heterogeneous calculation, so I did everything on two nearly identical 64 bit machines. Finally, I copied the folder structure you outline in "Running OpenFOAM in parallel with different locations for each process" ...and it works. Your debian wiki was instrumental in getting this to work. I propose the following changes: 1. Update the .bashrc file to properly handle non-interactive logins, unless you have a more clever solution. 2. Build openMPI 1.6.3 since the default Debian installation does not have GridEngine support 3. setup a hosts file If you comfortable with these updates, I will be happy to make them. Best Regards, Chris |
Hi Chris,
Good to learn that you've managed to get things working! As for changing the wiki page, points 1 and 2 are OK for that Debian page and feel free to go ahead and do the modifications! Point 3 should be part of a page that is yet to be created, about running OpenFOAM in parallel. If you're willing to kick-start such a page, you can create a tips-n-tricks page: http://openfoamwiki.net/index.php/Main_TipsAndTricks - later on it can be moved to a more global section, when more contributions start coming in! Best regards, Bruno |
The correction in Line 75 of the file
OpenFOAM/ThirdParty-2.1.x/ParaView-3.12.0/Qt/Core/pqServerManagerSelectionModel.h worked for me! Thanks Martin_! |
All times are GMT -4. The time now is 21:16. |