CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Undefined reference to %60yyFlexLexeryywrapb (http://www.cfd-online.com/Forums/openfoam-installation/57295-undefined-reference-60yyflexlexeryywrapb.html)

arjaan April 29, 2008 10:34

I successfully worked through
 
I successfully worked through most of the installation of OpenFOAM-1.4.1 on Ubuntu 8.04 (see details at bottom), except one last issue that occurs twice, and I do not know how to fix:

undefined reference to `yyFlexLexer::yywrap()'

It happens here:
make[2]: Entering directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase/lesInterFo am'
g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -Iaveraging -I../interFoam -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/transportModels -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/incompressible/lnIncl ude -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/interfaceProperties/l nInclude -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/LESmodels -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/LESmodels/LESdeltas/lnInclude -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread Make/linuxGccDPOpt/lesInterFoam.o -L/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt \
-linterfaceProperties -lincompressibleTransportModels -lincompressibleLESmodels -lfiniteVolume -lOpenFOAM -ldl -lm -o /home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/lesInterFoam
/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libtriSurface.so: undefined reference to `yyFlexLexer::yywrap()'
collect2: ld returned 1 exit status
make[2]: *** [/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/lesInterFoa m] Error 1
make[2]: Leaving directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase/lesInterFo am'
make[1]: *** [lesInterFoam] Error 2
make[1]: Leaving directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase'
make: *** [multiphase] Error 2

And it happens here:
make[3]: Entering directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing/patc h/patchIntegrate'
g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread Make/linuxGccDPOpt/patchIntegrate.o -L/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt \
-lfiniteVolume -lOpenFOAM -ldl -lm -o /home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/patchIntegra te
/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libtriSurface.so: undefined reference to `yyFlexLexer::yywrap()'
collect2: ld returned 1 exit status
make[3]: *** [/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/patchIntegr ate] Error 1
make[3]: Leaving directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing/patc h/patchIntegrate'
make[2]: *** [patchIntegrate] Error 2
make[2]: Leaving directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing/patc h'
make[1]: *** [patch] Error 2
make[1]: Leaving directory `/home/arjaan/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing'
make: *** [postProcessing] Error 2

----
Details of what I did:
(-) Installed Ubuntu 8.04
(-) Downloaded OpenFOAM-1.4.1
Iterated through the installation, as follows:
(-) ssh was not running
See: https://help.ubuntu.com/community/SSHHowto

(-) During Allwmake:

g++ was not found
-----------------
Typed '% g++', which told me to do this:
% sudo apt-get install g++

g77 was not found
-----------------
Typed '% g77', which told me to do this:
% sudo apt-get install g77

flex++ was not found
--------------------
Typed '% flex++', which told me to do this:
% sudo apt-get install flex

gmake was not found
-------------------
% su
% ln -s /usr/bin/make /usr/bin/gmake (as root)
zlib.h was not found
--------------------
See: http://www.cfd-online.com/cgi-bin/Op...cus/discus.cgi -- searched for zlib.h
http://ubuntuforums.org/showthread.php?t=178493
This is a system file: /usr/include/zlib.h
% sudo apt-get install build-essential (This did not fix it..)
% sudo apt-get install zlib1g-dev libssl-dev

X11/Xlib.h - No such file or directory
--------------------------------------
See: https://lists.ubuntu.com/archives/ub...er/099230.html
% sudo apt-get install libx11-dev (post includes instructions how to down-load other packages as well...)

GL/gl.h - No such file or directory
-----------------------------------
See: http://ubuntuforums.org/showthread.php?t=235000
% sudo apt-get install mesa-common-dev (post includes instructions how to --reinstall ...)

/usr/bin/ld: cannot find -lXext
-------------------------------
See: http://packages.ubuntu.com/feisty/x11proto-xext-dev
% sudo apt-get install x11proto-xext-dev (did not fix it...)
% sudo apt-get install libxext-dev

bernd April 29, 2008 17:03

You should execute all those c
 
You should execute all those commands like
"sudo apt-get install g++" (then you have to enter the root password of your machine.)

However I can't believe that you really have an error saying "g++ not found" because your make output is proving that g++ is in your PATH.

The "undefined reference to `yyFlexLexer::yywrap()' " may be caused by an older (or completely missing?) flex++. According to other forum posts you need version 2.5.35.

Bernd

arjaan April 29, 2008 18:12

Bernd, thanks for the feedbac
 
Bernd,
thanks for the feedback.

Sorry for the apparently confusing description.

I actually did execute all those commands, and there are no issues anymore with g++, g77, etc.

The only issue remaining is this undefined reference to yyFlexLexer::yywrap().

I double checked, and I have version 2.5.34 installed.

I'll try to upgrade to 2.5.35. I can not find this version in an existing package for Ubuntu, so I might have to build it first.

You mentioned other forum posts that discuss flex++, can you point me to them ?

Thanks much,
-Arjaan

bernd April 29, 2008 18:36

>I'll try to upgrade to 2.5.35
 
>I'll try to upgrade to 2.5.35. I can not find this version in an existing package for Ubuntu, so I might have to build it first.

Correct. I don't say it solves your problem, but the thread below says that 2.5.35 works better than 2.5.33.

>You mentioned other forum posts that discuss flex++, can you point me to them ?

http://www.cfd-online.com/OpenFOAM_D.../126/6070.html

elisabet May 8, 2008 11:05

Hi Arjaan, Did you fix your
 
Hi Arjaan,

Did you fix your flex++ problem?
I have exactly the same problem and, despite I have tried to compile OF with different flex versions, the problem persists. Any suggestion?

elisabet

elisabet May 8, 2008 13:25

Ok, I get it. I found the a
 
Ok, I get it.

I found the answer here:
http://the-free-meme.blogspot.com/20...rap-it-up.html

So, I just substituted the line:
extern "C" int yywrap()
with
int yyFlexLexer::yywrap()

in 5 files:
1. $WM_PROJECT_DIR/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L
2. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam .L
3. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent MeshToFoam.L
4. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMe shToFoam.L
5. $WM_PROJECT_DIR/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L

Now, OF-1.4.1 works perfectly on Ubuntu 8.04 under a 64 bit machine.

elisabet

johndeas May 8, 2008 16:28

Since flex is supplied, I do n
 
Since flex is supplied, I do not understand why it is necessary to install it. I had the same problem, having to install flex, zlib-devel and some others to compile the 1.4.1-dev

andpet May 17, 2008 14:17

Hi. Since I'm compiling OF on
 
Hi.
Since I'm compiling OF on Ubuntu 8.04 I will ask about my problem here.
So far I've followed the advice given above, but now I get :


Make/linuxGccDPOpt/multiphaseMixture.o:multiphaseMixture.C: (.text+0x8210): first defined here
Make/linuxGccDPOpt/multiphaseMixture.o: In function `Foam::multiphaseMixture::solveAlphas(int, bool, double)':
multiphaseMixture.C : (.text+0x82e0): multiple definition of `Foam::multiphaseMixture::solveAlphas(int, bool, double)'
Make/linuxGccDPOpt/multiphaseMixture.o:multiphaseMixture.C: (.text+0x82e0): first defined here
Make/linuxGccDPOpt/multiphaseMixture.o: In function `Foam::multiphaseMixture::correct()':
multiphaseMixture.C: (.text+0x9dc0): multiple definition of `Foam::multiphaseMixture::correct()'
Make/linuxGccDPOpt/multiphaseMixture.o:multiphaseMixture.C: (.text+0x9dc0): first defined here
Make/linuxGccDPOpt/multiphaseMixture.o: In function `Foam::multiphaseMixture::surfaceTensionForce() const':
multiphaseMixture.C: (.text+0xa930): multiple definition of `Foam::multiphaseMixture::surfaceTensionForce() const'
Make/linuxGccDPOpt/multiphaseMixture.o:multiphaseMixture.C: (.text+0xa930): first defined here
Make/linuxGccDPOpt/multiphaseMixture.o: (.rodata+0x0): multiple definition of `Foam::multiphaseMixture::convertToRad'
Make/linuxGccDPOpt/multiphaseMixture.o: (.rodata+0x0): first defined here
Make/linuxGccDPOpt/multiphaseInterFoam.o: In function `main':
multiphaseInterFoam.C: (.text+0xf0): multiple definition of `main'
Make/linuxGccDPOpt/multiphaseInterFoam.o:multiphaseInterFoam.C: (.text+0xf0): first defined here
collect2: ld returned 1 exit status
make[2]: *** [/home/peter/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/multiphaseIn terFoam] Error 1
make[2]: Leaving directory `/home/peter/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase/multiphaseI nterFoam'
make[1]: *** [multiphaseInterFoam] Error 2
make[1]: Leaving directory `/home/peter/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase'
make: *** [multiphase] Error 2

Does anyone have some idea about this ?

Thanks Peter

paulchang July 21, 2008 08:58

Peter, I tried OF-1.5 on Ub
 
Peter,

I tried OF-1.5 on Ubuntu 8.04. The binaries provided by OF official site can be easily installed. I haven't made any test run yet.
(You may need to install Qt4, which provides libQtSql.so to run ParaView)

reza August 20, 2008 12:25

Sarah, I have the same proble
 
Sarah,
I have the same problem and I cannot find any solution. Please post if you find any.

kev4573 August 22, 2008 11:58

I recently had the same proble
 
I recently had the same problem and managed to find a solution. OpenFOAM comes with flex++ however it names this utility foamFlex++ which is not used during a compile to my knowledge . Rename the executable to be flex++ and compile it. Do a 'which flex++' and ensure your path is set correctly. Now you can substitute - extern "C" int yywrap() for int yywrap() - in the appropriate files. After doing this the OpenFOAM compile should work!

tsencic October 29, 2008 07:00

It doesn't work for me. When I
 
It doesn't work for me. When I try to compile OF-1.4.1-dev I get the error:
/home/tom/OpenFOAM/OpenFOAM-1.4.1-dev/lib/linuxGccDPOpt/libtriSurface.so: undefined reference to `yyFlexLexer::yywrap()'
I use Ubuntu 8.0. I installed flex-2.5.35, renamed foamFlex++ in flex++ (I have both). I did not find the lines extern "C" int yywrap(), I suppose it was corrected.
Any help is welcome.
Tomislav

kev4573 October 29, 2008 12:25

You need to replace int yywrap
 
You need to replace int yywrap() with extern "C" int yywrap() , not the other way around.


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