Re: patch to fix configure(.in) on openbsd wrt/ krb5/com_err and readline linking

From: Simon Bertrang <janus(at)errornet(dot)de>
To: Greg Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: patch to fix configure(.in) on openbsd wrt/ krb5/com_err and readline linking
Date: 2009-06-10 15:07:18
Message-ID: 20090610150717.GE20455@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jun 10, 2009 at 02:19:30PM +0100, Greg Stark wrote:
> On Wed, Jun 10, 2009 at 10:25 AM, Simon Bertrang<janus(at)errornet(dot)de> wrote:
> >
> > the following patch does two things on OpenBSD:
>
> Thank you.
>
>
> >  1) Add missing libs to the krb5/com_err check that are required.
> >    We have this in our ports tree since 7.4.3 but i can't find any
> >    report about it, so here it finally is.
>
> This seems really weird. Firstly, doesn't OpenBSD use ELF? Shouldn't
> the library pull in the indirectly needed libraries automatically? But
> more to the point, why on *earth* would com_err depend on -lssl and
> -lcrypto? com_err is just a standard error handling library. Why
> would it fail to link without ssl and crypto libraries?!?!
>

We do use ELF on most arches. Those few who don't, aren't relevant to
the discussion nor a good choice to run a database on.
Anyway, the reason why our com_err depends on libssl and libcrypto is
because it is linked into libkrb5; libcom_err is just a link to libkrb5:

$ ls -il /usr/lib/libkrb5.so.16.0 /usr/lib/libcom_err.so.16.0
1117313 -r--r--r-- 4 root bin 5427316 Apr 18 18:57 /usr/lib/libcom_err.so.16.0
1117313 -r--r--r-- 4 root bin 5427316 Apr 18 18:57 /usr/lib/libkrb5.so.16.0

> If it is necessary, putting in an "if portname = openbsd" is defeating
> the whole purpose of using autoconf here. Surely something like
>
>    AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'
> 'com_err' 'com_err -lssl -lcrypto'], [],
>
> would be better since it would detect this situation regardless of
> what OS it's on.
>

Makes sense to me even though i'm (obviously) no autoconf expert;
updated diff below.

Regards,
Simon

Index: configure.in
===================================================================
RCS file: /projects/cvsroot/pgsql/configure.in,v
retrieving revision 1.597
diff -u -p -r1.597 configure.in
--- configure.in 19 May 2009 22:32:41 -0000 1.597
+++ configure.in 10 Jun 2009 15:04:31 -0000
@@ -913,7 +913,7 @@ fi

if test "$with_krb5" = yes ; then
if test "$PORTNAME" != "win32"; then
- AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err], [],
+ AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' com_err 'com_err -lssl -lcrypto'], [],
[AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
[AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
@@ -1788,7 +1788,9 @@ if test "$with_readline" = yes; then
else
link_test_func=exit
fi
-if test "$PORTNAME" != "darwin"; then
+if test "$PORTNAME" = "openbsd"; then
+ PGAC_PROG_CC_LDFLAGS_OPT([-Wl,-Bdynamic], $link_test_func)
+elif test "$PORTNAME" != "darwin"; then
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func)
else
# On Darwin it's spelled -Wl,-dead_strip_dylibs, but don't try that elsewhere

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Stark 2009-06-10 15:13:06 Re: patch to fix configure(.in) on openbsd wrt/ krb5/com_err and readline linking
Previous Message Dhaval Jaiswal 2009-06-10 15:02:45 Re: to_timestamp error handling.