link errors building extensions for Postgres on Windows using MinGW

From: Eric Davies <Eric(at)barrodale(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: link errors building extensions for Postgres on Windows using MinGW
Date: 2005-07-27 19:59:22
Message-ID: 6.1.0.6.0.20050727111108.01bb3a18@marilyn.barrodale.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to port an extension that previously ran under Postgres on linux
so that it runs under PostgreSQL 8.0.3 on Windows. I'm using MingGW for the
compiling/linking.

I'm getting problems when I try to link though. Symbols that are defined in
the Postgres server and referenced in my extension cause link errors that
prevent a dll from being produced.
fe-giefToGrid.c:25: undefined reference to `pg_detoast_datum'

fe-udr.c:510: undefined reference to `Float8GetDatum'

libgridfrontendDEBUG.a(fe-udr.o)(.text+0xbe7):fe-udr.c:515: undefined
reference to `get_typlenbyvalalign'

I can get rid of these link errors by linking in the libpostgres.a file
at the cost of a much larger shared library. In theory, I shouldn't need to
though (at least I don't under linux), and doing so may result in two
inconsistent copies of some Postgres internal data structures presumably.
My link line looks like:

gcc -u_etext -shared -fpic -Wl,--whole-archive -o destDir/Grid.dll
-Lmylibdir -L/lib -L/c/Program\ Files/PostgreSQL/8.0/lib -lmylibs
-Wl,--no-whole-archive -lpostgres -lwsock32 -lm 2> link.errs

can anyone suggest a solution?

Thank you,

**********************************************
Eric Davies, M.Sc.
Barrodale Computing Services Ltd.
Tel: (250) 472-4372 Fax: (250) 472-4373
Web: http://www.barrodale.com
Email: eric(at)barrodale(dot)com
**********************************************
Mailing Address:
P.O. Box 3075 STN CSC
Victoria BC Canada V8W 3W2

Shipping Address:
Hut R, McKenzie Avenue
University of Victoria
Victoria BC Canada V8W 3W2
**********************************************

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2005-07-27 20:13:26 MySQL to PostgreSQL, was ENUM type
Previous Message Bruno Wolff III 2005-07-27 19:55:33 Re: DELETE with JOIN syntax