gcc and profiling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am having trouble to try profile my code using the simple -gf profiler. I
find that I am unable to actually compile my code with the switch in. I have
been use to use the profile for a very simple piece of code (i.e. one file).
I think the problems relates to the way I am including files and my make
files for example. this is my make file:

all: Sim

Sim: FileHandling/FileHandling.o FileHandling/StructureFile.o
Initialize/Initialize.o MC/MC.o Random/Random.o Rotation/Rotation.o
Display/Display.o Stress/TBstress.o Vectors/Vectors.o CellIndex/Cell.o
Energy/Energy.o Clash/Clash.o Main.o

g++ -O3 -o Sim FileHandling/FileHandling.o FileHandling/StructureFile.o
Initialize/Initialize.o MC/MC.o Random/Random.o Rotation/Rotation.o
Display/Display.o Stress/TBstress.o Vectors/Vectors.o CellIndex/Cell.o
Energy/Energy.o Clash/Clash.o Main.o


Vectors/Vectors.o: Vectors/Vectors.cpp
g++ -O3 -c -Wno-deprecated -g -Wall Vectors/Vectors.cpp -o Vectors/Vectors.o

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

The makefile works fine with the -pg switch. However upon insertion into the
linking part complains with a myriad of errors which are complaints that
functions have already been declared. I never get these errors when I
normally compile.

In each of my files I include normally all other files and wonder if there
is an easy way to solve the problem without messing around to see what files
go where?

i.e. in my Mainfile I have

#include "Variables/Variables.h"
#include "Clash/Clash.h"
#include "Energy/Energy.h"
#include "FileHandling/StructureFile.h"
#include "FileHandling/FileHandling.h"
#include "Initialize/Initialize.h"
#include "Random/Random.h"
#include "Rotation/Rotation.h"
#include "CellIndex/Cell.h"
#include "MC/MC.h"
#include "Display/Display.h"
#include "Stress/TBstress.h"

I have tried compiling as a single line....and find I get similar errors.
Ideally I would like to keep my Makefile structure rather than move to a
single line. Can anyone suggest what to do?

Here is the o/p.

collect2: ld terminated with signal 11 [Segmentation fault]
Sim(.data+0x8): In function `__data_start':
: multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/crtbegin.o(.data+0x0): first defined
here
Sim(.init+0x0): In function `_init':
: multiple definition of `_init'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/crti.o(.init+0x0):
first defined here
Sim(.text+0x0): In function `_start':
: multiple definition of `_start'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/crt1.o(.text+0x0):
first defined here
Sim(.fini+0x0): In function `_fini':
: multiple definition of `_fini'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/crti.o(.fini+0x0):
first defined here
Sim(.got.plt+0x0): multiple definition of `_GLOBAL_OFFSET_TABLE_'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/crt1.o(.got.plt+0x0):
first defined here
Sim(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/crt1.o(.rodata+0x0):
first defined here
Sim(.data+0x0): In function `__data_start':
: multiple definition of `__data_start'
/usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/crt1.o(.data+0x0):
first defined here
FileHandling/FileHandling.o(.text+0x116): In function
`WriteTensorComponentLatest(double (*) [3][50][2], int, char*, int, int,
double)':
: multiple definition of `WriteTensorComponentLatest(double (*) [3][50][2],
int, char*, int, int, double)'
Sim(.text+0x1c8): first defined here
/usr/bin/ld: Warning: size of symbol `WriteTensorComponentLatest(double (*)
[3][50][2], int, char*, int, int, double)' changed from 402 in Sim to 407 in
FileHandling/FileHandling.o
FileHandling/FileHandling.o(.text+0x2ae): In function
`WriteTensorLateralLatest(double (*) [3][50][2], int, char*, double)':
: multiple definition of `WriteTensorLateralLatest(double (*) [3][50][2],
int, char*, double)'
Sim(.text+0x35a): first defined here
/usr/bin/ld: Warning: size of symbol `WriteTensorLateralLatest(double (*)
[3][50][2], int, char*, double)' changed from 442 in Sim to 447 in
FileHandling/FileHandling.o
FileHandling/FileHandling.o(.text+0x46e): In function
`WriteTotalLateralStress(double (*) [3][50][2], int, char*, double, long
long)':
: multiple definition of `WriteTotalLateralStress(double (*) [3][50][2],
int, char*, double, long long)'
Sim(.text+0x514): first defined here
/usr/bin/ld: Warning: size of symbol `WriteTotalLateralStress(double (*)
[3][50][2], int, char*, double, long long)' changed from 433 in Sim to 438
in FileHandling/FileHandling.o
FileHandling/FileHandling.o(.text+0x624): In function
`WriteTensorLatest(double (*) [3][50][2], int, char*)':
: multiple definition of `WriteTensorLatest(double (*) [3][50][2], int,
char*)'
Sim(.text+0x6c6): first defined here
/usr/bin/ld: Warning: size of symbol `WriteTensorLatest(double (*)
[3][50][2], int, char*)' changed from 489 in Sim to 494 in
FileHandling/FileHandling.o
-- 
View this message in context: http://www.nabble.com/gcc-and-profiling-tf3142002.html#a8708260
Sent from the gcc - Help mailing list archive at Nabble.com.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux