

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
> Sent: 18 May 2002 00:01
> To: Dave Page
> Cc: pgsql-hackers@postgresql.org
> Subject: Re: More schema queries 
> 
> I'm not sure how to do it on Cygwin, either.  On Unix you'd 
> build a profilable backend executable using
> 	cd pgsql/src/backend
> 	gmake clean
> 	gmake PROFILE="-pg" all
> install same, run it, and then use gprof on the gmon.out file 
> dumped at postmaster termination.  Dunno if it has to be done 
> differently on Cygwin.

Hmm, I tried this and got some errors, then got side tracked with #1
daughters birthday..

Tried again today with the latest snapshot from ftp.postgresql.org and
got the same errors.

Downloaded a complete new Cygwin installation (in case my old one was
screwed up - it is very old and has been well hacked about) and still
get the same error when doing a complete build (./configure --with-CXX
--prefix=/usr/local/pgsql73 --docdir=/usr/doc/postgresql-
--with-pgport=5433):

dlltool --dllname postgres.exe --def postgres.def --output-lib
libpostgres.a
dlltool --dllname postgres.exe --output-exp postgres.exp --def
postgres.def
gcc -g -o postgres.exe -Wl,--base-file,postgres.base postgres.exp
access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o parser/SUBSYS.o
commands/SUBSYS.o executor /SUBSYS.o lib/SUBSYS.o libpq/SUBSYS.o
main/SUBSYS.o nodes/SUBSYS.o optimizer/SUBSYS.o port/SUBSYS.o
postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o storage/ SUBSYS.o
tcop/SUBSYS.o utils/SUBSYS.o -lcygipc -lcrypt
access/SUBSYS.o(.text+0x13):heaptuple.c: undefined reference to `mcount'
access/SUBSYS.o(.text+0xdf):heaptuple.c: undefined reference to `mcount'
access/SUBSYS.o(.text+0x319):heaptuple.c: undefined reference to
`mcount'
access/SUBSYS.o(.text+0x3a3):heaptuple.c: undefined reference to
`mcount'
access/SUBSYS.o(.text+0x790):heaptuple.c: undefined reference to
`mcount'
access/SUBSYS.o(.text+0x826):heaptuple.c: more undefined references to
`mcount' follow
main/SUBSYS.o(.text+0x186):main.c: undefined reference to `_monstartup'
main/SUBSYS.o(.text+0x190):main.c: undefined reference to `mcount'
nodes/SUBSYS.o(.text+0x10):nodeFuncs.c: undefined reference to `mcount'
nodes/SUBSYS.o(.text+0x44):nodeFuncs.c: undefined reference to `mcount'
nodes/SUBSYS.o(.text+0x68):nodeFuncs.c: undefined reference to `mcount'
nodes/SUBSYS.o(.text+0x8e):nodeFuncs.c: undefined reference to `mcount'
nodes/SUBSYS.o(.text+0xd1):nodeFuncs.c: more undefined references to
`mcount' follow
collect2: ld returned 1 exit status
make[2]: *** [postgres] Error 1
make[2]: Leaving directory
`/usr/local/src/postgresql-snapshot/src/backend'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/src/postgresql-snapshot/src'
make: *** [all] Error 2

Any ideas?

Regards, Dave.

Mon, 20 May 2002 14:54:58 +0100
"Dave Page" <dpage@vale-housing.co.uk>
Re: More schema queries 
"Dave Page" <dpage@vale-housing.co.uk> writes:
> gcc -g -o postgres.exe -Wl,--base-file,postgres.base postgres.exp
> access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o parser/SUBSYS.o
> commands/SUBSYS.o executor /SUBSYS.o lib/SUBSYS.o libpq/SUBSYS.o
> main/SUBSYS.o nodes/SUBSYS.o optimizer/SUBSYS.o port/SUBSYS.o
> postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o storage/ SUBSYS.o
> tcop/SUBSYS.o utils/SUBSYS.o -lcygipc -lcrypt
> access/SUBSYS.o(.text+0x13):heaptuple.c: undefined reference to `mcount'

On Unix it's necessary for the link step to include a -pg switch, just
like the compile steps.  This is evidently not happening in the Windows
case.

In the Unix case, $(PROFILE) gets incorporated into $(LDFLAGS) in
src/Makefile.global, and then src/backend/Makefile uses $(LDFLAGS)
in the backend link rule (line 40 in current source).  I don't see any
inclusion of flags at all in the Windows link rule at lines 48, 50.
Presumably these ought to at least mention $(PROFILE), and I wonder
whether they should not say $(LDFLAGS).

Please check it out and submit a patch...

			regards, tom lane

Mon, 20 May 2002 10:15:33 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: More schema queries 