CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Newbie compiling source code for debugging (https://www.cfd-online.com/Forums/openfoam-solving/60056-newbie-compiling-source-code-debugging.html)

unoder July 28, 2006 16:41

Sorry for asking a stupid ques
 
Sorry for asking a stupid question, perhaps nobody understood it. But since openfoam is open source, I really expected that someone could be helpful enough to explain why debug information is missing from this path:

/home/dm2/henry/OpenFOAM/linuxSrc/gcc-4.1.0/build/i686-pc-linux-gnu/libstdc++-v3 /include/bits/basic_string.h

I know you don't get paid for answering me, but isn't this so simple that it only takes 2 seconds to answer it?

gschaider July 30, 2006 15:40

I guess there are still some .
 
I guess there are still some .o or .so files lingering around which were built on Henry Wellers machine and not properly touched by your Allwmake. Use the find-command to find all .o and .so files in your OpenFOAM-installation that were created BEFORE your own building session and remove them. Then rebuild.

About new_op.cc: that's part of the standard-C++-library: I think it's highly unlikely that problems with your programs stem from that.

hjasak July 31, 2006 03:15

This looks like a problenm wit
 
This looks like a problenm with compiler relocation. I usually build mine into /usr/tmp, which makes it easier, but you should be able to easily build your own compiler. You can download gcc-4.1.1 source from one of the gcc sites. Then, remove the compiler from ~/OpenFOAM/linux/gcc-4.1.1 (just delete the directory + I am assuming you're using linux) and build your own using the following steps:

cd ~/OpenFOAM
mkdir linuxSrc
cd linuxSrc

Copy the compiler tar pack here (if you cannot find it, pls let me know and I will leave one for you somewhere convenient).

tar xzf gcc-4.1.1.tar.gz
mkdir gcc-4.1.1-obj
cd gcc-4.1.1-obj
../gcc-4.1.1/configure --prefix=~/OpenFOAM/linux/gcc-4.1.1 --enable-languages=c,c++ --enable-shared

Now build it:

gmake bootstrap

and install it:

gmake install

You can now delete the directories in ~/OpenFOAM/linuxSrc

As for the clean, OpenFOAM gives you a few scripts to clean the whole lot:

wcleanAll - cleans all the machines
wcleanMachile <build> - only cleans the named build, e.g. linuxGcc4DPDebug

Enjoy,

Hrv

unoder August 2, 2006 01:44

Thanks Bernhard and Hrv, 1)
 
Thanks Bernhard and Hrv,

1) The first solution seems to be the easiest, but I'm afraid of deleting something that I shouldn't... I guess the first solution requires something like:

a) cd ~/OpenFOAM/OpenFOAM-1.3/ instead of cd ~/OpenFOAM ?

b) find . \( -iname *.so -o -iname _.o \) ! -newer ~/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPDebug -exec rm (or similar?)


2) The second solution is much more difficult to understand, but at least I don't think I'll delete something I need. I don't know what "compiler relocation" means, but if I type "which gcc" I get:

/home/martin/OpenFOAM/linux/gcc-4.1.0/bin/gcc, so I would expect that everything was okay as it uses the gcc-binary "associated" with OF.

I followed the steps to create linuxSrc and downloaded gcc-4.1.1.tar.bz2 which is a 38 KB file. It was unzipped with tar -xvjf (filename) and put into OpenFOAM/linux. It made a lot of files into ~/OpenFOAM/linux/gcc-4.1.1

I then created ~/OpenFOAM/linuxSrc/gcc-4.1.1-obj and inside that directory I did:

../../ (path to linux/gcc-4.1.1).../configure --prefix=/home/martin/OpenFOAM/linux/gcc-4.1.1 --enable-languages=c,c++ --enable-shared


Compilation seem to take pretty long - my 2 GHz laptop is compiling right now at this moment.... I wonder what it might be doing in all that time....

I also want to disable compiler optimization so I can better debug into the OpenFOAM source-code without "jumping" like when optimization was enabled in some other windows source code I have tried... How to get rid of that -O2 option in my next step, where I'll make some new linuxGcc4DPDebug-files... ?

I'll let you know whether I succeed or not in this task (I really hope I do) :-)

unoder August 2, 2006 02:18

Oooh, damn... This is what
 
Oooh, damn...

This is what I did:

martin@laptop:~/OpenFOAM/linuxSrc/gcc-4.1.1-obj> ../../linux/gcc-4.1.1/configure --prefix=/home/martin/OpenFOAM/linux/gcc-4.1.1 --enable-languages=c,c++ --enable-shared


... followed by: "gmake bootstrap"


This is the last couple of lines from the above command:

............then mv -f ".deps/mf-runtime.Tpo" ".deps/mf-runtime.Plo"; else rm -f ".deps/mf-runtime.Tpo"; exit 1; fi
mkdir .libs
/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj/./gcc/xgcc -B/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj/./gcc/ -B/home/martin/OpenFOAM/linux/gcc-4.1.1/i686-pc-linux-gnu/bin/ -B/home/martin/OpenFOAM/linux/gcc-4.1.1/i686-pc-linux-gnu/lib/ -isystem /home/martin/OpenFOAM/linux/gcc-4.1.1/i686-pc-linux-gnu/include -isystem /home/martin/OpenFOAM/linux/gcc-4.1.1/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I../../../../linux/gcc-4.1.1/libmudflap -I. -Wall -ffunction-sections -fdata-sections -O2 -g -O2 -MT mf-runtime.lo -MD -MP -MF .deps/mf-runtime.Tpo -c ../../../../linux/gcc-4.1.1/libmudflap/mf-runtime.c -fPIC -DPIC -o .libs/mf-runtime.o
../../../../linux/gcc-4.1.1/libmudflap/mf-runtime.c:310: error: redefinition of 'struct option'
gmake[5]: *** [mf-runtime.lo] Error 1
gmake[5]: Leaving directory `/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj/i686-pc-linux-gnu/libmudflap'
gmake[4]: *** [all-recursive] Error 1
gmake[4]: Leaving directory `/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj/i686-pc-linux-gnu/libmudflap'
gmake[3]: *** [all] Error 2
gmake[3]: Leaving directory `/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj/i686-pc-linux-gnu/libmudflap'
gmake[2]: *** [all-target-libmudflap] Error 2
gmake[2]: Leaving directory `/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/home/martin/OpenFOAM/linuxSrc/gcc-4.1.1-obj'
gmake: *** [bootstrap] Error 2
martin@laptop:~/OpenFOAM/linuxSrc/gcc-4.1.1-obj>

hjasak August 2, 2006 13:15

This is really really bad: if
 
This is really really bad: if your machine cannot compile gcc (one of the most standard and basic installations), you are likely to have more trouble later. I have seen something like this with some dodgy versions of RedHat Enterprise Edition, and they require additional packages to get them to work. I would suggest searching the web for help on compiling gcc.

This kind of thing should really just work with a decent version of linux.

Hrv

unoder August 3, 2006 11:55

I have suse 10.1, which I thin
 
I have suse 10.1, which I think is decent... But I must have screwed something up, somewhere in this process...

How about solution number 1? Is that possible?

If everything fails, I think I eventually will remove OpenFOAM and try to experiment by starting from scratch again and give it a couple of more shots again... Perhaps it'll work if I outcomment the OF-stuff that sets environment variables in bashrc, so it'll compile using the gcc binary in /usr/bin or wherever it is normally, instead of having a PATH environment that finds /home/martin/OpenFOAM/linux/gcc-4.1.0/bin/gcc

I'll try to see what I can come up with...

unoder August 20, 2006 06:30

Hi Foamers, I now got throu
 
Hi Foamers,

I now got through the entire process and I don't think I got any serious errors... I think what might have caused me errors was that I probably forgot to remove the compiler from ~/OpenFOAM/linux/gcc-4.1.0 before starting out and the other thing I did was to compile as root (not sure if necessary though).

../gcc-4.1.1/configure --prefix=/home/martin/OpenFOAM/linux/gcc-4.1.1 --enable-languages=c,c++ --enable-shared

I now have gcc-4.1.1 in ~/OpenFOAM/linux, but many places (in path-environment) OF was looking for gcc-4.1.0 so since I didn't knew where to change that and be sure of having changed everything I did a "dirty" solution and created a symbolic/soft link in ~/OpenFOAM/linux: gcc-4.1.0 -> gcc-4.1.1

Then I did ./Allwmake and I think it worked...

-------------

Next problem: ParaFOAM won't start. It seems like some files are not compiled:

martin@laptop:~/OpenFOAM/martin-1.3/run/tutorials/icoFoam> paraFoam . cavity &
[1] 23693
martin@laptop:~/OpenFOAM/martin-1.3/run/tutorials/icoFoam> ErrorMessage
# Error or warning: ERROR: In ../../../../../paraview-2.4.2/Utilities/VTKClientServer/vtkClientServerInterpret er.cxx, line 866
vtkClientServerInterpreter (0x8065c98): Cannot find module "libPVFoamReader.so". The following paths were searched:
/home/martin/OpenFOAM/linux/paraview-2.4.2/lib/paraview-2.4
/home/martin/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPDebug/lam-7.1.1
/home/martin/OpenFOAM/OpenFOAM-1.3/src/lam-7.1.1/platforms/linuxGcc4DPDebug/lib
/home/martin/OpenFOAM/linux/gcc-4.1.0/lib
/home/martin/OpenFOAM/martin-1.3/lib/linuxGcc4DPDebug
/home/martin/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPDebug
/home/martin/OpenFOAM/linux/paraview-2.4.2/lib
/home/martin/OpenFOAM/OpenFOAM-1.3/src/lam-7.1.1/platforms/linuxGcc4DPDebug/bin
/home/martin/OpenFOAM/OpenFOAM-1.3/src/mico-2.3.11/platforms/linuxGcc4DPDebug/bi n
/home/martin/OpenFOAM/linux/j2sdk1.4.2_05/bin
/home/martin/OpenFOAM/linux/gcc-4.1.0/bin
/home/martin/OpenFOAM/martin-1.3/applications/bin/linuxGcc4DPDebug
/home/martin/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPDebug
/home/martin/OpenFOAM/OpenFOAM-1.3/wmake
/home/martin/OpenFOAM/OpenFOAM-1.3/bin
/home/martin/bin
/usr/local/bin
/usr/bin
/usr/X11R6/bin
/bin
/usr/games
/opt/gnome/bin
/opt/kde3/bin
/usr/lib/jvm/jre/bin
/usr/lib/mit/bin
/usr/lib/mit/sbin
/usr/lib/qt3/bin
/home/martin/OpenFOAM/linux/paraview-2.4.2/bin
/usr/lib
/usr/lib/vtk
/usr/local/lib
/usr/local/lib/vtk



ERROR: In ../../../../../paraview-2.4.2/GUI/Client/vtkPVXMLPackageParser.cxx, line 677
vtkPVXMLPackageParser (0x88a4b40): Error loading Library component PVFoamReader



ErrorMessage end
ErrorMessage
# Error or warning: There was a VTK Error in file: ../../../../../paraview-2.4.2/GUI/Client/vtkPVWindow.cxx (2364)
vtkPVWindow (0x8251530): Cannot read file information when no reader is specified. This probably means that the reader for the file with name: /home/martin/OpenFOAM/martin-1.3/run/tutorials/icoFoam/cavity/cavity.foam cannot be found
ErrorMessage end
ErrorMessage
# Error or warning: There was a VTK Error in file: ../../../../../paraview-2.4.2/GUI/Widgets/vtkKWApplication.cxx (1335)
vtkPVApplication (0x80d7aa0):
Script:
paraFoam.pvs
Returned Error on line 11:
invalid command name ""
ErrorMessage end

[1]+ Done paraFoam . cavity

-------------

Okay, let's see if we can find module "libPVFoamReader.so":

martin@laptop:~/OpenFOAM> pwd
/home/martin/OpenFOAM

martin@laptop:~/OpenFOAM> find . -iname "libPVFoamReader.so"
./OpenFOAM-1.3/lib/linuxGcc4DPOpt/libPVFoamReader.so

Damn.... It only exists in the optimized compilation.

martin@laptop:~/OpenFOAM> pwd
/home/martin/OpenFOAM
martin@laptop:~/OpenFOAM> cd OpenFOAM-1.3/lib
martin@laptop:~/OpenFOAM/OpenFOAM-1.3/lib> ls -l linuxGcc4DPOpt | wc
57 450 3985
martin@laptop:~/OpenFOAM/OpenFOAM-1.3/lib> ls -l linuxGcc4DPDebug | wc
55 434 3953

Okay, it seems to me like 2 files are missing... What did I do in the first place?
In /home/martin/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3
I changed the file to this:

# Compilation options (default precision, optimised, debug or profiling)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
#export WM_PRECISION_OPTION=SP
export WM_PRECISION_OPTION=DP

#export WM_COMPILE_OPTION=Opt
export WM_COMPILE_OPTION=Debug
#export WM_COMPILE_OPTION=Prof

#export WM_JAVAC_OPTION=Opt
export WM_JAVAC_OPTION=Debug

---------------

What now? How to get ParaFOAM to work? I guess it wasn't necessary to make WM_JAVAC_OPTION=Debug but I thought why not...

TIA...

unoder August 24, 2006 01:41

Hrv? Perhaps I should add t
 
Hrv?

Perhaps I should add that after running wcleanMachine linuxGcc4DPDebug and running the Allwmake-script, sometimes I got a message like this:

`/home/martin/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPDebug/libsampling.so' is up to date.

So I need "libPVFoamReader.so" - how to get it, if the Allwmake script doesn't make it?


All times are GMT -4. The time now is 14:13.