CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   yyFlexLexer compilation error (https://www.cfd-online.com/Forums/openfoam-installation/68728-yyflexlexer-compilation-error.html)

bigphil September 30, 2009 07:42

yyFlexLexer compilation error
 
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 October 13, 2009 13:44

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

mbeaudoin October 13, 2009 15:46

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

bigphil October 14, 2009 06:20

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 October 14, 2009 09:31

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 (Post 232565)
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).


bigphil October 14, 2009 10:14

It works!
 
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


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