[SSSD] [PATCH] tests: Link the simple access tests with -ldl

Jakub Hrozek jhrozek at redhat.com
Mon Apr 22 10:17:13 UTC 2013


On Mon, Apr 22, 2013 at 09:35:10AM +0200, Lukas Slebodnik wrote:
> On (19/04/13 21:24), Lukas Slebodnik wrote:
> >On (19/04/13 11:30), Jakub Hrozek wrote:
> >>Timo Aaltonen discovered that on Ubuntu the simple access tests fail
> >>with a linker error saying that dlopen and dlsym are not available. It
> >>seems that because we are linking to some files from
> >>src/providers/data_provider_*.c we need to also link with -ldl.
> >>
> >>Timo confirmed on IRC that this one-liner fixes the problem for him.
> >
> >>From a58c950b21056925f8a5ae46a6bb6ad5a951ef11 Mon Sep 17 00:00:00 2001
> >>From: Jakub Hrozek <jhrozek at redhat.com>
> >>Date: Fri, 19 Apr 2013 11:27:59 +0200
> >>Subject: [PATCH] tests: Link the simple access tests with -ldl
> >>
> >>---
> >> Makefile.am | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >>diff --git a/Makefile.am b/Makefile.am
> >>index 09056b5d9fec1d23213132940d11c312bcbfc23d..ef1802246226bd08826f028a784d80289b723d81 100644
> >>--- a/Makefile.am
> >>+++ b/Makefile.am
> >>@@ -1058,6 +1058,7 @@ simple_access_tests_CFLAGS = \
> >>     $(CHECK_CFLAGS) \
> >>     -DUNIT_TESTING
> >> simple_access_tests_LDADD = \
> >>+    -ldl \
> >>     $(SSSD_LIBS) \
> >>     $(CARES_LIBS) \
> >>     $(CHECK_LIBS) \
> >>-- 
> >>1.8.1.4
> >
> >Ack,
> >but add comment to git message, that upstream nspr 4.9 (http://www.mozilla.org/projects/nspr/)
> >removed -ldl and -lpthread from pkg-config file.
> >
> >BTW: sssd depends on nss and nss depends on nspr.
> >
> >LS
> 
> After reading this mail once more time. I find out, that my explanations was
> very briefly and maybe unintelligible.
> 
> In SSSD, we use functions dlopen and dlsym in two files
> src/providers/data_provider_be.c and src/providers/proxy/proxy_init.c. This is
> reason why we should explicitly link with -ldl also in simple_access-tests.
> 
> SSSD can be compiled with two crypto libraries
> nss(mozilla) or libcrypto(openssl). NSS has dependency nspr which depends on
> "libdl and libpthread"
> This is a reason why compilation of test did not failed even if -ldl was not
> explicitly added to simple_access_tests_LDADD. But libcrypto doesn't depend on
> libdl, so in this case compilation of tests will not be successful.
> 
> Upstream nspr 4.9 has two ways have to obtain metainformation about libraries
> pkg-config and own script nspr-config. First one doesn't show "-ldl and
> -lpthread" but second one show "-ldl and -lpthread"
> And this is a reason why Timo found this bug. Fedora has got patched version of
> nspr, but debian(ubuntu) hasn't got.
> 
> LS

Thank you, this is a really nice explanation. I used it to amend the
commit message. A new patch is attached.
-------------- next part --------------
>From 6ec3a6c2f3217abdfd11b22b4df8c4c0f2473663 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Fri, 19 Apr 2013 11:27:59 +0200
Subject: [PATCH] tests: Link the simple access tests with -ldl

In SSSD, we use dlopen() and dlsym() in two files
src/providers/data_provider_be.c and src/providers/proxy/proxy_init.c.
Hence we should explicitly link with -ldl also in simple_access-tests.

SSSD can be compiled with two crypto libraries nss or libcrypto. NSS has
dependency nspr which depends on "libdl and libpthread" This is a reason why
compilation of test did not fail even if -ldl was not explicitly added to
simple_access_tests_LDADD. But libcrypto doesn't depend on libdl, so in
this case compilation of tests will not be successful.

Upstream nspr 4.9 has two ways have to obtain metainformation about
libraries
pkg-config and own script nspr-config. First one doesn't list "-ldl"
"-lpthread" but second one lists both "-ldl" "-lpthread"

That's also why the Ubuntu maintainer found this bug -- Fedora has got
patched version of nspr, but Debian (Ubuntu) doesn't
---
 Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.am b/Makefile.am
index 09056b5d9fec1d23213132940d11c312bcbfc23d..ef1802246226bd08826f028a784d80289b723d81 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1058,6 +1058,7 @@ simple_access_tests_CFLAGS = \
     $(CHECK_CFLAGS) \
     -DUNIT_TESTING
 simple_access_tests_LDADD = \
+    -ldl \
     $(SSSD_LIBS) \
     $(CARES_LIBS) \
     $(CHECK_LIBS) \
-- 
1.8.1.4



More information about the sssd-devel mailing list