From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Johnny Yan <jyan@tableau.com>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Statically linking against libpq
Date: Thu, 7 Jul 2016 00:06:21 +0300
Message-ID: <e1200439-c336-0d60-e384-ee86941dd551@iki.fi> (raw)
In-Reply-To: <BY2PR0301MB0663575831098F228A35528BC33A0@BY2PR0301MB0663.namprd03.prod.outlook.com>
References: <BY2PR0301MB0663575831098F228A35528BC33A0@BY2PR0301MB0663.namprd03.prod.outlook.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
On 07/06/2016 11:01 PM, Johnny Yan wrote:
> Hi,
>
> We're building the postgres odbc driver by ourselves for our
> customers on Linux. It builds against hence depends on libpq.so.
> We're wondering if there is a secret configure flag to statically
> link against libpq such that the final psqlodbcw.so has less
> dependencies and in particular doesn't depend on libpq.so.
There's no such flag, currently.
One option is to create a temporary installation of libpq, with just the
static library. The linker will use the static library, if it can't find
a shared one. Something along the lines of:
mkdir static-libpq
mkdir static-libpq/lib
ln -s `pg_config --libdir`/libpq.a static-libpq/lib/libpq.a
ln -s `pg_config --includedir` static-libpq/include
./configure --with-libpq=static-libpq ...
Assuming your libpq is built with OpenSSL, though, you'll also need to
pass LDFLAGS="-lssl -lcrypto" to make the configure test pass. The
resulting ODBC driver will still need libssl and libcrypto as shared
libraries, if built that way.
There might be a more straightforward way to do that, with suitable
linked flags, but I don't know how.
> Also if there is no such config flag yet, are you guys planning to
> add one?
No such plans. If you want to write a patch, and it's not too
complicated, I wouldn't mind adding it, thouhg.
- Heikki
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: hlinnaka@iki.fi, jyan@tableau.com
Subject: Re: Statically linking against libpq
In-Reply-To: <e1200439-c336-0d60-e384-ee86941dd551@iki.fi>
References: <BY2PR0301MB0663575831098F228A35528BC33A0@BY2PR0301MB0663.namprd03.prod.outlook.com> <e1200439-c336-0d60-e384-ee86941dd551@iki.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox