CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Installation

yyFlexLexer compilation error

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   September 30, 2009, 08:42
Default yyFlexLexer compilation error
  #1
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 543
Rep Power: 17
bigphil will become famous soon enough
Hi,

I have been compilign OpenFOAM-1.4.1-dev, and it gets through the compilation process for the most part but with just a few solvers and utilities getting the same error about yyFlexLexer:
Code:
             -lengine -lcompressibleTurbulenceModels -lcombustionThermophysicalModels -lfiniteVolume -llagrangian -ldieselSpray -lliquids -lliquidMixture -lt
hermophysicalFunctions -lspecie -lbasicThermophysicalModels -llaminarFlameSpeedModels -lchemistryModel -lODE -lpdf -lOpenFOAM -ldl   -lm -o /home/philipc/Ope
nFOAM/OpenFOAM-1.4.1-dev/applications/bin/linuxGccDPOpt/dieselEngineFoam
/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/lib/linuxGccDPOpt/libcombustionThermophysicalModels.so: undefined reference to `yyFlexLexer::yywrap()'
collect2: ld returned 1 exit status
make[2]: *** [/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/applications/bin/linuxGccDPOpt/Xoodles] Error 1
make[1]: *** [Xoodles] Error 2
I have tried everything I can think of, I changed 'flex' to 'foamFlex' in '/wmake/rules/General/flex++'. I tried reinstall the older version of flex on my system. I tried changing the readSTLASCII.L file as suggested in a different post. I tried copying foamFlex from an OF-1.3 installation to 'utilities/miscellaneous/' and recompiling but I still get the same error above... I assume it is still an issue with flex, but I don't know how to fix it.

I don't need the solvers that didn't compile but I do use 'gambitToFoam' which failed.


Any suggestion would be much appreciated,
Philip
bigphil is offline   Reply With Quote

Old   October 13, 2009, 14:44
Default
  #2
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 543
Rep Power: 17
bigphil will become famous soon enough
Hmmn...

I still can't seem to figure it out.

If someone has an tip it would be great, maybe I'm leaving out something simple...


I'll keep trying,

Philip
bigphil is offline   Reply With Quote

Old   October 13, 2009, 16:46
Default
  #3
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 328
Rep Power: 12
mbeaudoin will become famous soon enough
Hello,

Have you tried recompiling libcombustionThermophysicalModels when you switched between flex++ and foamFlex++?

There is a .L file there as well that probably needs recompiling.

It would also be useful to know your flex version (flex --version).

Martin
mbeaudoin is offline   Reply With Quote

Old   October 14, 2009, 07:20
Default
  #4
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 543
Rep Power: 17
bigphil will become famous soon enough
Hi Martin,

I have tried flex 2.5.35 (flex in YaST2) and flex 2.5.4a (flex old in YaST2).

Actually I am getting an error compiling combustion library - I am nearly sure I got this to compile before.. i think). The start of the error is below:

Code:
+ wmake libso combustion
SOURCE=chemistryReaders/chemkinReader/chemkinLexer.L ; flex++ -f $SOURCE ; mv lex.yy.cc Make/linuxGccDPOpt/chemkinLexer.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/finiteVolume/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/basic/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/specie/lnInclude -IlnInclude -I. -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/OpenFOAM/lnInclude   -fPIC -pthread -c Make/linuxGccDPOpt/chemkinLexer.C -o Make/linuxGccDPOpt/chemkinLexer.o
SOURCE=derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C ;  g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/finiteVolume/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/basic/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/specie/lnInclude-IlnInclude -I. -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/OpenFOAM/lnInclude   -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/fixedUnburntEnthalpyFvPatchScalarField.o
chemistryReaders/chemkinReader/chemkinLexer.L:58: error: previous declaration of ‘int yywrap()’ with ‘C++’ linkage
lex.yy.cc:35561: error: conflicts with new declaration with ‘C’ linkage
lex.yy.cc: In member function ‘int Foam::chemkinReader::lex()’:
lex.yy.cc:35851: warning: use of old-style cast

To change between flex and foamFlex, I just comment out the relevant line in the 'OpenFOAM-1.4.1-dev/wmake/rules/General/flex++' file, right? And then try recompiling everything?

Thanks for your help,
Philip

Btw: I am using OpenSUSE 11.0.
Not sure if it makes a difference, but I installed mico-2.3.13, due to an earlier error with mico, it seemed to do the trick.

Also, I get this same error with the two versions of flex and foamFlex (assuming I'm actually changing between the different types of flex properly).

Last edited by bigphil; October 14, 2009 at 07:36.
bigphil is offline   Reply With Quote

Old   October 14, 2009, 10:31
Default
  #5
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 328
Rep Power: 12
mbeaudoin will become famous soon enough
Hello,

That problem was solved in 1.5.

This is the piece of code from chemkinReader/chemkinLexer.L that is causing you problem in 1.4.1-dev:
// Dummy yywrap to keep yylex happy at compile time.
// It is called by yylex but is not used as the mechanism to change file.
// See <<EOF>>
int yywrap()
// int yyFlexLexer::yywrap()
{
return 1;
}
This is what you will now find in 1.5-dev:
// Dummy yywrap to keep yylex happy at compile time.
// It is called by yylex but is not used as the mechanism to change file.
// See <<EOF>>
#if YY_FLEX_SUBMINOR_VERSION < 34
extern "C" int yywrap()
#else
int yyFlexLexer::yywrap()
#endif
{
return 1;
}

You should try to apply the same recipe to all the .L files you need to compile.

Another way to correct the problem is to replace the Ltoo rule in the flex++ file by this:

Ltoo = flex++ -f $$SOURCE ; mv lex.yy.cc $*.C ; $(CC) $(c++FLAGS) -DYY_SKIP_YYWRAP -c $*.C -o $@

This is the fix I was using for 1.4.1-dev. The fix implemented in 1.5 is probably much better.

Give it a try and see how far you can go.

Martin



Quote:
Originally Posted by bigphil View Post
Hi Martin,

I have tried flex 2.5.35 (flex in YaST2) and flex 2.5.4a (flex old in YaST2).

Actually I am getting an error compiling combustion library - I am nearly sure I got this to compile before.. i think). The start of the error is below:

Code:
+ wmake libso combustion
SOURCE=chemistryReaders/chemkinReader/chemkinLexer.L ; flex++ -f $SOURCE ; mv lex.yy.cc Make/linuxGccDPOpt/chemkinLexer.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/finiteVolume/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/basic/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/specie/lnInclude -IlnInclude -I. -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/OpenFOAM/lnInclude   -fPIC -pthread -c Make/linuxGccDPOpt/chemkinLexer.C -o Make/linuxGccDPOpt/chemkinLexer.o
SOURCE=derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C ;  g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/finiteVolume/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/basic/lnInclude -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/thermophysicalModels/specie/lnInclude-IlnInclude -I. -I/home/philipc/OpenFOAM/OpenFOAM-1.4.1-dev/src/OpenFOAM/lnInclude   -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/fixedUnburntEnthalpyFvPatchScalarField.o
chemistryReaders/chemkinReader/chemkinLexer.L:58: error: previous declaration of ‘int yywrap()’ with ‘C++’ linkage
lex.yy.cc:35561: error: conflicts with new declaration with ‘C’ linkage
lex.yy.cc: In member function ‘int Foam::chemkinReader::lex()’:
lex.yy.cc:35851: warning: use of old-style cast
To change between flex and foamFlex, I just comment out the relevant line in the 'OpenFOAM-1.4.1-dev/wmake/rules/General/flex++' file, right? And then try recompiling everything?

Thanks for your help,
Philip

Btw: I am using OpenSUSE 11.0.
Not sure if it makes a difference, but I installed mico-2.3.13, due to an earlier error with mico, it seemed to do the trick.

Also, I get this same error with the two versions of flex and foamFlex (assuming I'm actually changing between the different types of flex properly).
mbeaudoin is offline   Reply With Quote

Old   October 14, 2009, 11:14
Smile It works!
  #6
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 543
Rep Power: 17
bigphil will become famous soon enough
Martin,

The offending libraries compiled (albeit with quite a few warnings of use of old-style cast).

And now the utilities and solvers that didn't before are now compiling!

I can finally use gambitToFoam in this installation.

Thanks very much for your help,

It is very much appreciated!

Best Regards,
Philip Cardiff

Last edited by bigphil; October 14, 2009 at 12:10.
bigphil is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50
Compiling problems with hello worldC fw407 OpenFOAM Installation 21 January 6, 2008 18:38
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
user subroutine error CFDUSER CFX 2 December 9, 2006 07:31


All times are GMT -4. The time now is 23:01.