Building proper static library libpq.a

From: Jeroen Ooms <jeroen(dot)ooms(at)stat(dot)ucla(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Building proper static library libpq.a
Date: 2015-02-09 19:53:56
Message-ID: CABFfbXvONEKE2Bpnbfm5=f3fVVLpv6jLVUAhF7iGoWN7a_EeRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am working on bindings to libpq for the R programming language. For
windows I need to build libpq.a as a standalone static library (using
mingw-w64) that I can link into the client application. I have done
this for many other libraries (e.g. libmariadbclient) but I am having
difficulty generating a static library for libpq.

So the goal is to create a version of libpq.a that I can link to my
application together with libssl.a, libz.a, etc, and which does not
depend on external postgresql shared libraries:

g++ -s -static-libgcc -o rpq.dll myapp.o -lpq -lssl -lcrypto -lgdi32
-lz -lws2_32

However by default the libpq.a gets built as a 99kb import library
that depends on libpq.dll (which depends on several other dll's...).
What I need is a static version of libpq.a (or perhaps multiple static
libraries) including the full implementation of libpq.

Based on some posts in the mailing list archives I tried using:

--disable-shared --enable-static=libpq

However with no luck:

configure: WARNING: unrecognized options: --disable-shared, --enable-static

Is there something I can pass to configure to create the full libpq
static library?

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-02-09 19:58:40 Re: Cluster seems broken after pg_basebackup
Previous Message Guillaume Drolet 2015-02-09 18:39:24 Re: Cluster seems broken after pg_basebackup