pg.ddx.io  pgsql-ports@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Randall Lucas <rlucas@tercent.com>
Cc: pgsql-ports@postgresql.org
Subject: Re: Fwd: 8.3.3 compile fails on Mac OS X 10.5.2
Date: Tue, 1 Jul 2008 15:36:12 -0700
Message-ID: <7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com> (raw)
In-Reply-To: <16462.1214621884@sss.pgh.pa.us>
References: <7d5145af0806271608m3299b0dds5018975839b0f6ad@mail.gmail.com>
	<7d5145af0806271608m6e880c31vca63d8833eeae26d@mail.gmail.com>
	<16462.1214621884@sss.pgh.pa.us>

On Fri, Jun 27, 2008 at 7:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> I'm thinking maybe you have old or broken PG shared libraries
> in that directory that're messing up the link.

Thanks for having a look.  As you'll see below, that was a red
herring.  Apologies for the long email, but I want to include as much
search-engine bait as possible for folks with the same problem.

I dug in a bit more.  It turns out that the Apple process of
transferring my data over from my old box transferred my
Fink-installed UNIX apps, including PostgreSQL 8.1.  So I *do* have an
old set of libraries installed in /sw/lib/postgresql-8.1

I manually went into src/Makefile.global and changed LDFLAGS (the
source of the duplicate "-L/sw/lib" entry) to blank.  (I couldn't seem
to get configure to do so.)

The result is below.  No more -L/sw/lib in the gcc command line that
barfs, but the same error message comes out:

gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Winline -Wdeclaration-after-statement -Wendif-labels
-fno-strict-aliasing -fwrapv   -dynamiclib -install_name
/usr/local/pgsql-8.3/lib/libecpg.6.dylib -compatibility_version 6
-current_version 6.0 -exported_symbols_list exports.list
-multiply_defined suppress  execute.o typename.o descriptor.o data.o
error.o prepare.o memory.o connect.o misc.o path.o pgstrcasecmp.o
thread.o -L../pgtypeslib -L../../../../src/interfaces/libpq
-L../../../../src/port -lpgtypes -lpq -lm  -o libecpg.6.0.dylib
Undefined symbols:
  "_PGTYPESdate_from_asc", referenced from:
      _ecpg_get_data in data.o
      _ecpg_get_data in data.o
  "_PQfinish", referenced from:
      _ecpg_finish in connect.o
  "_PQsetdbLogin", referenced from:
      _ECPGconnect in connect.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[4]: *** [libecpg.6.0.dylib] Error 1
make[3]: *** [all] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

So then I started digging in and poking around the actual makefiles.
It looks like the symbols that data.c is referencing come from
src/interfaces/ecpg/pgtypeslib

The file exports.list in src/interfaces/ecpg/pgtypeslib does NOT
contain the missing symbol _PGTYPESdate_from_asc

I checked the output of make, and this line caught my eye:

awk '/^[^#]/ {printf "_%s\n",$1}' exports.txt >exports.list

This should be dumping out any the first word of any line that doesn't
start with a # to exports.list, prepended with "_", right?

Well, as it turns out, lines 1-2 of exports.txt are comments, and
lines 3-11 look like:

PGTYPESdate_dayofweek           1
PGTYPESdate_defmt_asc           2
PGTYPESdate_fmt_asc             3
PGTYPESdate_free                4
PGTYPESdate_from_asc            5
PGTYPESdate_from_timestamp      6
PGTYPESdate_julmdy              7
PGTYPESdate_mdyjul              8
PGTYPESdate_new                 9

(Note the presence of our missing symbol, date_from_asc)

All of these first nine symbols are missing from my copy of
exports.list!  (The rest of the symbols, 10-n, appear fine.)

Sure enough, one of the other offenders -- PQfinish -- is present in
the first nine symbols in src/interfaces/libpq/exports.txt but missing
from src/interfaces/libpq/exports.list

Could it be that my awk is buggy or not playing nice?

$ which awk
/sw/bin/awk
$ ls -al /sw/bin/awk
lrwxr-xr-x  1 root  admin  4 Jun 19 18:50 /sw/bin/awk -> gawk
$ awk -W version
GNU Awk 3.1.4

I also have a system awk in /usr/bin/awk, but my $PATH (using standard
Fink init.sh practice of prepending) puts /sw/bin first.

It appears that PG knows that I have gawk:

$ grep 'awk' config.log
configure:5084: checking for gawk
configure:5100: found /sw/bin/gawk
configure:5110: result: gawk
ac_cv_prog_AWK=gawk
AWK='gawk'

When I blow away /sw/bin/awk, so that make uses /usr/bin/awk instead,
I get a make that executes perfectly and a make check with "All 114
tests passed."

So, at least for now, my problem is solved.  But I remain very much
puzzled.  Does anyone here know if my gawk is behaving properly?  (I
tried it with both --compat and --posix flags to see if that fixed the
behavior; no effect.)  And if it is, and PG knows that gawk behaves
that way and detected it, shouldn't the PG makefile have adapted its
awk invocation to use the gawk syntax?

Comments are most welcome here before I move over to the GNU awk list
and start accusing pretty much the oldest program in existence of
being broken ...



view thread (9+ messages)  latest in thread

Message-ID: <7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com>
Permalink:  ../7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com/
Also on:    postgresql.org/message-id/7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-ports@postgresql.org
  Cc: rlucas@tercent.com
  Subject: Re: Fwd: 8.3.3 compile fails on Mac OS X 10.5.2
  In-Reply-To: <7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com>
  References: <7d5145af0806271608m3299b0dds5018975839b0f6ad@mail.gmail.com> <7d5145af0806271608m6e880c31vca63d8833eeae26d@mail.gmail.com> <16462.1214621884@sss.pgh.pa.us> <7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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