Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Windows static link





On Feb 7, 2008, at 3:09 PM, Israel Brewster wrote:

Ok, now that I got everything working on the Mac side of things, I am moving on to windows, and, naturally, running into problems. Specifically, I downloaded the PostgreSQL installer from the win32 directory and installed it on my windows 2000 box, making sure to select the development libraries. This installed lib, bin, and include directories on my drive as expected. So far, so good.

Next I tried to use those libraries to make a static build of the Qt development tools, making sure to specify the -I <postgres include path>, -l pq, and -L <postgres lib path> command line switches. The first error I ran into was "unable to locate file for -lpq". After some googling, I came across this page ( http://www.rag.com.au/linux/qt4howto.html ), with instructions on using reimp and dlltool on the libmysql.lib and mysql.dll files to produce a .a file. I tried the same procedure on the libpq.lib and libpq.dll files, which did produce a .a file and eliminate the "unable to locate file" error, but perhaps this was wrong?

At any rate, while this did allow the configure and make command to run through normally, the make install (which actually does quite a bit of compiling itself) command failed with multiple "undefined reference to PQ<xyz>" errors. Judging by the PQ prefix on all of the functions, it would appear to me that they are PostgreSQL related, and that as such the postgreSQL library is not functioning properly. Given the procedure I went through to get the build to recognize the library at all, I'm not surprised, but if someone could help me fix it, it would be appreciated. Thanks!

Ok, I managed to figure out how to compile PostgreSQL from source, and did so using the --disable-shared and --without-zlib flags to configure. This produced a libpq.a file that was somewhat larger than the one produced by my previous attempts, which seems promesing to me. However, make (or skiiping make and just doing make install, as the instructions I found said) failed with the following output:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline - Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing pg_ctl.o win32ver.o -L../../../src/port -lpgport -L../../../src/ interfaces/libpq -lpq -L../../../src/port -Wl,--allow-multiple- definition -lpgport -lm -lws2_32 -lshfolder -o pg_ctl.exe ../../../src/interfaces/libpq/libpq.a(fe-connect.o)(.text+0x6dc):fe- connect.c: undefined reference to `DeleteSecurityContext(at)4' ../../../src/interfaces/libpq/libpq.a(fe-connect.o)(.text+0x704):fe- connect.c: undefined reference to `FreeCredentialsHandle(at)4' ../../../src/interfaces/libpq/libpq.a(fe-auth.o)(.text+0x195):fe- auth.c: undefined reference to `InitializeSecurityContextA(at)48' ../../../src/interfaces/libpq/libpq.a(fe-auth.o)(.text+0x21b):fe- auth.c: undefined reference to `FreeContextBuffer(at)4' ../../../src/interfaces/libpq/libpq.a(fe-auth.o)(.text+0x293):fe- auth.c: undefined reference to `FreeContextBuffer(at)4' ../../../src/interfaces/libpq/libpq.a(fe-auth.o)(.text+0x326):fe- auth.c: undefined reference to `AcquireCredentialsHandleA(at)36'
collect2: ld returned 1 exit status
make[3]: *** [pg_ctl] Error 1
make[2]: *** [install] Error 2
make[1]: *** [install] Error 2
make: *** [install] Error 2


Also, though libpq.a was generated, when attempting to build an application that uses it I get numerous errors similar to the ones I got when building libpq, such as:

D:\msys\1.0\local\pgsql\lib/libpq.a(fe-connect.o)(.text+0x3dc):fe- connect.c: undefined reference to 'WSAStartup(at)8'

referencing various .0 and .c files and symbols.

How can I make this work? Thanks!

-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------


-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
     choose an index scan if your joining column's datatypes do not
     match




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group