|
[Sponsors] |
Compile Error of OpenFOAM-2.2.0 on RedHat EL5 |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 6, 2013, 21:22 |
Compile Error of OpenFOAM-2.2.0 on RedHat EL5
|
#1 |
Member
Masashi Ohbuchi
Join Date: Oct 2009
Posts: 74
Rep Power: 17 |
Hi, foamers.
I downloaded OpenFOAM-2.2.0, and tried to compile on my RedHat EL5 system. But building process for libOpenFOAM was failed with following error message; primitives/triad/triad.C:36: error: expected initializer before '<' token primitives/triad/triad.C:39: error: expected initializer before '<' token What's the problem? Any comments welcome. |
|
March 6, 2013, 22:41 |
|
#2 |
Member
Masashi Ohbuchi
Join Date: Oct 2009
Posts: 74
Rep Power: 17 |
When I removed the 'triad ::' from line 36 and line 39 of triad.C, the compilation was successful.
|
|
March 8, 2013, 07:07 |
|
#3 |
Member
Pekka Pasanen
Join Date: Feb 2012
Location: Finland
Posts: 87
Rep Power: 14 |
I experienced similar error in Xubuntu 12.10, i did the same fix and it compiled. However I'm a little concerned about removing triad:: from lines 36 and 39, could someone more C++ involved person inspect this and make a comment?
|
|
March 8, 2013, 11:02 |
|
#4 |
Senior Member
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 18 |
hello,
Same here. Compilation work with gcc 4.5 and 4.6, not with gcc 4.7.2 Regards, olivier |
|
March 9, 2013, 21:21 |
|
#5 |
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'm not exactly an expert on C++ (there is a lot about C++ that I don't know and don't even care to understand ), but I believe I understand what's happening in this case. The short answer is: it doesn't matter what hack you use. You can even comment out those lines and it will still build (well, at least "libOpenFOAM.so" did). Reason: The "triad" class is only used by the "triadField" field type definition and there is no clear indication that this particular "triadField" definition is used anywhere else. But it should appear some time in the future of OpenFOAM, so beware! Keep in mind that Gcc 4.5 is now the minimum version required for OpenFOAM 2.2: http://www.openfoam.org/mantisbt/view.php?id=765 In case you want to be prepared right away, if using RHEL/CentOS/SL 6, you can get Gcc 4.5 and more recent versions from the EPEL repositories: http://fedoraproject.org/wiki/EPEL - edit: apparently it's not present for RHEL/CentOS/SL 6 either Unfortunately, the EPEL repositories don't have Gcc 4.5 and above for RHEL/CentOS/SL 5 Nonetheless, instructions on how to build your own Gcc 4.6 for OpenFOAM can be found on a nearby thread: http://www.cfd-online.com/Forums/ope...-10-04lts.html - keep in mind that those are for Ubuntu 10.04, so you'll need to adapt accordingly. _______________ Now for the long answer:
I think this explains most of the details on this topic Best regards, Bruno
__________________
Last edited by wyldckat; April 26, 2013 at 20:47. Reason: edit: apparently it's not present for RHEL/CentOS/SL 6 either |
|
March 10, 2013, 04:39 |
|
#6 |
Member
Masashi Ohbuchi
Join Date: Oct 2009
Posts: 74
Rep Power: 17 |
Hello, Mr.Santos.
Thank you for your detail explanation of this problem. I will setup gcc4.6 and re-compile OF2.2 on my system. |
|
July 18, 2013, 04:08 |
|
#7 | |
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 17 |
Hi,
I have the same problem even after updating gcc to version gcc (Debian 4.6.3-14). Maybe, OF still uses the old gcc version? How could I check it? Cheers, Ilya P.S. linux: Quote:
Last edited by linch; July 18, 2013 at 09:01. |
||
July 21, 2013, 06:27 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Ilya,
Don't forget to check if both gcc and g++ are 4.6: Code:
gcc --version g++ --version Bruno
__________________
|
|
July 22, 2013, 08:39 |
|
#9 |
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 17 |
Hi Bruno,
you're right: g++ was still 4.4. Thanks, Ilya |
|
August 9, 2013, 10:11 |
|
#10 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
So far, I tried the following gcc/g++ versions: 4.5.4, 4.6.0, 4.7.1, 4.8.1, with OF 2.2.0 and 2.2.x (from github). They all produce the same error in triad.C. OS=RocksCluster 6.1, based on CentOS 6.3, and the said compilers were compiled from sources. The funny thing is, I have compiled OF 2.2.0 a few months ago on Debian 7.0, and I had the same error at first (I saved the compiler outputs), but then somehow I succeeded... and now I don't remember how...
Can somebody plz share their success stories? Some compiler switches, maybe? |
|
August 10, 2013, 16:03 |
|
#11 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
Ooops... I installed different versions of compilers in different folders, but the OF install script still used the "standard" compiler that comes with the OS. Apparently, the desired compiler can be selected by setting the environment variables WM_CC and WM_CXX (e.g., WM_CXX=/share/apps/GCC/gcc-4.8.1/bin/g++), however, it seems that those variables are not actually used (or are they)? There are files
OpenFOAM-(version)/wmake/rules/(platform)/c and c++, where the compiler calls are hardcoded, like 'cc = gcc -m64'. When using wmakeScheduler, this eventually turns into smth like 'ssh compile_host "g++ ..."' Naturally, the environment variables are not set on the appropriate host, and /usr/bin/g++ is used. I edited the respective lines in the wmake/rules files to be 'cc = $(WM_CC) -m64', 'CC = $(WM_CXX) -m64', and it compiled succesfully. The question is, should these compiler calls be hardcoded in wmake/rules? Why not use the WM_CC and WM_CXX variables? |
|
August 16, 2013, 19:50 |
|
#12 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Honestly, I thought about this several times as well, but I keep postponing the task of looking deeper into this before reporting this as a bug.
The only reason I can find so far is that using "$(WM_*)" directly in the rule files might fail in some cases, such as Unix based machines or in very old Linux distributions. Nonetheless, these variables are used in the "Allwmake" script that is located in the ThirdParty folder, so it makes sense that they should also be used in the rules' files. But don't let me stop you! Feel free to report this in the official bug tracker: http://www.openfoam.org/bugs/
__________________
|
|
October 16, 2013, 12:49 |
|
#13 | |
Senior Member
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can someone PLEASE document the development version installation | bernd | OpenFOAM Installation | 76 | November 14, 2008 22:51 |
Compile OpenFOAM on Fedora 8 | asaha | OpenFOAM Installation | 1 | August 25, 2008 12:41 |
OpenFOAM compilation fails on applicationsutilitiesmesh | geoffjay | OpenFOAM Installation | 12 | April 29, 2008 16:26 |
OpenFOAM with IBM AIX | matthias | OpenFOAM Installation | 20 | March 25, 2008 03:36 |
How to compile OpenFOAM from scratch bashrc and cshrc | danieltourde | OpenFOAM Installation | 2 | December 15, 2006 10:30 |