Static linking issue under cygwin.

Tim Prince
Sat May 23 19:30:00 GMT 2009

Vladimir A. Petrov wrote:

> I've faced with strange static linking issue in Cygwin environment.
> Trivial C program can not be linked against PostgreSQL libpq with the
> following diagnostics:
> $ gcc -Wall -I /cygdrive/c/Program\ Files/PostgreSQL/8.2/include/ -L
> /cygdrive/c/Program\ Files/PostgreSQL/8.2/lib -lpq -o pgtest.exe
> pgtest.c
> /cygdrive/c/DOCUME~1/vap/LOCALS~1/Temp/cclXAlCk.o:pgtest.c:(.text+0x33):
> undefined reference to `_PQconnectdb'
Not strange, when gnu ld depends on order of libraries for static linking.
 ld doesn't rescan libraries when new references are added after the scan.
 It's strange enough to attempt to link libraries installed under "Program

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list