Re: Fwd: 8.3.3 compile fails on Mac OS X 10.5.2

From: "Randall Lucas" <rlucas(at)tercent(dot)com>
To:
Cc: pgsql-ports(at)postgresql(dot)org
Subject: Re: Fwd: 8.3.3 compile fails on Mac OS X 10.5.2
Date: 2008-07-01 22:36:12
Message-ID: 7d5145af0807011536j697a6dc9mb52d89bdd804231e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports

On Fri, Jun 27, 2008 at 7:58 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 ...

In response to

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Tom Lane 2008-07-02 02:50:36 Re: Fwd: 8.3.3 compile fails on Mac OS X 10.5.2
Previous Message Tom Lane 2008-06-28 02:58:04 Re: Fwd: 8.3.3 compile fails on Mac OS X 10.5.2