|
[Sponsors] |
April 16, 2012, 10:58 |
Compilation error with OpenFOAM 2.1.x
|
#1 |
New Member
Martin Vymazal
Join Date: Dec 2009
Posts: 16
Rep Power: 17 |
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] fileMonitor.C:308:13: warning: use of old-style cast [-Wold-style-cast] fileMonitor.C:308:13: warning: use of old-style cast [-Wold-style-cast] fileMonitor.C:325:22: warning: use of old-style cast [-Wold-style-cast] fileMonitor.C:325:22: warning: use of old-style cast [-Wold-style-cast] fileMonitor.C:325:22: warning: use of old-style cast [-Wold-style-cast] fileMonitor.C:333:17: error: ‘read’ was not declared in this scope make: *** [Make/linux64GccDPOpt/fileMonitor.o] Error 1 + wmake libso OpenFOAM 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 |
|
April 16, 2012, 16:25 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
__________________
|
|
April 16, 2012, 16:45 |
|
#3 |
New Member
Martin Vymazal
Join Date: Dec 2009
Posts: 16
Rep Power: 17 |
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 Last edited by Martin_; April 16, 2012 at 17:45. |
|
April 16, 2012, 17:07 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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> # include <sys/ioctl.h> # include <errno.h>
__________________
|
|
April 17, 2012, 09:26 |
|
#5 |
Senior Member
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22 |
@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? |
|
April 19, 2012, 19:47 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
__________________
|
|
April 21, 2012, 09:54 |
|
#7 |
Senior Member
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22 |
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. |
|
April 21, 2012, 11:35 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Robert,
Mmm... OK, there are only a few things that come to my mind:
Bruno
__________________
|
|
April 21, 2012, 13:01 |
|
#9 |
Senior Member
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22 |
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. |
|
April 22, 2012, 20:06 |
|
#10 |
New Member
Martin Vymazal
Join Date: Dec 2009
Posts: 16
Rep Power: 17 |
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 cd OSspecific/POSIX wclean libo wmake libo 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/pqAnimationScene.cxx:57:0: OpenFOAM/ThirdParty-2.1.x/ParaView-3.12.0/Qt/Core/pqServerManagerSelectionModel.h:75:30: error: calls to overloaded operators cannot appear in a constant-expression make[2]: *** [Qt/Core/CMakeFiles/pqCore.dir/pqAnimationScene.cxx.o] Error 1 make[1]: *** [Qt/Core/CMakeFiles/pqCore.dir/all] Error 2 make: *** [all] Error 2 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 |
|
May 1, 2012, 13:04 |
|
#11 |
Senior Member
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22 |
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. |
|
May 2, 2012, 07:23 |
|
#12 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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 ./Allwmake
__________________
|
|
May 3, 2012, 16:58 |
|
#13 |
New Member
Andrew Fischer
Join Date: Dec 2010
Posts: 1
Rep Power: 0 |
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. Last edited by wizzrobe; May 3, 2012 at 17:21. |
|
October 23, 2012, 22:53 |
|
#14 |
New Member
Chris Fisichella
Join Date: Oct 2012
Posts: 28
Rep Power: 14 |
Hi,
I tried Bruno's suggestion to Code:
cd src cd OSspecific/POSIX wclean libo wmake libo 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 |
|
October 24, 2012, 04:32 |
|
#15 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
__________________
|
|
October 25, 2012, 21:34 |
Stuck on step 3
|
#16 |
New Member
Chris Fisichella
Join Date: Oct 2012
Posts: 28
Rep Power: 14 |
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 i686 Code:
fisichel@debian:~$ source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=2 WM_MPLIB=SYSTEMOPENMPI WM_ARCH_OPTION=32 Cannot open configuration file /home/fisichel/OpenFOAM/ThirdParty-2.1.1/platforms/linuxGcc/openmpi-1.5.3/share/openmpi/mpicc-wrapper-data.txt Error parsing data file mpicc: Not found Cannot open configuration file /home/fisichel/OpenFOAM/ThirdParty-2.1.1/platforms/linuxGcc/openmpi-1.5.3/share/openmpi/mpicc-wrapper-data.txt Error parsing data file mpicc: Not found fisichel@debian:~$ Code:
fisichel@debian:~$ find . -name mpicc-wrapper-data.txt -print ./121023_OpenFOAM/ThirdParty-2.1.1/openmpi-1.5.3/ompi/tools/wrappers/mpicc-wrapper-data.txt 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 |
|
October 27, 2012, 12:43 |
|
#17 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Chris,
The instructions from that page require that you install this package, otherwise they will not work as intended. 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
__________________
|
|
October 28, 2012, 20:42 |
|
#18 |
New Member
Chris Fisichella
Join Date: Oct 2012
Posts: 28
Rep Power: 14 |
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 |
|
November 6, 2012, 20:08 |
|
#19 |
New Member
Chris Fisichella
Join Date: Oct 2012
Posts: 28
Rep Power: 14 |
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 |
|
December 23, 2012, 05:33 |
|
#20 |
New Member
Chris Fisichella
Join Date: Oct 2012
Posts: 28
Rep Power: 14 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM compilation | MrAnderson | OpenFOAM | 3 | October 16, 2017 19:04 |
OpenFOAM 1.6.x, 1.7.0 and 1.7.x are not fully prepared to work with gcc-4.5.x | wyldckat | OpenFOAM Bugs | 18 | October 21, 2010 06:51 |
Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 7 | January 19, 2010 16:39 |
OpenFOAM Training in Europe and USA | hjasak | OpenFOAM | 0 | August 8, 2008 06:33 |
OpenFOAM Debian packaging current status problems and TODOs | oseen | OpenFOAM Installation | 9 | August 26, 2007 14:50 |