Thread: Link errors on win32

Link errors on win32

From
"Thomas Hallgren"
Date:
After patching postmaster.c (see previous post) I'm unable to link on win32
(mingw). I get the following errors:

gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declaratio
ns -L../../src/port   -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
../../src/timezone/SUBSYS.o -lz -lreadline -lwsock32 -lm  -lpgport -lws2_32
executor/SUBSYS.o(.text+0x10417):nodeSeqscan.c: undefined reference to `nth'
executor/SUBSYS.o(.text+0x134a6):nodeSubqueryscan.c: undefined reference to
`nth'
port/SUBSYS.o(.text+0x3be):pg_sema.c: undefined reference to `pqkill'
storage/SUBSYS.o(.text+0x4363):fd.c: undefined reference to
`is_absolute_path'
storage/SUBSYS.o(.text+0x7fc5):pmsignal.c: undefined reference to `pqkill'
storage/SUBSYS.o(.text+0xd129):proc.c: undefined reference to `pqkill'
utils/SUBSYS.o(.text+0x24f58):not_in.c: undefined reference to `llast'
utils/SUBSYS.o(.text+0x24f70):not_in.c: undefined reference to `ltruncate'
utils/SUBSYS.o(.text+0x6c2cc):fmgr.c: undefined reference to `nth'
make[2]: *** [postgres] Error 1
make[2]: Leaving directory `/ws/pgsql/src/backend'

Regards,

Thomas Hallgren



Re: Link errors on win32

From
"Magnus Hagander"
Date:
> After patching postmaster.c (see previous post) I'm unable to
> link on win32 (mingw). I get the following errors:
>
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declaratio
> ns -L../../src/port   -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
> ../../src/timezone/SUBSYS.o -lz -lreadline -lwsock32 -lm
> -lpgport -lws2_32
> executor/SUBSYS.o(.text+0x10417):nodeSeqscan.c: undefined
> reference to `nth'
> executor/SUBSYS.o(.text+0x134a6):nodeSubqueryscan.c:
> undefined reference to `nth'
> port/SUBSYS.o(.text+0x3be):pg_sema.c: undefined reference to `pqkill'
> storage/SUBSYS.o(.text+0x4363):fd.c: undefined reference to
> `is_absolute_path'
> storage/SUBSYS.o(.text+0x7fc5):pmsignal.c: undefined
> reference to `pqkill'
> storage/SUBSYS.o(.text+0xd129):proc.c: undefined reference to `pqkill'
> utils/SUBSYS.o(.text+0x24f58):not_in.c: undefined reference to `llast'
> utils/SUBSYS.o(.text+0x24f70):not_in.c: undefined reference
> to `ltruncate'
> utils/SUBSYS.o(.text+0x6c2cc):fmgr.c: undefined reference to `nth'
> make[2]: *** [postgres] Error 1
> make[2]: Leaving directory `/ws/pgsql/src/backend'

This looks like it's missing stuff from Bruces move from
backend/port/win32 to port/kill.c of the kill signal. Are you sure you
pulled a new version of the port directory as well? And did you do a
"make clean"?

IIRC, /port/ is not recompied if you just to "make" in the backend
directory. You could also try doing a manual maek in /port/ before you
make in backend.

Don't know about the list fubnctions like llast/ltruncate, but I bet
that could also show up if you didn't do "make clean".


//Magnus

Re: Link errors on win32

From
"Thomas Hallgren"
Date:
"Magnus Hagander" <mha@sollentuna.net> writes:
> This looks like it's missing stuff from Bruces move from
> backend/port/win32 to port/kill.c of the kill signal. Are you sure you
> pulled a new version of the port directory as well? And did you do a
> "make clean"?
>
I did a make clean. But it encountered an error and terminated prematurely
and I missed it...

make[2]: Entering directory `/ws/pgsql/contrib/earthdistance'
make[2]: *** No rule to make target `clean'.  Stop.
make[2]: Leaving directory `/ws/pgsql/contrib/earthdistance'
make[1]: *** [clean] Error 2
make[1]: Leaving directory `/ws/pgsql/contrib'
make: *** [clean] Error 2

Anyway, I removed everything and downloaded a new fresh version, reapplied
my patch for postmaster.c, and recompiled. Everything links ok now.

Thanks,

Thomas Hallgren



Re: Link errors on win32

From
Thomas Hallgren
Date:
Tom Lane wrote:

>"Thomas Hallgren" <thhal@mailblocks.com> writes:
>
>
>>I did a make clean. But it encountered an error and terminated prematurely
>>and I missed it...
>>
>>
>
>
>
>>make[2]: Entering directory `/ws/pgsql/contrib/earthdistance'
>>make[2]: *** No rule to make target `clean'.  Stop.
>>make[2]: Leaving directory `/ws/pgsql/contrib/earthdistance'
>>make[1]: *** [clean] Error 2
>>make[1]: Leaving directory `/ws/pgsql/contrib'
>>make: *** [clean] Error 2
>>
>>
>
>You must have a broken version of make.  There certainly is a 'clean'
>rule in that subdirectory, and it works for everyone else.
>
>            regards, tom lane
>
>
Ah yes. Actually, this is the error I got once I manually created the
earthdistance directory in order for the clean to proceed. The first
time it failed, it was missing altogether.

- thomas



Re: Link errors on win32

From
Tom Lane
Date:
"Thomas Hallgren" <thhal@mailblocks.com> writes:
> That might well be the reason! I did check out the pgsql-server. May I
> suggest that a minor improvement to make the "make clean" a bit more
> tolerant?

I'd rather lobby Marc to re-merge the CVS modules.

            regards, tom lane

Re: Link errors on win32

From
Tom Lane
Date:
"Thomas Hallgren" <thhal@mailblocks.com> writes:
> I did a make clean. But it encountered an error and terminated prematurely
> and I missed it...

> make[2]: Entering directory `/ws/pgsql/contrib/earthdistance'
> make[2]: *** No rule to make target `clean'.  Stop.
> make[2]: Leaving directory `/ws/pgsql/contrib/earthdistance'
> make[1]: *** [clean] Error 2
> make[1]: Leaving directory `/ws/pgsql/contrib'
> make: *** [clean] Error 2

You must have a broken version of make.  There certainly is a 'clean'
rule in that subdirectory, and it works for everyone else.

            regards, tom lane

Re: Link errors on win32

From
Bruce Momjian
Date:
Thomas Hallgren wrote:
> "Magnus Hagander" <mha@sollentuna.net> writes:
> > This looks like it's missing stuff from Bruces move from
> > backend/port/win32 to port/kill.c of the kill signal. Are you sure you
> > pulled a new version of the port directory as well? And did you do a
> > "make clean"?
> >
> I did a make clean. But it encountered an error and terminated prematurely
> and I missed it...
>
> make[2]: Entering directory `/ws/pgsql/contrib/earthdistance'
> make[2]: *** No rule to make target `clean'.  Stop.
> make[2]: Leaving directory `/ws/pgsql/contrib/earthdistance'
> make[1]: *** [clean] Error 2
> make[1]: Leaving directory `/ws/pgsql/contrib'
> make: *** [clean] Error 2
>
> Anyway, I removed everything and downloaded a new fresh version, reapplied
> my patch for postmaster.c, and recompiled. Everything links ok now.

I did a gmake clean and gmake distclean from the top of CVS and it
worked fine for me.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Link errors on win32

From
Thomas Hallgren
Date:
Bruce Momjian wrote:

>Thomas Hallgren wrote:
>
>
>>"Magnus Hagander" <mha@sollentuna.net> writes:
>>
>>
>>>This looks like it's missing stuff from Bruces move from
>>>backend/port/win32 to port/kill.c of the kill signal. Are you sure you
>>>pulled a new version of the port directory as well? And did you do a
>>>"make clean"?
>>>
>>>
>>>
>>I did a make clean. But it encountered an error and terminated prematurely
>>and I missed it...
>>
>>make[2]: Entering directory `/ws/pgsql/contrib/earthdistance'
>>make[2]: *** No rule to make target `clean'.  Stop.
>>make[2]: Leaving directory `/ws/pgsql/contrib/earthdistance'
>>make[1]: *** [clean] Error 2
>>make[1]: Leaving directory `/ws/pgsql/contrib'
>>make: *** [clean] Error 2
>>
>>Anyway, I removed everything and downloaded a new fresh version, reapplied
>>my patch for postmaster.c, and recompiled. Everything links ok now.
>>
>>
>
>I did a gmake clean and gmake distclean from the top of CVS and it
>worked fine for me.
>
>
>
I've encountered this before. You have to do a make that fails first,
then a make clean. On occation, the latter will fail. I'm not shure
exactly when or why this happens. My theory is that the make clean
assumes that some directories have been created when in fact they have
not since the original make failed prematurely.

- thomas




Re: Link errors on win32

From
Tom Lane
Date:
Thomas Hallgren <thhal@mailblocks.com> writes:
> Ah yes. Actually, this is the error I got once I manually created the
> earthdistance directory in order for the clean to proceed. The first
> time it failed, it was missing altogether.

Ah.  earthdistance is in a separate CVS module (a remnant of a failed
experiment in splitting up the distribution).  IIRC, if you check out
"pgsql-server" rather than just "pgsql" you'll get this situation.

            regards, tom lane

Re: Link errors on win32

From
"Thomas Hallgren"
Date:
That might well be the reason! I did check out the pgsql-server. May I
suggest that a minor improvement to make the "make clean" a bit more
tolerant?

Kind regards,

- thomas


----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Thomas Hallgren" <thhal@mailblocks.com>
Cc: <pgsql-patches@postgresql.org>
Sent: Friday, May 28, 2004 20:54
Subject: Re: [PATCHES] Link errors on win32


> Thomas Hallgren <thhal@mailblocks.com> writes:
> > Ah yes. Actually, this is the error I got once I manually created the
> > earthdistance directory in order for the clean to proceed. The first
> > time it failed, it was missing altogether.
>
> Ah.  earthdistance is in a separate CVS module (a remnant of a failed
> experiment in splitting up the distribution).  IIRC, if you check out
> "pgsql-server" rather than just "pgsql" you'll get this situation.
>
> regards, tom lane
>



Re: Link errors on win32

From
Christopher Kings-Lynne
Date:
>> You must have a broken version of make.  There certainly is a 'clean'
>> rule in that subdirectory, and it works for everyone else.
>>
>>             regards, tom lane
>>
>>
> Ah yes. Actually, this is the error I got once I manually created the
> earthdistance directory in order for the clean to proceed. The first
> time it failed, it was missing altogether.

That's normal - the CVS repo for that contrib is totally broken.  I just
remove the earthdistance line from the contrib/Makefile.

Chris