CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Debug version of OpenFOAM-1.6 (http://www.cfd-online.com/Forums/openfoam-installation/75662-debug-version-openfoam-1-6-a.html)

alundilong May 2, 2010 10:47

Debug version of OpenFOAM-1.6
 
Opt version of OpenFOAM-1.6 installation is pretty easy.
However,
Debug version is not easy although I have install strictly follow those instructions.

1. cd ~
vim .bashrc
add at the end,
export WM_COMPILE=Debug
. /$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
2. cd $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
vim bashrc
Modify WM_COMPILE=Opt into WM_COMPILE=Debug
3. logout current host, e.g su root,
then relogin again.
4. cd /$HOME/OpenFOAM/OpenFOAM-1.6/
./Allwmake

There do have an additional files named as linuxGccDPDebug after compilation, but with no executalbe files such as icoFoam.

How to solve this problem?

wyldckat May 2, 2010 12:28

Greetings Edward and welcome to the forum,

OK, I propose that you follow the next steps for the environment set-up:
  1. Edit the file "$HOME/.bashrc" (it's the same as "~/.bashrc") and remove the line that says "export WM_COMPILE=Debug".
  2. Then change the line:
    Code:

    . /$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
    to
    Code:

    alias startFoam='. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc'
  3. Then add the line:
    Code:

    alias startFoamDebug='. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc_debug'
  4. Save and close the .bashrc file.
  5. Now make a copy of OpenFOAM's the file bashrc to bashrc_debug, like so:
    Code:

    cp $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc_debug
  6. Now edit the file "$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc_debug" and go to the line that says:
    Code:

    : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
    and change it to
    Code:

    : ${WM_COMPILE_OPTION:=Debug}; export WM_COMPILE_OPTION
  7. Save and close the bashrc_debug file.
  8. Start a new terminal. Now, for starting the OpenFOAM's Opt environment, run:
    Code:

    startFoam
    For starting the Debug environment, run:
    Code:

    startFoamDebug
This way, you can activate the desired environment on each new terminal! Don't forget to run either one of these commands after you start a new terminal, since without them you won't be able to use either version of OpenFOAM ;)

Best regards,
Bruno

alundilong May 5, 2010 05:52

Thank you for your detailed instructons! I will follow it and return back my response.:)

alundilong May 5, 2010 06:20

Thank you for your detailed solution, I need to make sure that whether I should compile it again before I follow your instrution?

Quote:

Originally Posted by wyldckat (Post 257204)
Greetings Edward and welcome to the forum,

OK, I propose that you follow the next steps for the environment set-up:
  1. Edit the file "$HOME/.bashrc" (it's the same as "~/.bashrc") and remove the line that says "export WM_COMPILE=Debug".
  2. Then change the line:
    Code:

    . /$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
    to
    Code:

    alias startFoam='. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc'
  3. Then add the line:
    Code:

    alias startFoamDebug='. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc_debug'
  4. Save and close the .bashrc file.
  5. Now make a copy of OpenFOAM's the file bashrc to bashrc_debug, like so:
    Code:

    cp $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc_debug
  6. Now edit the file "$HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc_debug" and go to the line that says:
    Code:

    : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
    and change it to
    Code:

    : ${WM_COMPILE_OPTION:=Debug}; export WM_COMPILE_OPTION
  7. Save and close the bashrc_debug file.
  8. Start a new terminal. Now, for starting the OpenFOAM's Opt environment, run:
    Code:

    startFoam
    For starting the Debug environment, run:
    Code:

    startFoamDebug
This way, you can activate the desired environment on each new terminal! Don't forget to run either one of these commands after you start a new terminal, since without them you won't be able to use either version of OpenFOAM ;)

Best regards,
Bruno


wyldckat May 5, 2010 07:26

Hello Edward,

You'll only need to do a full build of the debug version, since I think you already have the Opt version fully built!

Best regards,
Bruno

alundilong May 5, 2010 09:11

I do have an Opt version of OpenFOAM-1.6.It is easy to install and compile. And really appreciate your help.
Currently, debug version is under compling! I think I will make it this time. Because all the error are missing now.:D

alundilong May 7, 2010 01:37

Hi it does work now!
It seems that I have to log in the Linux system with the right host as the terminal is.
In fact, I relogin into the system with root in KDE, and login into terminal with root too. Then every thing goes smoothly. I think I need to learn more about the operation authoration of the system. :D

PaGgiE June 23, 2010 07:52

error when building in debug mode
 
Hi,
When I build openFoam in Debug mode as instructions provided above, After some time, I am getting the following error:

Code:

/bin/sh: flex: not found
mv: cannot stat `lex.yy.cc': No such file or directory
g++: Make/linuxGccDPOpt/ansysToFoam.C: No such file or directory
g++: no input files
make[3]: *** [Make/linuxGccDPOpt/ansysToFoam.o] Error 1
make[3]: Target `/home/gaurav/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/ansysToFoam' not remade because of errors.
make[2]: *** [ansysToFoam] Error 2
/bin/sh: flex: not found
mv: cannot stat `lex.yy.cc': No such file or directory
g++: Make/linuxGccDPOpt/fluent3DMeshToFoam.C: No such file or directory
g++: no input files
make[3]: *** [Make/linuxGccDPOpt/fluent3DMeshToFoam.o] Error 1
make[3]: Target `/home/gaurav/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/fluent3DMeshToFoam' not remade because of errors.
make[2]: *** [fluent3DMeshToFoam] Error 2
/bin/sh: flex: not found
mv: cannot stat `lex.yy.cc': No such file or directory
g++: Make/linuxGccDPOpt/fluentMeshToFoam.C: No such file or directory
g++: no input files
make[3]: *** [Make/linuxGccDPOpt/fluentMeshToFoam.o] Error 1
make[3]: Target `/home/gaurav/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/fluentMeshToFoam' not remade because of errors.
make[2]: *** [fluentMeshToFoam] Error 2
/bin/sh: flex: not found
mv: cannot stat `lex.yy.cc': No such file or directory
g++: Make/linuxGccDPOpt/gambitToFoam.C: No such file or directory
g++: no input files
make[3]: *** [Make/linuxGccDPOpt/gambitToFoam.o] Error 1
make[3]: Target `/home/gaurav/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/gambitToFoam' not remade because of errors.
make[2]: *** [gambitToFoam] Error 2
make[2]: Target `application' not remade because of errors.
make[1]: *** [conversion] Error 2
+ wmake libso extrudeModel
+ wmake
make[1]: Target `application' not remade because of errors.
make: *** [mesh] Error 2
+ [ -d /home/gaurav/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc -a -r /home/gaurav/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc ]
+ wmake libso vtkPV3Foam
+ cd PV3FoamReader
+ mkdir -p Make/linuxGccDPOpt
+ cd Make/linuxGccDPOpt
+ cmake ../..
+ make
make[5]: *** No rule to make target `/usr/lib/libgthread-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader.so'.
make[5]: *** No rule to make target `/usr/lib/libglib-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader.so'.
make[5]: Target `CMakeFiles/PV3FoamReader.dir/build' not remade because of errors.
make[4]: *** [CMakeFiles/PV3FoamReader.dir/all] Error 2
make[5]: *** No rule to make target `/usr/lib/libgthread-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader_SM.so'.
make[5]: *** No rule to make target `/usr/lib/libglib-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader_SM.so'.
make[5]: Target `CMakeFiles/PV3FoamReader_SM.dir/build' not remade because of errors.
make[4]: *** [CMakeFiles/PV3FoamReader_SM.dir/all] Error 2
make[4]: Target `all' not remade because of errors.
make[3]: *** [all] Error 2
make[3]: Target `default_target' not remade because of errors.
make[2]: *** [PV3FoamReader] Error 2
+ [ -d /home/gaurav/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc -a -r /home/gaurav/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc ]
make[2]: Target `application' not remade because of errors.
make[1]: *** [graphics] Error 2
make[1]: Target `application' not remade because of errors.
make: *** [postProcessing] Error 2
In file included from chemkinToFoam.C:31:
/home/gaurav/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/reactionThermo/lnInclude/chemkinReader.H:52:23: error: FlexLexer.h: No such file or directory
In file included from chemkinToFoam.C:31:
/home/gaurav/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/reactionThermo/lnInclude/chemkinReader.H:67: error: expected class-name before { token
make[2]: *** [Make/linuxGccDPOpt/chemkinToFoam.o] Error 1
make[2]: Target `/home/gaurav/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/chemkinToFoam' not remade because of errors.
make[1]: *** [chemkinToFoam] Error 2
make[1]: Target `application' not remade because of errors.
make: *** [thermophysical] Error 2
make: Target `application' not remade because of errors.
+ [  = doc ]

Does anyone know how to correct it?

Regards,
Gaurav

wyldckat June 23, 2010 07:59

Greetings Gaurav,

Quote:

Originally Posted by PaGgiE
Code:

/bin/sh: flex: not found

You have to install flex! I assume that you are using the pre-built binaries of OpenFOAM, because building the optimized version also needs flex to work.

Best regards,
Bruno

PaGgiE June 23, 2010 08:17

Thank you for your quick reply Bruno.
I have installed flex, but another error, which was there in my previously mentioned code, is still there

make[5]: *** No rule to make target `/usr/lib/libgthread-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader.so'.
make[5]: *** No rule to make target `/usr/lib/libglib-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader.so'.
make[5]: Target `CMakeFiles/PV3FoamReader.dir/build' not remade because of errors.
make[4]: *** [CMakeFiles/PV3FoamReader.dir/all] Error 2
make[5]: *** No rule to make target `/usr/lib/libgthread-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader_SM.so'.
make[5]: *** No rule to make target `/usr/lib/libglib-2.0.so', needed by `/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libPV3FoamReader_SM.so'.
make[5]: Target `CMakeFiles/PV3FoamReader_SM.dir/build' not remade because of errors.
make[4]: *** [CMakeFiles/PV3FoamReader_SM.dir/all] Error 2
make[4]: Target `all' not remade because of errors.
make[3]: *** [all] Error 2
make[3]: Target `default_target' not remade because of errors.
make[2]: *** [PV3FoamReader] Error 2
+ [ -d /home/gaurav/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc -a -r /home/gaurav/OpenFOAM/ThirdParty-1.6/paraview-3.6.1/platforms/linuxGcc ]
make[2]: Target `application' not remade because of errors.
make[1]: *** [graphics] Error 2
make[1]: Target `application' not remade because of errors.
make: *** [postProcessing] Error 2
make: Target `application' not remade because of errors.
+ [ = doc ]


I've checked, a file named 'libgthread-2.0.so.0' is there but 'libgthread-2.0.so' is not there.
Can you suggest anything about this?

Regards,
Gaurav

wyldckat June 23, 2010 08:32

Hi Gaurav,

Are the libraries "libPV3FoamReader.so" and "libPV3FoamReader_SM.so" the only ones that didn't build? If so, no need to worry since you can (and I think you should) use the optimized version of OpenFOAM for opening the case files in ParaView, using paraFoam. I believe I posted instructions above on how to have both environments up and running in separate terminals.


As for the "no rule" issue, it doesn't look a very good error message, because that seems to indicate that it's unable to build "libgthread-2.0.so" itself... which there shouldn't even be a specific step for it... must be a glitch in the make textual system.
Anyway, a usual trick for these scenarios in which there are various library version named files, is to do symbolic links:
Code:

ln -s /usr/lib/libgthread-2.0.so.0 /usr/lib/libgthread-2.0.so
ln -s /usr/lib/libglib-2.0.so.0 /usr/lib/libglib-2.0.so

These two commands have to be executed in root/superuser mode.

Best regards,
Bruno

PaGgiE June 23, 2010 09:44

Hi Bruno,

Thanks again for the reply. That issue is resolved. Sorry to bother you again but now I am getting other errors as well and I am not able to find anything on google regarding this:

+ decompositionMethods/Allwmake
+ wmake libso decompositionMethods
/usr/bin/ld: cannot find -lscotch
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libdecompositionMethods.so] Error 1
+ [ -d /home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/openmpi-1.3.3 ]
+ WM_OPTIONS=linuxGccDPDebugOPENMPI
+ wmake libso parMetisDecomp
'/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/openmpi-1.3.3/libparMetisDecompositionMethod.so' is up to date.
+ wmake libso meshTools
/usr/bin/ld: cannot find -ldecompositionMethods
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libmeshTools.so] Error 1
+ wmake libso finiteVolume
/usr/bin/ld: cannot find -lmeshTools
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libfiniteVolume.so] Error 1
+ wmake libso sampling
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libsampling.so] Error 1
+ wmake libso dynamicMesh
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libdynamicMesh.so] Error 1
+ wmake libso dynamicFvMesh
/usr/bin/ld: cannot find -lmeshTools
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libdynamicFvMesh.so] Error 1
+ wmake libso topoChangerFvMesh
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/libtopoChangerFvMesh.so] Error 1


Is there any problem with my LD_LIBRARY_PATH?
It is:

gaurav@gaurav-desktop:~/OpenFOAM/OpenFOAM-1.6$ echo $LD_LIBRARY_PATH

/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/:/home/gaurav/OpenFOAM/OpenFOAM-1.6/mylib:/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug/openmpi-1.3.3:/home/gaurav/OpenFOAM/ThirdParty-1.6/openmpi-1.3.3/platforms/linuxGccDPDebug/lib:/home/gaurav/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux/lib:/home/gaurav/OpenFOAM/ThirdParty-1.6/gmp-4.2.4/platforms/linux/lib:/home/gaurav/OpenFOAM/ThirdParty-1.6/mpfr-2.4.1/platforms/linux/lib:/home/gaurav/OpenFOAM/gaurav-1.6/lib/linuxGccDPDebug:/home/gaurav/OpenFOAM/site/1.6/lib/linuxGccDPDebug:/home/gaurav/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPDebug:/mylib

Thank you.

Regards,
Gaurav

wyldckat June 23, 2010 12:17

Hi Gaurav,

The problem is this:
Quote:

Originally Posted by PaGgiE
Code:

/usr/bin/ld: cannot find -lscotch

Try going to the ThirdParty-1.6 folder and running "./Allwmake" there, in order to first isolate the errors on the first build stage of OpenFOAM. The library libscotch.so didn't get built for some reason, and the problems should start there.

You might still need to install byson if you don't already have it!

LD_LIBRARY_PATH seems ok... wait, maybe not. Did you run both startFoam and startFoamDebug on the same terminal? If so, you shouldn't have done that! ;)

Best regards,
Bruno

PaGgiE June 24, 2010 06:40

Hi Bruno,

Thank you very much. I've installed bison. It is working properly now. :)
and ya I guess I did the same...startFoam and startFoamDebug in the same terminal. Thanks for telling about that too.

Thank you.

Regards,
Gaurav

akidess October 8, 2010 03:13

I think I found a way which is a bit simpler to accomplish the same: Instead of making a copy of the etc/bashrc, just add the following two lines to ~/.bashrc:

Code:

alias setDebug='export WM_COMPILE_OPTION=Debug; export WM_OPTIONS=${WM_ARCH}${WM_COMPILER}${WM_PRECISION_OPTION}${WM_COMPILE_OPTION}'
alias unsetDebug='export WM_COMPILE_OPTION=Opt; export WM_OPTIONS=${WM_ARCH}${WM_COMPILER}${WM_PRECISION_OPTION}${WM_COMPILE_OPTION}'


wyldckat October 8, 2010 06:29

Hi Anton,

That solution doesn't take care of updating the variables PATH and LD_LIBRARY_PATH! But that actually reminds me of something I only understood a few weeks ago:
Code:

alias startFoam='export WM_COMPILE_OPTION=Opt; . $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc'
alias startFoamDebug='export WM_COMPILE_OPTION=Debug; . $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc'

These will work as you want, namely, no need to make a copy of bashrc.
The disadvantage to this method is that it's harder to memorize how it's done, in case one needs to do this without access to the internet or doesn't find this thread :(

Which also reminds me: there is a file named aliases.sh in OpenFOAM's etc folder that initiates various helpful aliases for working with OpenFOAM. Sooo, that's a good place for adding a couple more aliases :)

Best regards,
Bruno

akidess October 8, 2010 11:11

Yeah, I did notice that a little later, but I didn't have time to update my post right away. And you are also right about aliases.sh, it's a way better place to add the debug alias. Funny how I never noticed it lingering around in the etc folder :)

majkl June 15, 2012 05:51

Hello,

if I will keep the Opt-version and now build the Debug-version, I will run the ./Allwmake in the directory of Opt-version (I follow the instructions above - editing the bashrc)?

Thanks for reply.

Michal


Quote:

Originally Posted by wyldckat (Post 257646)
Hello Edward,

You'll only need to do a full build of the debug version, since I think you already have the Opt version fully built!

Best regards,
Bruno


wyldckat June 16, 2012 04:42

Greetings Michal,

If you follow the posted instructions, you will then have two architecture folders (Opt and Debug) in the "OpenFOAM-*/platforms" folder.

If you want, you can have a lot more architectures for the same code (Prof, Single Precision, 32bit, 64bit, etc...), which all will end up in the "platforms" folder. ;)

What changes is how you set up the OpenFOAM shell environment. For more, read: Advanced tips for working with the OpenFOAM shell environment

Best regards,
Bruno


All times are GMT -4. The time now is 04:43.