pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Darwin libpq link failing
3+ messages / 3 participants
[nested] [flat]

* Darwin libpq link failing
@ 2003-02-27 04:40 ash <xpi@aeria.net>
  2003-03-02 17:48 ` Re: Darwin libpq link failing Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: ash @ 2003-02-27 04:40 UTC (permalink / raw)
  To: pgsql-interfaces

	I have a library that I wrote under OpenBSD and built with no problem for years.. but as I'm porting to darwin, I'm noticing some .. unpleasend behavioure during final linking on a Mac OS 10.2.4 sytem . please point out any  oversights.. 

first versions.. 
xpi@ryoku:mutilities>psql -V                                               <xpi
psql (PostgreSQL) 7.3.1
built locally  with --no-readline as it's only configure option

and gcc 3.1..
on 
root@ryoku:src>uname -a                                                   <root
Darwin ryoku 6.3 Darwin Kernel Version 6.3: Sat Dec 14 03:11:25 PST 2002; root:xnu/xnu-344.23.obj~4/RELEASE_PPC  Power Macintosh powerpc

Please note that it doesn't bomb after -lpq , as it would if it were an unreadable/invalid library name 

xpi@ryoku:mutilities>make test                                             <xpi
gcc -O -pipe  -Wall -g -Dbugs -I/Users/xpi/tmpsrc/lib/mutilities  -L/Users/xpi/tmpsrc/lib/mutilities -Dpthreads -Ddarwin -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq -lpq   mutil.o maintest.c
ld: Undefined symbols:
_PQclear
_PQerrorMessage
_PQsetdbLogin
...
_PQstatus
*** Error code 1

just to make life difficult for my typo's:
root@ryoku:lib>nm libpq.a |  grep _PQclear                                <root
	 U _PQclear
000006a0 T _PQclear
  	 U _PQclear
root@ryoku:lib>pwd                                                        <root /usr/local/pgsql/lib



thank you for your time,
>ash 



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Darwin libpq link failing
  2003-02-27 04:40 Darwin libpq link failing ash <xpi@aeria.net>
@ 2003-03-02 17:48 ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-03-07 04:06   ` Re: Darwin libpq link failing Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2003-03-02 17:48 UTC (permalink / raw)
  To: ash <xpi@aeria.net>; +Cc: pgsql-interfaces

ash <xpi@aeria.net> writes:
> gcc -O -pipe  -Wall -g -Dbugs -I/Users/xpi/tmpsrc/lib/mutilities  -L/Users/xpi/tmpsrc/lib/mutilities -Dpthreads -Ddarwin -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq -lpq   mutil.o maintest.c
> ld: Undefined symbols:
> _PQclear
> _PQerrorMessage
> _PQsetdbLogin

Surely the library reference must come after the files that reference
it.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Darwin libpq link failing
  2003-02-27 04:40 Darwin libpq link failing ash <xpi@aeria.net>
  2003-03-02 17:48 ` Re: Darwin libpq link failing Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-03-07 04:06   ` Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2003-03-07 04:06 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: ash <xpi@aeria.net>; pgsql-interfaces

Tom Lane wrote:
> ash <xpi@aeria.net> writes:
> > gcc -O -pipe  -Wall -g -Dbugs -I/Users/xpi/tmpsrc/lib/mutilities  -L/Users/xpi/tmpsrc/lib/mutilities -Dpthreads -Ddarwin -I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq -lpq   mutil.o maintest.c
> > ld: Undefined symbols:
> > _PQclear
> > _PQerrorMessage
> > _PQsetdbLogin
> 
> Surely the library reference must come after the files that reference
> it.

Right.  Some linkers seem to do reordering themselves, while others
require the ordering to be specified in the proper dependency order;  I
prefer a linker that doesn't do any reordering itself --- it can lead to
surprises and doesn't handle well cases where the same symbol is defined
in multiple libraries.

-- 
  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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-03-07 04:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-27 04:40 Darwin libpq link failing ash <xpi@aeria.net>
2003-03-02 17:48 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-03-07 04:06   ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox