CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Compilation error (https://www.cfd-online.com/Forums/openfoam-programming-development/132983-compilation-error.html)

mayank.dce2k7 April 8, 2014 16:52

Compilation error
 
Hi Foamers,

I copied icoFoam solver folder from /opt/openfoam222/applications/solvers/incompressible/icoFoam and placed it in my working directory. I made following changes:

1.) Renamed icoFoam folder to micoFoam
2.) Renamed icoFoam.C to micoFoam.C
3.) In Make/files changed icoFoam.C to micoFoam.C
and also changed FOAM_APPBIN/icoFoam to FOAM_USER_APPBIN/micoFoam

I went inside micoFoam directory and typed wmake. I got the following error:

Making dependency list for source file micoFoam.C
SOURCE=micoFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/finiteVolume/lnInclude -I/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/sampling/lnInclude -IlnInclude -I. -I/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude -I/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/OSspecific/POSIX/lnInclude -I/usr/local/apps/foam/gnu44ThirdParty-2.1.1/ParaView-3.14.1-Linux-64bit/bin/include/paraview- -fPIC -c $SOURCE -o Make/linux64Gcc45DPOpt/micoFoam.o
/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/finiteVolume/lnInclude/readPISOControls.H: In function ‘int main(int, char**)’:
/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’
/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/finiteVolume/lnInclude/readPISOControls.H:12:16: warning: unused variable ‘momentumPredictor’
/usr/local/apps/OpenFOAM/gcc454-2.2.2/OpenFOAM-2.2.2/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’
mkdir: `': No such file or directory
make: *** [/micoFoam] Error 1

I don't understand the last two line:

mkdir: `': No such file or directory
make: *** [/micoFoam] Error 1


when i compiled above 'micoFoam' on my laptop it compiled. Now I am compiling it on cluster and it is giving me above error. Any ideas what is lacking?

Regards,
Mayank

chrisb2244 April 8, 2014 20:56

I'm guessing your compiler might be problematic?

I haven't seen the error before, but from the path you have I assume you have gcc 4.5.4, and according to the OF website,

"The GCC compiler may need to be upgraded to version 4.7 or higher, a requirement for OpenFOAM. "

http://www.openfoam.org/download/source.php

It might be that when you compiled OF on the cluster, it had some errors making relevant parts of the wmake system? I'm not sure, just a thought.

mayank.dce2k7 April 9, 2014 00:02

Thanks Christian. I was also thinking on the same lines. I will get the compiler version updated and let you know.

mayank.dce2k7 April 9, 2014 16:23

Hi Christian,

I guess compiler is not the problem on the link you provided if you scroll down, you will find following lines written under 'CHECKING THE SYSTEM':

"The default compiler for OpenFOAM is GCC. OpenFOAM v2.2 series will only compile with versions of GCC above 4.5.0."

I have GCC-4.5.4 so compiler version should not be a problem.

Any other ideas?

chrisb2244 April 10, 2014 00:51

What do you have in your Make/files file?

In particular, where is it trying to put your application?

My next guess is that you're trying to compile it as/to $FOAM_USER_APPBIN/micoFoam, and that if you type

Code:

echo $FOAM_USER_APPBIN
you'll get a blank line of output - ie the directory doesn't exist.

So whilst I'm not very confident this is your issue, it's possible that your user directories for the output of your compilation doesn't exist, and then mkdir can't make the relevant directory to store it because it is multiple directories down a non-existent hierarchy.

As a quick check, try using
Code:

EXE = $(FOAM_APPBIN)/micoFoam
and storing it with the default OF applications (unless you disabled write access to your applications dir, in which case pick somewhere else you know exists!

Best,
Christian

mayank.dce2k7 April 10, 2014 01:59

Hey Christian,

I solved the problem. I dunno how OF-2.2.2 was installed on the cluster by the administrator, it was not recognizing the environment variable "FOAM_USER_APPBIN". As soon as I realized this, I set the environment variable as below:

Code:

setenv FOAM_USER_APPBIN  /share/mvaish/OpenFOAM/mvaish-2.2.2/platforms/linux64GccDPOpt/bin
Now, the code micoFoam.C was successfully compiled and I can see it in 'bin' folder.
But now I have a new problem.......although the micoFoam.C has compiled but when I tried running it on cavity tutorial from my home directory ' /share/mvaish/OpenFOAM/mvaish-2.2.2/run/cavity' I got the error message:

Code:

micoFoam: Command not found
Any thoughts ?

Best,
Mayank

chrisb2244 April 10, 2014 02:19

Add it to your $PATH :)
 
relog into your cluster :)

I'm guessing you source the OF bashrc file through some sort of .profile file?

etc/bashrc will add the $FOAM_USER_APPBIN to your $PATH, but if you didn't set $FOAM_USER_APPBIN before bashrc was sourced, it won't be on your $PATH.

As such, you need to make sure you set the environment variable $FOAM_USER_APPBIN, and then source the bashrc file afterwards. (Comparable instructions for whatever the csh/ksch files are - I haven't used these but I'm guessing you might be from your setenv command.)

Best,

Christian

bullmut May 9, 2014 16:28

Hi Guys
A relative newbie to OpenFoam here, but -
I am having the same problem as initially reported in this thread.

"~/OpenFOAM/gareth-2.2.2/applications/myIcoFoam$ wmake
Making dependency list for source file myIcoFoam.C
SOURCE=myIcoFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam222/src/finiteVolume/lnInclude -I/opt/openfoam222/src/sampling/lnInclude -IlnInclude -I. -I/opt/openfoam222/src/OpenFOAM/lnInclude -I/opt/openfoam222/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/myIcoFoam.o
In file included from myIcoFoam.C:53:0:
/opt/openfoam222/src/finiteVolume/lnInclude/readPISOControls.H: In function ‘int main(int, char**)’:
/opt/openfoam222/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/opt/openfoam222/src/finiteVolume/lnInclude/readPISOControls.H:12:16: warning: unused variable ‘momentumPredictor’ [-Wunused-variable]
/opt/openfoam222/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
mkdir: cannot create directory ‘’: No such file or directory
make: *** [/myIcoFoam] Error 1 "

After following the original advice i also found my $FOAM_USER_APPBIN to be non-existent.
I created then created the folder
:~/OpenFOAM/gareth-2.2.2$ cd platforms/linux64GccDPOpt/bin

and went back to my folder to re use wmake...
this gave me the same error

Any help on this would greatly help.

Thanks

wyldckat May 10, 2014 06:29

Greetings to all!

@Gareth:
I'll need a bit more information, in order to deduce what the problem might be:
  1. Which Linux Distribution and version are you using?
  2. Which installation instructions did you follow? And did you do anything differently from those instructions?
  3. Which shell are you using? Namely: Dash, Bash, CSH, TCSH or any other?
  4. What is the content of the file "Make/files" you have in your customized solver?
I ask all of this, because these details will let us know what is the critical detail that is missing and leading to this specific error.

Best regards,
Bruno

bullmut May 10, 2014 06:45

info
 
Hi Bruno

To answer your questions:

1) I am on ubuntu 13.04
2) The installation is .. well i cant recall exactly, as i installed it a while back, but i dont recall deviating from the instructions. I used the install instructions from this site http://www.openfoam.org/download/ubuntu.php
(side - i can run the tuts, have run my own models, and it all works...)
3)when i sheck $SHELL the reply is /bin/bash,
4) as to the content of "make/files"
"myIcoFoam.C

EXE = $(FOAM_USER_APPBIN)/myIcoFoam"

Sorry my knowledge of linux is limited and i am basically picking things up as i go

Thanks

Gareth

wyldckat May 10, 2014 07:05

Hi Gareth,

OK, try the following steps:
  1. Run this command, to check if the environment variable is properly defined:
    Code:

    echo $FOAM_USER_APPBIN
    It should give you the full path to the folder you tried to create.
  2. If the previous step worked, then try:
    Code:

    mkdir -p $FOAM_USER_APPBIN
    It should either be:
    • successful and give no message;
    • or tell you that the folder already exists;
    • or that it didn't have enough permissions. This last one would be a problem.
  3. If the previous two steps worked fine, then edit the file "Make/files" and delete the text "_USER_" and write it again manually. I ask this because sometimes copy-paste will not work the way you think. For example in this case, it would because the original text had in fact a different symbol instead of the standard underscore.
    Then run in the command line:
    Code:

    wclean
    wmake

Best regards,
Bruno

bullmut May 10, 2014 07:09

@Bruno

I had the right folder in place.. but deleted it and started again with the mkdir command as you suggested. I cant explain it but, it worked fine.. thanks :)

Not sure on the difference but it works and i can work on.
hehe


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