Thread: apr integration

apr integration

From
Bob Rossi
Date:
Hi,

Apr allows the use of the wonderful postgresql db. It has an autotools
test that checks to see if it can link against -lpq. However, checking
against just -lpq is not always enough. On linux, sometimes you need
'-lpq -lcrypt'. On windows, sometimes you need '-lpq -lSecur32 -lws_32'.

So, my question is, how does one figure out the required libraries? I
suggested pg_config --libs on the apr mailing list, and someone had this
to say:
  This returns libraries that were used to build PostgreSQL, not the ones
  that are required to link to -lpq. So, I'm just worried that it is
  inaccurate.

Could you please comment on this?

Thanks,
Bob Rossi

Re: apr integration

From
Peter Eisentraut
Date:
Am Montag, 19. Mai 2008 schrieb Bob Rossi:
> Apr allows the use of the wonderful postgresql db. It has an autotools
> test that checks to see if it can link against -lpq. However, checking
> against just -lpq is not always enough. On linux, sometimes you need
> '-lpq -lcrypt'. On windows, sometimes you need '-lpq -lSecur32 -lws_32'.

I don't know about Windows, but on Linux -lpq should always be enough (unless
you are linking statically).  Everything else would seem to be a bug.

> So, my question is, how does one figure out the required libraries? I
> suggested pg_config --libs on the apr mailing list, and someone had this
> to say:
>   This returns libraries that were used to build PostgreSQL, not the ones
>   that are required to link to -lpq. So, I'm just worried that it is
>   inaccurate.
>
> Could you please comment on this?

I suppose you got the above information from Tollef Fog Heen, after I
discussed the issue with him in the Debian BTS.  I agree, however, the the
purpose of the pg_config options may be confusing or badly documented.

Re: apr integration

From
Bob Rossi
Date:
On Tue, May 20, 2008 at 12:01:32AM +0200, Peter Eisentraut wrote:
> Am Montag, 19. Mai 2008 schrieb Bob Rossi:
> > Apr allows the use of the wonderful postgresql db. It has an autotools
> > test that checks to see if it can link against -lpq. However, checking
> > against just -lpq is not always enough. On linux, sometimes you need
> > '-lpq -lcrypt'. On windows, sometimes you need '-lpq -lSecur32 -lws_32'.
>
> I don't know about Windows, but on Linux -lpq should always be enough (unless
> you are linking statically).  Everything else would seem to be a bug.

Yup, linking statically.

> > So, my question is, how does one figure out the required libraries? I
> > suggested pg_config --libs on the apr mailing list, and someone had this
> > to say:
> >   This returns libraries that were used to build PostgreSQL, not the ones
> >   that are required to link to -lpq. So, I'm just worried that it is
> >   inaccurate.
> >
> > Could you please comment on this?
>
> I suppose you got the above information from Tollef Fog Heen, after I
> discussed the issue with him in the Debian BTS.  I agree, however, the the
> purpose of the pg_config options may be confusing or badly documented.

No, well maybe. I got this information from an apr developer. I just
forwarded his concern here, to see if his concern made sense.

Bob Rossi

Re: apr integration

From
Tom Lane
Date:
Bob Rossi <bob_rossi@cox.net> writes:
> On Tue, May 20, 2008 at 12:01:32AM +0200, Peter Eisentraut wrote:
>> I don't know about Windows, but on Linux -lpq should always be enough (unless
>> you are linking statically).  Everything else would seem to be a bug.

> Yup, linking statically.

Do you have a really good reason for doing that?  Just about every
distro nowadays strongly discourages static linking, because it makes
it so painful to deal with bug or security fixes in libraries.  (Red Hat
won't even distribute static libraries except in some special cases,
and libpq definitely isn't one of the exceptions.)

            regards, tom lane

Re: apr integration

From
Bob Rossi
Date:
On Mon, May 19, 2008 at 08:30:46PM -0400, Tom Lane wrote:
> Bob Rossi <bob_rossi@cox.net> writes:
> > On Tue, May 20, 2008 at 12:01:32AM +0200, Peter Eisentraut wrote:
> >> I don't know about Windows, but on Linux -lpq should always be enough (unless
> >> you are linking statically).  Everything else would seem to be a bug.
>
> > Yup, linking statically.
>
> Do you have a really good reason for doing that?  Just about every
> distro nowadays strongly discourages static linking, because it makes
> it so painful to deal with bug or security fixes in libraries.  (Red Hat
> won't even distribute static libraries except in some special cases,
> and libpq definitely isn't one of the exceptions.)

I'm linking a commercial application. It was thought to be more
convienent to use static libraries for deplyoment purposes. What do you
think?

Bob Rossi

Re: apr integration

From
Peter Eisentraut
Date:
Am Dienstag, 20. Mai 2008 schrieb Bob Rossi:
> On Tue, May 20, 2008 at 12:01:32AM +0200, Peter Eisentraut wrote:
> > Am Montag, 19. Mai 2008 schrieb Bob Rossi:
> > > Apr allows the use of the wonderful postgresql db. It has an autotools
> > > test that checks to see if it can link against -lpq. However, checking
> > > against just -lpq is not always enough. On linux, sometimes you need
> > > '-lpq -lcrypt'. On windows, sometimes you need '-lpq -lSecur32
> > > -lws_32'.
> >
> > I don't know about Windows, but on Linux -lpq should always be enough
> > (unless you are linking statically).  Everything else would seem to be a
> > bug.
>
> Yup, linking statically.

Well, if you are linking statically, you might as well refer to
pg_config --libs, or any other infinite list of libraries you can dream of.
The main reason why this is discouraged for dynamic linking is that this
creates unnecessary package dependencies.  But for static linking, it sounds
OK to me.  I guess we have never really bothered to carefully specify the
static case.