CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   1.5-dev GCC-4.5.1 (http://www.cfd-online.com/Forums/openfoam/80232-1-5-dev-gcc-4-5-1-a.html)

linnemann September 20, 2010 07:33

1.5-dev GCC-4.5.1
 
Hi all

Im trying to compile OF-1.5-dev with gcc-4.5.1.

Im almost successfull. My gcc-4.3.3 is working fine, but I want to test the improved speed of the new gcc-4.5 releases.

I have an error in compiling the combustion libraries. Everything else compiles fine.

Code:

[root@comp combustion]# wmake libso
SOURCE=chemistryReaders/chemkinReader/chemkinLexer.L ; flex -+ -f $SOURCE ; mv lex.yy.cc Make/linux64GccDPOpt/chemkinLexer.C ; g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/basic/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/specie/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/ThirdParty/flex-2.5.35/include -IlnInclude -I. -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -DYY_SKIP_YYWRAP -c Make/linux64GccDPOpt/chemkinLexer.C -o Make/linux64GccDPOpt/chemkinLexer.o
SOURCE=mixtureThermos/mixtures/reactingMixture/reactingMixture.C ;  g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/basic/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/specie/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/ThirdParty/flex-2.5.35/include -IlnInclude -I. -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/reactingMixture.o
SOURCE=hCombustionThermo/hCombustionThermo.C ;  g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/basic/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/specie/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/ThirdParty/flex-2.5.35/include -IlnInclude -I. -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/hCombustionThermo.o
SOURCE=hCombustionThermo/newhCombustionThermo.C ;  g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/basic/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/thermophysicalModels/specie/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/ThirdParty/flex-2.5.35/include -IlnInclude -I. -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/opt/software/OpenFOAM/OpenFOAM-gcc-4.5.1/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/newhCombustionThermo.o
lex.yy.cc: In member function ‘int Foam::chemkinReader::lex()’:
lex.yy.cc:35903:57: warning: use of old-style cast
lex.yy.cc:35903:57: warning: use of old-style cast
lex.yy.cc:35919:3: warning: use of old-style cast
lex.yy.cc:37332:62: warning: use of old-style cast
lex.yy.cc: In member function ‘int yyFlexLexer::yy_get_next_buffer()’:
lex.yy.cc:37587:53: warning: use of old-style cast
lex.yy.cc:37610:39: warning: use of old-style cast
lex.yy.cc:37623:28: warning: use of old-style cast
lex.yy.cc:37623:58: warning: use of old-style cast
lex.yy.cc:37644:3: warning: use of old-style cast
lex.yy.cc:37644:3: warning: use of old-style cast
lex.yy.cc:37669:48: warning: use of old-style cast
lex.yy.cc:37672:95: warning: use of old-style cast
lex.yy.cc:37672:115: warning: use of old-style cast
lex.yy.cc: In member function ‘yy_state_type yyFlexLexer::yy_get_previous_state()’:
lex.yy.cc:37699:48: warning: use of old-style cast
lex.yy.cc:37699:48: warning: use of old-style cast
lex.yy.cc: In member function ‘void yyFlexLexer::yyunput(int, char*)’:
lex.yy.cc:37759:32: warning: use of old-style cast
lex.yy.cc:37760:32: warning: use of old-style cast
lex.yy.cc:37768:20: warning: use of old-style cast
lex.yy.cc: In member function ‘int yyFlexLexer::yyinput()’:
lex.yy.cc:37817:14: error: ‘EOF’ was not declared in this scope
lex.yy.cc:37835:36: warning: use of old-style cast
lex.yy.cc: In member function ‘virtual yy_buffer_state* yyFlexLexer::yy_create_buffer(std::istream*, int)’:
lex.yy.cc:37913:66: warning: use of old-style cast
lex.yy.cc:37922:54: warning: use of old-style cast
lex.yy.cc: In member function ‘virtual void yyFlexLexer::yy_delete_buffer(yy_buffer_state*)’:
lex.yy.cc:37944:48: warning: use of old-style cast
lex.yy.cc:37947:22: warning: use of old-style cast
lex.yy.cc:37949:18: warning: use of old-style cast
lex.yy.cc: In member function ‘void yyFlexLexer::yyensure_buffer_stack()’:
lex.yy.cc:38076:9: warning: use of old-style cast
lex.yy.cc:38096:9: warning: use of old-style cast
lex.yy.cc: In member function ‘void yyFlexLexer::yy_push_state(int)’:
lex.yy.cc:38116:49: warning: use of old-style cast
lex.yy.cc:38119:65: warning: use of old-style cast
lex.yy.cc:38119:77: warning: use of old-style cast
lex.yy.cc: In function ‘void* yyalloc(yy_size_t)’:
lex.yy.cc:38198:31: warning: use of old-style cast
lex.yy.cc: In function ‘void* yyrealloc(void*, yy_size_t)’:
lex.yy.cc:38210:36: warning: use of old-style cast
lex.yy.cc:38210:46: warning: use of old-style cast
lex.yy.cc: In function ‘void yyfree(void*)’:
lex.yy.cc:38215:17: warning: use of old-style cast
make: *** [Make/linux64GccDPOpt/chemkinLexer.o] Error 1
make: *** Waiting for unfinished jobs....


linnemann September 20, 2010 08:44

Hi

Did some initial speed test with the simpleFoam pitzDaily3Blocks tutorial with blocks refined in all direction (except z, 2d mesh).

Code:

Number of cells of each type:
    hexahedra:    123706
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    134

Ok results for 500 itt.
Code:

gcc-4.3.3                    gcc-4.5.1
  950 s.                        864 s.

Improvement
9.05%

So thats quite a good improvement.

Still having the combustion library compile problem.

wyldckat September 20, 2010 11:14

Hi Linneman,

Have you tried using the same/similar wmake rules from OpenFOAM 1.7.x? Because that error reminds me of the "--cpp-traditional" argument...

And I suggest to first try using gcc 4.5.0, since the changes recently committed seem to only be tested with gcc 4.5.0 ;)

Best regards,
Bruno

linnemann September 20, 2010 13:01

Hi Bruno

Good ideas I will try the 1.7.x rules sometime in the future.

bastil September 22, 2010 10:03

Quote:

Originally Posted by linnemann (Post 275861)
Hi Bruno

Good ideas I will try the 1.7.x rules sometime in the future.

I tried it today and found out there are no wmake rules for gcc-4.5 in the wmake-Directory of OF1.7.x. Where do I get them from?

Regards Bastian

wyldckat September 23, 2010 07:04

Greetings Bastian,

"On size fits all" :D the linuxGcc and linux64Gcc rules in OpenFOAM 1.7.x work with gcc 4.3.x, 4.4.x and 4.5.x :D

Best regards,
Bruno

bastil October 22, 2010 07:41

Quote:

Originally Posted by wyldckat (Post 275842)
Hi Linneman,

Have you tried using the same/similar wmake rules from OpenFOAM 1.7.x? Because that error reminds me of the "--cpp-traditional" argument...


I tried that today and I have the same problems buildig combustion library.

wyldckat October 22, 2010 21:07

1 Attachment(s)
Hi Bastil,

This is very odd... I've just finished building OpenFOAM 1.5-dev r1842 with:
  • OpenFOAM's 1.6 ThirdParty folder;
  • OpenFOAM's 1.7.0 linux64Gcc rules folder (I meant to use the one from 1.7.1, but I forgot about it midway :( but it worked nonetheless!);
  • flex 2.5.35;
  • a fresh custom build of gcc 4.5.1 (adapted from my build-gcc scripts kit);
  • a hatchet to remove those pesky "//" lines from the files files and options that some libraries have... namely:
    Code:

    src/OpenFOAM/Make/options
    src/engine/Make/files

  • and some fine tuning to make it all work together. Including having to do an additional export after sourcing the bashrc file, to make some system libraries visible to wmake:
    Code:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/lib
    NOTE: I'm using Ubuntu 9.10 x86_64, therefore in other x86_64 Linux boxes, one might need to use "lib64" instead of "lib" in this last line!
Attached is the differences between the SVN version and my modified version :D CAUTION: do not use this patch blindly, since I'm only certain that it "worked for me", so it might not work for you straight out of the box!


Anyway, after this successful build with gcc 4.5.1 and flex 2.5.35, I can only assume that the problems you and Linnemann are having with the combustion library is due to some issue with your system's flex... which is a bit odd, since it worked fine with gcc 4.3.3...
Sooo, my suggestion is to run:
Code:

wclean libso src/thermophysicalModels/combustion
wmake libso src/thermophysicalModels/combustion

and see if it crashes again. If it still does, is it with the same exact error as Linnemann's:
Quote:

Code:

lex.yy.cc:37817:14: error: ‘EOF’ was not declared in this scope

?

Best regards and good luck!
Bruno

bastil October 25, 2010 04:21

Quote:

Originally Posted by wyldckat (Post 280401)
Sooo, my suggestion is to run:
Code:

wclean libso src/thermophysicalModels/combustion
wmake libso src/thermophysicalModels/combustion

and see if it crashes again. If it still does, is it with the same exact error as Linnemann's:?

Yes it still is the same error and it still crashes. I think you are right: The system-flex seems to have some trouble whereas it is working with gcc4.3.3

bb_ October 25, 2010 07:25

Hey Bruno,

I also tried to install OF-1.5-dev with GCC-4.5.1 following your instructions (OF-1.5-dev r1842, ThirdParty-1.6, rules from OF-1.7.1, flex-2.5.35) . Sadly, without success.

I successfully compiled gcc and its dependencies (gmp, mpfr, mpc, binutils) but when running the OF Allwmake script, an error occurs:

Code:

cd $WM_PROJECT_DIR
./Allwmake

..
(Thirdparty tools compile successfully)
...

cd src
+ ./Allwmake
+ cd OpenFOAM
+ wmakeLnInclude .
+ cd finiteVolume
+ wmakeLnInclude .
+ cd Pstream
+ ./Allwmake
+ wmake libso dummy
SOURCE=Pstream.C ;  g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40  -IlnInclude -I. -I/home/g18719/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/home/g18719/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/Pstream.o
SOURCE=IPread.C ;  g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-40  -IlnInclude -I. -I/home/g18719/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/home/g18719/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/IPread.o
IPread.C:30:19: fatal error: error.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/IPread.o] Error 1
make: *** Waiting for unfinished jobs....
Pstream.C:28:30: fatal error: PstreamReduceOps.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/Pstream.o] Error 1

...
(I hit Ctrl+C here to abort the script)

It complains about not finding error.H and PstreamReduceOps.H. Although those files do exist (in ./src/OpenFOAM/db/error/error.H and ./src/OpenFOAM/db/IOstreams/Pstreams/PstreamReduceOps.H). I suppose something went wrong with the include/search paths. Is there anything I forgot to modify? If you need any additional input I'd be happy to post it here.

Thanks a lot if you have any hints for me!

(sidenote: the code for OF-1.7.1 compiles just fine on the system with the same setup)

wyldckat October 25, 2010 07:35

Greetings bb,

Did you also check the changes I made to settings.sh and bashrc? They are inside the file attached to that post.

By the way when you run:
Code:

which g++
g++ --version

Does it correspond to the correct location and version of gcc/g++ 4.5.1? If not, check those two files I told you about.

Edit:
Also, you can try this with the 1.5-dev version:
Code:

cd $WM_PROJECT_DIR
wmakeLnIncludeAll src applications

Additionally, are you sure that you aren't trying to use the environment from 1.7.1/x when building 1.5-dev?

Best regards,
Bruno

bb_ October 25, 2010 09:29

Hi Bruno,

thanks for the quick reply! My environment setup was correct - the

Code:

cd $WM_PROJECT_DIR
wmakeLnIncludeAll src applications

did the trick! After running wmakeLnIncludeAll, Allwmake started and the problem with missing include files was fixed! What exactly does wmakeLnIncludeAll do? (Usually, it's not necessary to run this, is it?)

Sadly, now it seems that I'm have the same issue with src/thermophysicalModels/combustion (everything compiles until this point):

Code:

lex.yy.cc:37817:14: error: 'EOF' was not declared in this scope
Although flex is the correct version..... Well, I'll have a look on that and will get back to you if I can find a solution.

wyldckat October 25, 2010 09:50

Hi bb,

wmakeLnIncludeAll will remove all lnInclude sub-folders for the given folders. These lnInclude sub-folders are a quick way for wmake to contain all of the necessary headers for each library/application.

This "containment system" is great, but means that there could be some weird issues once in a while, when you update the code, or make substantial changes to the files and dependencies. This means that wmakeLnIncludeAll can be considered a last resort for when things don't seem to want to get built :D
In other words, whenever we update 1.7.x or 1.5-dev, and sometimes with a brand new copy/clone, things could be clogged up for some weird and files in lnInclude could be left hanging ...

By the way, rmdepall (if I'm not mistaken) also seems to be useful once in a while as well, specially for situations were the error talks about some file that ends with ".dep" :)


As for the combustion problem, this is really starting to be very strange... maybe me using the rules from 1.7.0 instead of 1.7.1/x had something to do with it... I'll try to have a go at it when I can.

Best regards,
Bruno

bb_ October 25, 2010 10:03

Thanks for the enlightenment about these commands :), that was very helpfull!

Oh, and tomorrow I'll have a look on the combustion problem too.

Regards,
bb.

wyldckat October 25, 2010 18:15

1 Attachment(s)
Hi bb,

OK, I've just tested with the linux64Gcc rules from 1.7.1 (only one minor thing changed in the file c++) and it worked fine for me as well.

I've known for a while, from the posts in this forum, that file corruption, bad downloads, git or svn file mangling is known to happen once every million/billion operations around the world. In other words, it can happen, with no prior warning. The error shouldn't have occurred, but it did and it won't repeat for another million operations or so...
So, I suspect that for some weird reason, the file I got isn't damaged, but your versions of that file are corrupted for some weird reason... probably SVN's fault :rolleyes:

So, lets try to isolate the error this way:
  1. I've attached the file "src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinLexer.L" in a tarball/bomb. In other words, it only has the file, with no paths.
  2. Unpack it in your desktop folder or something like that, and run this (or similar) in a terminal with OF 1.5-dev environment set-up:
    Code:

    diff -Nu ~/Desktop/chemkinLexer.L $FOAM_SRC/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinLexer.L
    If there isn't any output, then the files should be identical.
  • If there is any output, even if not visible specifically visible (end line is the only difference, but the different lines should start with "+" or "-"), then that should be the problem. And if this is the case, then something is misconfigured in your SVN. The subversion was installed in my machine just for cloning the 1.5-dev repo the other day, so I didn't configure anything. The svn version is "1.6.5 (r38866)".
  • But if there wasn't any output, then try replacing the file with this one, just in case :p
So bb, since you said you are going to try and figure out what happened, please also try this!

Best regards,
Bruno

bb_ October 26, 2010 03:58

Ok, so here are the insights of the last couple hours: taking the diff between the two files showed that they are identical. Thus, replacing my version with yours didn't help, but it was worth a try.

However, after googling a little bit, I found this page: http://bugs.gentoo.org/280586. In comment #9, Oliver Borm supplied a patch which worked for him (apparently OF-1.6 and gcc-4.4.1). Looking at it showed that he added the single line

Code:

#include <stdio.h>
at the beginning of src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L.

So that's what I did too - and it compiled successfully!! I don't know why exactly this include is necessary, but anyway...;)

Right now I'm running a test case for comparison with my old set up to check if everything is all right. So far, everything looks good :), but let's be patient and wait for the results.

Edit: BastiL, could you try to do the same to your code? Then we could check if this is a valid fix for the problem.

wyldckat October 26, 2010 17:37

Hi bb,

:eek: but... I didn't even bother reading the file, because I knew from past experience since OpenFOAM 1.6.x that it wouldn't build with gcc 4.4.x unless "stdio.h" that was in the chemkinLexer.L file! See this bug report, because it also has links to the proposed fixes for 1.6.x. The changes in OpenFOAM's 1.6.x git from 2009-11-13 by Mattijs contain all of the fixes needed for building with gcc 4.4.x. And that shouldn't be the only ".L" file that needs fixing too, as shown here.

<rant>But then how on (virtually digital) earth does it build with me? "I think therefore it will work"?</rant>

Anyway, I'm glad you managed to figure it out! Have you or will you report it to OpenFOAM-extend's Mantis page?

Best regards,
Bruno

bastil October 27, 2010 04:03

Quote:

Originally Posted by bb_ (Post 280740)
Right now I'm running a test case for comparison with my old set up to check if everything is all right. So far, everything looks good :), but let's be patient and wait for the results.
Edit: BastiL, could you try to do the same to your code? Then we could check if this is a valid fix for the problem.

I will try the same. What do your results look like so far? I will keep you posted.

Regards Bastian

bastil October 27, 2010 04:36

1 Attachment(s)
For me it does not work at all. I am getting further but not done compiling the combustion library (see logfile).

I already tried preplacing '[[' and ']]' as metioned here:
http://www.cfd-online.com/Forums/ope...e-60mainb.html

My flex is the system flex 2.5.31.

Ideas?

Regards Bastian

Edit: False alarm. I used wmake instead of wmake libso. Not the library compiles fine for me, too.

bb_ November 2, 2010 04:54

Hey,

results look good so far, test cases are all running fine, with about 5% speed improvement compared to the old setup.

regards,
bb


All times are GMT -4. The time now is 06:34.