Re: postgres.h - Mailing list pgsql-cygwin

From Jason Tishler
Subject Re: postgres.h
Date
Msg-id 20031105160619.GD1792@tishler.net
Whole thread Raw
In response to Re: postgres.h  ("Nupur Pande" <npande@vt.edu>)
List pgsql-cygwin
Nupar,

On Tue, Nov 04, 2003 at 01:28:06PM -0500, Nupur Pande wrote:
> Thanks a lot..

You are welcome.

> that did work.

Good.

> Did I do something wrong?

Yes and no.

> I'm trying to create a .so file. My makefile looks like this:
                         ^^^

Under Cygwin (i.e., Windows), you should create .dll files instead.

> all: RuleFinder.so
>
> RuleFinder.so: RuleFinder.o
>         gcc -shared -o RuleFinder.so RuleFinder.o
>
> RuleFinder.o: <files>
>         gcc -I /usr/include/postgresql/server -fpic -c RuleFinder.c
                                                ^^^^^

The -fpic options is unnecessary under Cygwin.

> gcc -shared -o RuleFinder.so RuleFinder.o
> RuleFinder.o(.text+0x16c1):RuleFinder.c: undefined reference to `_SPI_exec'
> [snip]

You are missing the "-lpostgres" option (and possibly the associated
"-L" option too) on the link command line.  Unfortunately, the binary
package does *not* contain libpostgres.a.  This is because the other
Unix platforms do not have such a file.  Sigh...

The short-term workaround is to download the PostgreSQL source and build
libpostgres.a yourself.  I need to think about the long-term solution...

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

pgsql-cygwin by date:

Previous
From: "Emanuele"
Date:
Subject: Re: Problems with InitDB
Next
From: Jason Tishler
Date:
Subject: Re: postgres.h