Re: "undefined reference" error when compiling extension functions

"Mark Miller" <[email protected]> Mon, 25 Apr 2005 17:33:24 -0700
Newsgroups gmane.comp.db.postgresql.devel.win32
Organization Waveshift, Inc.
Message-ID <[email protected]>
I just finished doing a clean build with the same result. I have installed
everything to the defaults

(uninstall previously installed windows installation)
$ Configure --without-zlib
--with-includes=~/postgresql-8.0.2/include/port/win32/*
$ make install

When I try to complile the source for the extension after this I get the
same message as before. I'm going to hang up my hat for the day and give it
a run again tomorrow. Then I'll try and find out where libpostgres.a is and
see if I can add it to the search path with LDFLAGS and -I specified. Let me
know if you think of anything else. 

I appreciate all the help. I'm not used to so many people being so willing
to help. Usually when I post a problem I'm having on "other" lists I get
either useless answers or none at all.

Thanks again,

Mark

-----Original Message-----
From: Andrew Dunstan [mailto:[email protected]] 
Sent: Monday, April 25, 2005 5:20 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [pgsql-hackers-win32] "undefined reference" error when
compiling extension functions


It seems to be looking for libpostgres.a, which is created as part of a 
standard build ... which takes me back to my earlier suggestion of doing 
a full configure/make to give yourself the right enviroment to build 
extensions.

cheers

andrew


Mark Miller wrote:

>Thanks,
>
>I have to say that it is worlds different than what I'm used to. But it's
>never stopped me before ;). I did find why it was pointing to the wrong
dir,
>the pgxs/src/Makefile.global had the following line in it:
>
>prefix := /usr/local/pgsql
>
>Which likely has something to do with the build, since I did a windows
>install the default might not get set. I did set prefix when I ran
configure
>and make install, but since I only installed includes it make sense that
the
>file didn't get updated. But sadly, even though I found this and the output
>has changed (see below), it did not fix the problem. It still fails with
the
>following error:
>
>cannot find -lpostgres
>
>Which brings us back to your suggestion of a clean build from scratch. It
>seems the only solution unless I want to walk thru every possible place
>where I'll run into these problems.
>
>What is "-lpostgres" anyway?
>
>--------------------- make output --------------------------------------
>
>$ make
>dlltool --export-all --output-def filesize.def filesize.o
>dllwrap -o filesize.dll --def filesize.def filesize.o
>c:/Progra~1/PostgreSQL/8.0/lib/pgxs/src/makefiles/../../src/utils/dllinit.o
>-L/c/progra~1/postgresql/8.0/bin -lpostgres
>c:\MinGW\bin\..\lib\gcc-lib\mingw32\3.2.3\..\..\..\..\mingw32\bin\ld.exe:
>cannot find -lpostgres
>c:\MinGW\bin\dllwrap.exe: c:\MinGW\bin\gcc exited with status 1
>make: *** [filesize.dll] Error 1
>
>  
>
>  
>


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend