Patchwork [3/3] gnutls: link against 'dl' library

login
register
mail settings
Submitter Otavio Salvador
Date June 1, 2011, 8:09 p.m.
Message ID <ddcfd950f58f85e00b0ea094534f27ccf1315152.1306958862.git.otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/5261/
State New, archived
Headers show

Comments

Otavio Salvador - June 1, 2011, 8:09 p.m.
Fixes a build failure due missing references to 'dlopen' and
like. This started to happen after update to 2.12.5 at
ad52eacebdc413aa351de078ee878182a9c71e16. This also fixes the recipe
to use the INC_PR value otherwise we end not bumping PR if changing
only the '.inc' file.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/recipes-support/gnutls/gnutls.inc       |    4 +++-
 meta/recipes-support/gnutls/gnutls_2.12.5.bb |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
Phil Blundell - June 1, 2011, 8:33 p.m.
On Wed, 2011-06-01 at 20:09 +0000, Otavio Salvador wrote:
> +export LDFLAGS += "-ldl"

The configure script ought to be figuring this out for itself.  Do you
know why that isn't working?

p.
Otavio Salvador - June 1, 2011, 8:39 p.m.
On Wed, Jun 1, 2011 at 20:33, Phil Blundell <pb@pbcl.net> wrote:
> On Wed, 2011-06-01 at 20:09 +0000, Otavio Salvador wrote:
>> +export LDFLAGS += "-ldl"
>
> The configure script ought to be figuring this out for itself.  Do you
> know why that isn't working?

No I don't.

Are you able to reproduce it?
Phil Blundell - June 1, 2011, 8:53 p.m.
On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
> On Wed, Jun 1, 2011 at 20:33, Phil Blundell <pb@pbcl.net> wrote:
> > On Wed, 2011-06-01 at 20:09 +0000, Otavio Salvador wrote:
> >> +export LDFLAGS += "-ldl"
> >
> > The configure script ought to be figuring this out for itself.  Do you
> > know why that isn't working?
> 
> No I don't.
> 
> Are you able to reproduce it?

No, it works fine for me.  I get:

checking how to link with libpthread... -lpthread
checking for libdl... yes
checking how to link with libdl... -ldl
checking whether we are using the GNU C++ compiler... yes

This is with the current head of oe-core on qemuarm.

p.
Otavio Salvador - June 1, 2011, 9 p.m.
On Wed, Jun 1, 2011 at 20:53, Phil Blundell <pb@pbcl.net> wrote:
> On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
>> Are you able to reproduce it?
>
> No, it works fine for me.  I get:
>
> checking how to link with libpthread... -lpthread
> checking for libdl... yes
> checking how to link with libdl... -ldl
> checking whether we are using the GNU C++ compiler... yes
>
> This is with the current head of oe-core on qemuarm.

I am building for i586 but I doubt it is related.

I get:

checking for libpthread... yes
checking how to link with libpthread... /usr/lib/libpthread.so
checking for libdl... no
checking whether we are using the GNU C++ compiler... yes
Saul Wold - June 1, 2011, 9:43 p.m.
On 06/01/2011 02:00 PM, Otavio Salvador wrote:
> On Wed, Jun 1, 2011 at 20:53, Phil Blundell<pb@pbcl.net>  wrote:
>> On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
>>> Are you able to reproduce it?
>>
>> No, it works fine for me.  I get:
>>
>> checking how to link with libpthread... -lpthread
>> checking for libdl... yes
>> checking how to link with libdl... -ldl
>> checking whether we are using the GNU C++ compiler... yes
>>
>> This is with the current head of oe-core on qemuarm.
>
> I am building for i586 but I doubt it is related.
>
> I get:
>
> checking for libpthread... yes
> checking how to link with libpthread... /usr/lib/libpthread.so
> checking for libdl... no
> checking whether we are using the GNU C++ compiler... yes
>
I also built for x86 and beagle, both have libdl, can you check that you 
do not have some kind of site configuration that is overriding, also 
maybe post your log from .../gnutls-2.12.5/lib/config.log

Thanks
	Sau!
Martin Jansa - June 1, 2011, 9:52 p.m.
On Wed, Jun 01, 2011 at 02:43:53PM -0700, Saul Wold wrote:
> On 06/01/2011 02:00 PM, Otavio Salvador wrote:
> > On Wed, Jun 1, 2011 at 20:53, Phil Blundell<pb@pbcl.net>  wrote:
> >> On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
> >>> Are you able to reproduce it?
> >>
> >> No, it works fine for me.  I get:
> >>
> >> checking how to link with libpthread... -lpthread
> >> checking for libdl... yes
> >> checking how to link with libdl... -ldl
> >> checking whether we are using the GNU C++ compiler... yes
> >>
> >> This is with the current head of oe-core on qemuarm.
> >
> > I am building for i586 but I doubt it is related.
> >
> > I get:
> >
> > checking for libpthread... yes
> > checking how to link with libpthread... /usr/lib/libpthread.so
> > checking for libdl... no
> > checking whether we are using the GNU C++ compiler... yes
> >
> I also built for x86 and beagle, both have libdl, can you check that you 
> do not have some kind of site configuration that is overriding, also 
> maybe post your log from .../gnutls-2.12.5/lib/config.log

here it tries to link against host libdl

configure:26050: checking for libdl
configure:26069: arm-oe-linux-gnueabi-gcc -march=armv4t -mtune=arm920t
--sysroot=/OE/shr-core/tmp/sysroots/om-gta02 -o conftest -O2 -pipe -g
-feliminate-unused-debug-types
-I/OE/shr-core/tmp/sysroots/om-gta02/usr/include -Wl,-O1
-Wl,--as-needed conftest.c  /usr/lib/libdl.so >&5
/usr/lib/libdl.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Saul Wold - June 1, 2011, 10:19 p.m.
On 06/01/2011 02:52 PM, Martin Jansa wrote:
> On Wed, Jun 01, 2011 at 02:43:53PM -0700, Saul Wold wrote:
>> On 06/01/2011 02:00 PM, Otavio Salvador wrote:
>>> On Wed, Jun 1, 2011 at 20:53, Phil Blundell<pb@pbcl.net>   wrote:
>>>> On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
>>>>> Are you able to reproduce it?
>>>>
>>>> No, it works fine for me.  I get:
>>>>
>>>> checking how to link with libpthread... -lpthread
>>>> checking for libdl... yes
>>>> checking how to link with libdl... -ldl
>>>> checking whether we are using the GNU C++ compiler... yes
>>>>
>>>> This is with the current head of oe-core on qemuarm.
>>>
>>> I am building for i586 but I doubt it is related.
>>>
>>> I get:
>>>
>>> checking for libpthread... yes
>>> checking how to link with libpthread... /usr/lib/libpthread.so
>>> checking for libdl... no
>>> checking whether we are using the GNU C++ compiler... yes
>>>
>> I also built for x86 and beagle, both have libdl, can you check that you
>> do not have some kind of site configuration that is overriding, also
>> maybe post your log from .../gnutls-2.12.5/lib/config.log
>
> here it tries to link against host libdl
>
> configure:26050: checking for libdl
> configure:26069: arm-oe-linux-gnueabi-gcc -march=armv4t -mtune=arm920t
> --sysroot=/OE/shr-core/tmp/sysroots/om-gta02 -o conftest -O2 -pipe -g
> -feliminate-unused-debug-types
> -I/OE/shr-core/tmp/sysroots/om-gta02/usr/include -Wl,-O1
> -Wl,--as-needed conftest.c  /usr/lib/libdl.so>&5
> /usr/lib/libdl.so: file not recognized: File format not recognized
> collect2: ld returned 1 exit status
>
Well that's interesting, since I see it linking using -ldl, there must 
be some other setting that's affecting this, I have been looking in 
gnutls to see if I can find something else that sets libdl.so vs -ldl,
I have not found it.

configure:26075: i586-poky-linux-gcc -march=i586 
--sysroot=/builds/world/tmp/sysroots/qemux86 -o conftest -O2 -pipe -g 
-feliminate-unused-debug-types 
-I/builds/world/tmp/sysroots/qemux86/usr/include -Wl,-O1 
-Wl,--as-needed conftest.c  -ldl >&5
configure:26075: $? = 0
configure:26085: result: yes
configure:26092: checking how to link with libdl
configure:26094: result: -ldl

Sau!

>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Martin Jansa - June 2, 2011, 6:31 a.m.
On Wed, Jun 01, 2011 at 03:19:18PM -0700, Saul Wold wrote:
> On 06/01/2011 02:52 PM, Martin Jansa wrote:
> > On Wed, Jun 01, 2011 at 02:43:53PM -0700, Saul Wold wrote:
> >> On 06/01/2011 02:00 PM, Otavio Salvador wrote:
> >>> On Wed, Jun 1, 2011 at 20:53, Phil Blundell<pb@pbcl.net>   wrote:
> >>>> On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
> >>>>> Are you able to reproduce it?
> >>>>
> >>>> No, it works fine for me.  I get:
> >>>>
> >>>> checking how to link with libpthread... -lpthread
> >>>> checking for libdl... yes
> >>>> checking how to link with libdl... -ldl
> >>>> checking whether we are using the GNU C++ compiler... yes
> >>>>
> >>>> This is with the current head of oe-core on qemuarm.
> >>>
> >>> I am building for i586 but I doubt it is related.
> >>>
> >>> I get:
> >>>
> >>> checking for libpthread... yes
> >>> checking how to link with libpthread... /usr/lib/libpthread.so
> >>> checking for libdl... no
> >>> checking whether we are using the GNU C++ compiler... yes
> >>>
> >> I also built for x86 and beagle, both have libdl, can you check that you
> >> do not have some kind of site configuration that is overriding, also
> >> maybe post your log from .../gnutls-2.12.5/lib/config.log
> >
> > here it tries to link against host libdl
> >
> > configure:26050: checking for libdl
> > configure:26069: arm-oe-linux-gnueabi-gcc -march=armv4t -mtune=arm920t
> > --sysroot=/OE/shr-core/tmp/sysroots/om-gta02 -o conftest -O2 -pipe -g
> > -feliminate-unused-debug-types
> > -I/OE/shr-core/tmp/sysroots/om-gta02/usr/include -Wl,-O1
> > -Wl,--as-needed conftest.c  /usr/lib/libdl.so>&5
> > /usr/lib/libdl.so: file not recognized: File format not recognized
> > collect2: ld returned 1 exit status
> >
> Well that's interesting, since I see it linking using -ldl, there must 
> be some other setting that's affecting this, I have been looking in 
> gnutls to see if I can find something else that sets libdl.so vs -ldl,
> I have not found it.
> 
> configure:26075: i586-poky-linux-gcc -march=i586 
> --sysroot=/builds/world/tmp/sysroots/qemux86 -o conftest -O2 -pipe -g 
> -feliminate-unused-debug-types 
> -I/builds/world/tmp/sysroots/qemux86/usr/include -Wl,-O1 
> -Wl,--as-needed conftest.c  -ldl >&5
> configure:26075: $? = 0
> configure:26085: result: yes
> configure:26092: checking how to link with libdl
> configure:26094: result: -ldl

what do you have in configlog for LIBDL?

here it's all empty
LIBDL=''
LIBDL_PREFIX=''
LTLIBDL=''

if I add 
+             --with-libdl-prefix=${STAGING_DIR_HOST}${prefix} \
+             --with-libpthread-prefix=${STAGING_DIR_HOST}${prefix} \
to EXTRA_OE_CONF (we already have couple of --with-*-prefix there) it's
found correctly (and this is at least better workarround then forcing
-ldl directly to LDFLAGS):
LIBDL='/OE/shr-core/tmp/sysroots/om-gta02/usr/lib/libdl.so'
LIBDL_PREFIX='/OE/shr-core/tmp/sysroots/om-gta02/usr'
LTLIBDL='-L/OE/shr-core/tmp/sysroots/om-gta02/usr/lib -ldl'

same problem is with libpthread..

maybe their m4/lib-link.m4 does something wrong in
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  AC_REQUIRE([AC_LIB_RPATH])

Regards,
Koen Kooi - June 2, 2011, 9:29 a.m.
Op 2 jun 2011, om 08:31 heeft Martin Jansa het volgende geschreven:

> On Wed, Jun 01, 2011 at 03:19:18PM -0700, Saul Wold wrote:
>> On 06/01/2011 02:52 PM, Martin Jansa wrote:
>>> On Wed, Jun 01, 2011 at 02:43:53PM -0700, Saul Wold wrote:
>>>> On 06/01/2011 02:00 PM, Otavio Salvador wrote:
>>>>> On Wed, Jun 1, 2011 at 20:53, Phil Blundell<pb@pbcl.net>   wrote:
>>>>>> On Wed, 2011-06-01 at 20:39 +0000, Otavio Salvador wrote:
>>>>>>> Are you able to reproduce it?
>>>>>> 
>>>>>> No, it works fine for me.  I get:
>>>>>> 
>>>>>> checking how to link with libpthread... -lpthread
>>>>>> checking for libdl... yes
>>>>>> checking how to link with libdl... -ldl
>>>>>> checking whether we are using the GNU C++ compiler... yes
>>>>>> 
>>>>>> This is with the current head of oe-core on qemuarm.
>>>>> 
>>>>> I am building for i586 but I doubt it is related.
>>>>> 
>>>>> I get:
>>>>> 
>>>>> checking for libpthread... yes
>>>>> checking how to link with libpthread... /usr/lib/libpthread.so
>>>>> checking for libdl... no
>>>>> checking whether we are using the GNU C++ compiler... yes
>>>>> 
>>>> I also built for x86 and beagle, both have libdl, can you check that you
>>>> do not have some kind of site configuration that is overriding, also
>>>> maybe post your log from .../gnutls-2.12.5/lib/config.log
>>> 
>>> here it tries to link against host libdl
>>> 
>>> configure:26050: checking for libdl
>>> configure:26069: arm-oe-linux-gnueabi-gcc -march=armv4t -mtune=arm920t
>>> --sysroot=/OE/shr-core/tmp/sysroots/om-gta02 -o conftest -O2 -pipe -g
>>> -feliminate-unused-debug-types
>>> -I/OE/shr-core/tmp/sysroots/om-gta02/usr/include -Wl,-O1
>>> -Wl,--as-needed conftest.c  /usr/lib/libdl.so>&5
>>> /usr/lib/libdl.so: file not recognized: File format not recognized
>>> collect2: ld returned 1 exit status
>>> 
>> Well that's interesting, since I see it linking using -ldl, there must 
>> be some other setting that's affecting this, I have been looking in 
>> gnutls to see if I can find something else that sets libdl.so vs -ldl,
>> I have not found it.
>> 
>> configure:26075: i586-poky-linux-gcc -march=i586 
>> --sysroot=/builds/world/tmp/sysroots/qemux86 -o conftest -O2 -pipe -g 
>> -feliminate-unused-debug-types 
>> -I/builds/world/tmp/sysroots/qemux86/usr/include -Wl,-O1 
>> -Wl,--as-needed conftest.c  -ldl >&5
>> configure:26075: $? = 0
>> configure:26085: result: yes
>> configure:26092: checking how to link with libdl
>> configure:26094: result: -ldl
> 
> what do you have in configlog for LIBDL?
> 
> here it's all empty
> LIBDL=''
> LIBDL_PREFIX=''
> LTLIBDL=''

I get for cross gnutls in lib/config.log:

grep LIBDL lib/config.log 
HAVE_LIBDL='no'
LIBDL=''
LIBDL_PREFIX=''
LTLIBDL=''

regards,

Koen
Richard Purdie - June 2, 2011, 9:38 a.m.
On Thu, 2011-06-02 at 08:31 +0200, Martin Jansa wrote:
> what do you have in configlog for LIBDL?
> 
> here it's all empty
> LIBDL=''
> LIBDL_PREFIX=''
> LTLIBDL=''
> 
> if I add 
> +             --with-libdl-prefix=${STAGING_DIR_HOST}${prefix} \
> +             --with-libpthread-prefix=${STAGING_DIR_HOST}${prefix} \
> to EXTRA_OE_CONF (we already have couple of --with-*-prefix there) it's
> found correctly (and this is at least better workarround then forcing
> -ldl directly to LDFLAGS):
> LIBDL='/OE/shr-core/tmp/sysroots/om-gta02/usr/lib/libdl.so'
> LIBDL_PREFIX='/OE/shr-core/tmp/sysroots/om-gta02/usr'
> LTLIBDL='-L/OE/shr-core/tmp/sysroots/om-gta02/usr/lib -ldl'
> 
> same problem is with libpthread..
> 
> maybe their m4/lib-link.m4 does something wrong in
> AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
> [
>   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
>   AC_REQUIRE([AC_LIB_RPATH])

I just looked at the code in lib/configure and concluded that its just
luck whether it figures out the correct values or does something really
nasty. Its poking about ${libdir} for this stuff so you end up with
something like the following combinations:

a) 64 bit system with 64 bit libs in /usr/lib64 and no 32 bit libs:
     Finds no -ldl

   Something else may or may not link it indirectly so the build may or 
   may not work.

b) 64 bit system with 64 bit libs in /usr/lib64 and 32 bit libs in /usr/lib, building for 32 bit:
     Finds a -ldl which "works".

   Things appear to work.

c) Other variations


The correct fix would appear to be to set the paths specifically using
the options Martin mentions above.

Cheers,

Richard

Patch

diff --git a/meta/recipes-support/gnutls/gnutls.inc b/meta/recipes-support/gnutls/gnutls.inc
index 9f8d81b..9452190 100644
--- a/meta/recipes-support/gnutls/gnutls.inc
+++ b/meta/recipes-support/gnutls/gnutls.inc
@@ -3,7 +3,7 @@  HOMEPAGE = "http://www.gnu.org/software/gnutls/"
 BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls"
 DEPENDS = "zlib lzo libtasn1 libgcrypt (>= 1.4.2) libcap"
 
-INC_PR = "r1"
+INC_PR = "r2"
 
 LICENSE = "GPLv3+ & LGPLv2.1+"
 LICENSE_${PN} = "LGPLv2.1+"
@@ -30,6 +30,8 @@  do_configure_prepend() {
 	done
 }
 
+export LDFLAGS += "-ldl"
+
 PACKAGES =+ "${PN}-openssl ${PN}-extra ${PN}-bin ${PN}-xx"
 
 FILES_${PN} = "${libdir}/libgnutls.so.*"
diff --git a/meta/recipes-support/gnutls/gnutls_2.12.5.bb b/meta/recipes-support/gnutls/gnutls_2.12.5.bb
index b27a065..9d3f5ab 100644
--- a/meta/recipes-support/gnutls/gnutls_2.12.5.bb
+++ b/meta/recipes-support/gnutls/gnutls_2.12.5.bb
@@ -1,6 +1,6 @@ 
 require gnutls.inc
 
-PR = "r0"
+PR = "${INC_PR}.0"
 
 SRC_URI += "file://gnutls-openssl.patch \
             file://configure-fix.patch"