CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   OpenFOAM 2.2.2 on a cluster as a job FlexLexer error (

Artur November 28, 2013 13:20

OpenFOAM 2.2.2 on a cluster as a job FlexLexer error
Hi Foamers!

My university just started a new cluster so the first thing I tried was compiling the new OF there. From the log in node it works without any problems. However, I don't think running such big jobs is an elegant thing to do on a login node and so I used my script I had written for the previous cluster to compile OF as a sequential job.

Here is the deal: running nodes don't have FlexLexer installed on them so to account for that I copy flex and flex++ into my own /bin directory and supply the header to OF via linking:

ln -s /home/akl1g09/include/FlexLexer.h $FOAM_SRC/OpenFOAM/lnInclude/FlexLexer.h

While it worked fine on the previous cluster on the new one I get the following error in the first lines of my log file:


flex: error writing output file lex.yy.c
I'm certain I have the correct version of the header. Is it possible that flex requires some other dependency which is missing on the running nodes?

Any advice will be appreciated


wyldckat November 29, 2013 16:05

Greetings Artur,

OK, let's address this in parts:
  1. You mention that the nodes do not have FlexLexer... but in order to build OpenFOAM, you only need to build it in the master node (possibly the log-in node you mention) and then share or rsync the installation to all of the other slave nodes!
  2. This message:

    flex: error writing output file lex.yy.c
    is implying that there is some sort of file writing problem, possibly related to insufficient file/folder permissions.
  3. More output from the build structure surrounding the error message above would be helpful to ascertain if that is the actual error.
Best regards,

Artur December 2, 2013 06:50

Hi Bruno,

Thanks for your reply. I set my script up so that it does the compilation in my home directory so that then I can just source the foam dot file from my .bash_profile when I log in (just as you say, it is enough to have the compiled source on my log in node).

When I ran it on the previous cluster just by running ./Allwmake from terminal upon ssh'ing to the server it was running painfully slowly so I wrote a script which submits the whole process as a job (not to overload the log in nodes and to be able to work while it's running).

In order to do that I had to do the flexlexer trick with copying it to my home/bin and linking the header for OF to see it. On the new cluster I did the same and I get the error listed previously, here's the surrounding bit of the log (literally very beginning):


gcc -m64  -Wall -O3  -fPIC dirToString.c -o /home/akl1g09/OpenFOAM/OpenFOAM-2.2.2/wmake/platforms/linux64Gcc/dirToString
flex wmkdep.l
flex: fatal internal error, exec failed
flex: error writing output file lex.yy.c
make: *** [/home/akl1g09/OpenFOAM/OpenFOAM-2.2.2/wmake/platforms/linux64Gcc/wmkdep] Error 1

This does not happen when I run the process from my log in node.

All the best,


wyldckat December 8, 2013 15:13

Hi Artur,

Well, it looks like the job is not able to access the path with write capabilities, as this implies:


flex: fatal internal error, exec failed
flex: error writing output file lex.yy.c

There might be something in the new cluster that enforces that write permission is only allowed in the dedicated parallel file-system or something similar. In other words:
  • the path to your user area might be read-only during the job;
  • or when it is not the correct binary trying to perform file writing, i.e. it is not the flex binary that was called for in the job script.
Either way, this looks like a security measure that you're stumbling on.

Best regards,

Artur December 8, 2013 16:28

Hi Bruno,

Thanks for clearing this up for me. I'll just stick to compiling it from the log-in node then.

Have a nice day,


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