Skip Menu |
 

From: Gilles Espinasse <g.esp@free.fr>
To: krb5-bugs@mit.edu
Subject: [PATCH] krb5 fix make check dbtest linking error
Date: Thu, 30 May 2013 23:03:35 +0200
CC: Gilles Espinasse <g.esp@free.fr>
/usr/bin/ld: warning: libkrb5support.so.0, needed by ../libdb.so, not found (try using -rpath or -rpath-link)
collect2: ld returned 1 exit status
make[3]: *** [dbtest] Error 1

So link to libkrb5support in the same time as libdb
Tested to work with both builtin crypto and openssl

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
---
src/plugins/kdb/db2/libdb2/test/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/kdb/db2/libdb2/test/Makefile.in b/src/plugins/kdb/db2/libdb2/test/Makefile.in
index 854d50d..c29e6f0 100644
--- a/src/plugins/kdb/db2/libdb2/test/Makefile.in
+++ b/src/plugins/kdb/db2/libdb2/test/Makefile.in
@@ -12,7 +12,7 @@ PROG_RPATH=$(KRB5_LIBDIR)

KRB5_RUN_ENV= @KRB5_RUN_ENV@

-DB_LIB = -ldb
+DB_LIB = -ldb -lkrb5support
DB_DEPLIB = ../libdb$(DEPLIBEXT)

all::
--
1.7.10.4
Just to confirm: this is a build with static libraries?
From: ghudson@mit.edu
Subject: git commit

Link dbtest with libkrb5support

In a static build, linking dbtest could fail on platforms where libdb2
depends on krb5support (platforms without a native mkstemp). Reported
by Gilles Espinasse <g.esp@free.fr>.

https://github.com/krb5/krb5/commit/ea20e248dc2ba4d843a1e536e649c901c1c3f5b2
Author: Greg Hudson <ghudson@mit.edu>
Commit: ea20e248dc2ba4d843a1e536e649c901c1c3f5b2
Branch: master
src/plugins/kdb/db2/libdb2/test/Makefile.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Date: Sun, 2 Jun 2013 15:52:33 +0200 (CEST)
From: Gilles Espinasse <g.esp@free.fr>
To: rt-comment@krbdev.mit.edu
Subject: Re: [krbdev.mit.edu #7651] [PATCH] krb5 fix make check dbtest linking error
RT-Send-Cc:
Download (untitled) / with headers
text/plain 1.7KiB


Show quoted text
----- Mail original -----
> De: "Greg Hudson via RT" <rt-comment@krbdev.mit.edu>
> Envoyé: Vendredi 31 Mai 2013 17:46:26
> Objet: [krbdev.mit.edu #7651] [PATCH] krb5 fix make check dbtest linking error
>
> Just to confirm: this is a build with static libraries?
>
I used for testing
./configure CPPFLAGS="-I/usr/include/et -I/usr/include/ss" --prefix=/usr --localstatedir=/var/lib --with-system-et --with-system-ss

and a second try adding --with-crypto-impl=openssl

The key point to have the linking issue with dbtest is that krb5 should not be already installed.
In case krb5 is not installed, the error happen even with a simple ./configure && make && make check
If krb5 is already installed, no error happen.

While testing, I find that 'make clean' job may be incomplete if first build use built-in {et,ss} and second use system {et,ss}.
To reproduce what I made
./configure && make
./configure CPPFLAGS="-I/usr/include/et -I/usr/include/ss" --with-system-et --with-system-ss && make clean && make

The error is
+ objlist=' prof_tree.so prof_file.so prof_parse.so prof_get.so prof_set.so prof_err.so prof_init.so'
+ gcc -shared -fPIC -Wl,-h,libprofile.so.1,--no-undefined -o libprofile.so.1.1 prof_tree.so prof_file.so prof_parse.so prof_get.so prof_set.so prof_err.so prof_init.so -Wl,--enable-new-dtags -Wl,-rpath -Wl,/usr/local/lib -L../../lib -lcom_err -lkrb5support -lresolv -Wl,--hash-style=gnu -Wl,--version-script binutils.versions
prof_err.so: In function `initialize_prof_error_table':
prof_err.c:(.text+0xa1): undefined reference to `_et_list'
collect2: ld returned 1 exit status
make[2]: *** [libprofile.so.1.1] Error 1

I needed that to workaround the issue:
find . \( -name '*.o' -o -name '*.so' \) -delete && make

I didn't feel the need to play with --disable-shared --enable-static.

Gilles
Thanks. Now that you point it out, it makes sense that the linker would
only look for libkrb5support in libdb.so's runtime path (which doesn't
include the build directory) in the absence of an explicit -lkrb5support.