Darwin libpq link failing
Darwin libpq link failing
От:
ash <xpi@aeria.net>
Дата:
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 uname -a make test nm libpq.a | grep _PQclear pwd ash
Re: Darwin libpq link failing
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
ash 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
Re: Darwin libpq link failing
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Tom Lane wrote: > ash 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