This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Static linking issue under cygwin.


Hello!

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'
/cygdrive/c/DOCUME~1/vap/LOCALS~1/Temp/cclXAlCk.o:pgtest.c:(.text+0x78):
undefined reference to `_PQstatus'
/cygdrive/c/DOCUME~1/vap/LOCALS~1/Temp/cclXAlCk.o:pgtest.c:(.text+0x8c):
undefined reference to `_PQerrorMessage'
/cygdrive/c/DOCUME~1/vap/LOCALS~1/Temp/cclXAlCk.o:pgtest.c:(.text+0xc5):
undefined reference to `_PQfinish'
/cygdrive/c/DOCUME~1/vap/LOCALS~1/Temp/cclXAlCk.o:pgtest.c:(.text+0xd9):
undefined reference to `_PQfinish'
collect2: ld returned 1 exit status

The library is at place and has those symbols defined

$ nm /cygdrive/c/Program\ Files/PostgreSQL/8.2/lib/libpq.a | egrep
'(_PQconnectdb|_PQstatus|_PQerrorMessage|_PQfinish)'
00000000 T _PQstatus
00000000 I __imp__PQstatus
00000000 T _PQfinish
00000000 I __imp__PQfinish
00000000 T _PQerrorMessage
00000000 I __imp__PQerrorMessage
00000000 T _PQconnectdb
00000000 I __imp__PQconnectdb

This libpq.a is from PostgreSQL 8.2.9 distribution for win32.
My cygcheck.out is in the attachment.

The similar problem is also reproducible at the another PC with
different Cygwin installation and with different set of libraries
(opengl-1.1.0-10 and freeglut-2.4.0-1) that in this case are part of
the Cygwin distribution and were installed via standard Cygwin setup
program. For details see attached fly-cubes-cygcheck.out and
fly-cubes-link-failure.out. Most strange thing that belongs to this
issue is that this sources could be successfully linked with the same
package about one month ago, but after some day it became broken
without any sight cause because Cygwing installation had never been
changed.

Does anybody knows why this happens and how to solve this?

Any help will be very appreciated.
Thank you.
---
/vap/

Attachment: cygcheck.out
Description: Binary data

Attachment: fly-cubes-cygcheck.out
Description: Binary data

Attachment: fly-cubes-link-failure.out
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]