LibreOffice driver 3: pg_config and linking statically to libpq

From: Lionel Elie Mamane <lionel(at)mamane(dot)lu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: LibreOffice driver 3: pg_config and linking statically to libpq
Date: 2011-12-13 11:05:25
Message-ID: 20111213110525.GB16515@capsaicin.mamane.lu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(See part 1 for general introduction)

LibreOffice currently - when it rebuilds libpq, such as for most of
our official binaries - links statically against libpq.

I noticed that pg_config does not give the information of what
additional libraries to include in the link to resolve all symbols
that libpq needs:

* On the one hand, it gives too much since LIBS is filtered to only a
subset in src/interface/libpq/Makefile.

* On the other hand, it does not give enough, since it does not give
the value of LDAP_LIBS_FE anywhere, nor say if it is necessary to
add PTHREAD_LIBS.

This is not an immediate problem for LibreOffice: I export the value
of SHLIB_EXPORTS from src/interface/libpq/Makefile as a Makefile
snippet that gets imported in our build system or (on Microsoft
Windows) we just proceeded by "trial and error" until the link
succeeds.

However, I suggest it would be cleaner to give that kind of
information in pg_config, so that one can basically do something like:

$LINK_COMMAND -lpq $(pg_config --libpq-dep-libs)

and have it work automatically. You could also provide a pq.pc file
for pkgconfig, which would give nice nearly-automatic integration for
projects using e.g. autoconf and friends.

--
Lionel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shigeru Hanada 2011-12-13 11:44:04 Re: pgsql_fdw, FDW for PostgreSQL server
Previous Message Heikki Linnakangas 2011-12-13 11:04:18 Re: pgsql_fdw, FDW for PostgreSQL server