FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 02-24-2010, 05:19 PM
Paul Wouters
 
Default pthreads linking in devel/F-13 issue

Does someone know why this is going wrong?

---------- Forwarded message ----------
Date: Wed, 24 Feb 2010 18:32:54 +0100
From: W.C.A. Wijngaards <wouter@NLnetLabs.nl>
To: unbound-users@unbound.net
Subject: Re: [Unbound-users] unbound linking bug with pthreads

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Paul,

Unbound uses http://www.nongnu.org/autoconf-archive/acx_pthread.html
in acx_pthread.m4. It uses configure-style compilation tests to see
what works, and tries -pthread (CFLAGS) and later -lpthread (LIBS). It
does not try both at once.

For me, I end up with -pthread in the CFLAGS. This is included on the
commandline when linking. Perhaps -pthread is enough when linking, or
does it have to be -lpthread ? If so, the configure test to link with
- -pthread should be failing and perhaps a test added to the macro and
submitted upstream.

If the new system has pthread-config you can set both cflags and libs
with that, no patch required.

Best regards,
Wouter

On 02/24/2010 05:37 PM, Paul Wouters wrote:
>
> Hi,
>
> Fedora 13 will no longer implicitely link in certain libraries. For
> a full description see:
>
> https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
>
> This is happening with unbound and the pthreads library. So we need to
> pass it a -lpthreads when we are compiling with --with-pthreads.
>
> I'm not a "configure" expert, so while I do see some tests in configure,
> I don't understand where it remembers the additional -lpthread argument
> which needs to be added to the Makefile's LIBS=
>
> Currently, on my Linux machine which ran with --with-phtreads, I see in
> Makefile:
>
> LIBS=$(strip -lldns -levent -lrt -lcrypto)
>
> This is missing -lpthread
>
> Paul
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkuFYsYACgkQkDLqNwOhpPiKFwCeLJ3fwcO7Ye 4Kp+bq/LuVIyn1
1B4AoILnaK2bP8SJ9PePI1Xw6Oa/5euf
=yj7Q
-----END PGP SIGNATURE-----
_______________________________________________
Unbound-users mailing list
Unbound-users@unbound.net
http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 02-24-2010, 09:52 PM
Roland McGrath
 
Default pthreads linking in devel/F-13 issue

-pthread is indeed sufficient when it's really given to the linking $CC run.

> Does someone know why this is going wrong?

In unbound.spec I see:

%{__make} CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" QUIET=no %{?_smp_mflags}

This overrides the CFLAGS setting written into Makefile by configure.

You should never override CFLAGS in this way.
The place to set CFLAGS is in the configure line.

You use %configure, which uses CFLAGS="${CFLAGS:-%optflags}".
(%optflags is the same as $RPM_OPT_FLAGS.)

So what would work is:

%configure ...
CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"

However, what I would really suggest is that you instead put -D_GNU_SOURCE
into CFLAGS in the source package itself. If you need that, it should not
be a Fedora-specific issue. e.g., early in configure.ac you can use:

CFLAGS="$CFLAGS -D_GNU_SOURCE"


Thanks,
Roland
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 02-24-2010, 10:23 PM
Paul Wouters
 
Default pthreads linking in devel/F-13 issue

On Wed, 24 Feb 2010, Roland McGrath wrote:

Thanks for the reply.

> -pthread is indeed sufficient when it's really given to the linking $CC run.
>
>> Does someone know why this is going wrong?
>
> In unbound.spec I see:
>
> %{__make} CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" QUIET=no %{?_smp_mflags}
>
> This overrides the CFLAGS setting written into Makefile by configure.

Though CFLAGS is not the issue, LIBS= is.

> So what would work is:
>
> %configure ...
> CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"

That fails with:

+ cd /builddir/build/BUILD
+ cd unbound-1.4.1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -I/usr/lib/gfortran/modules'
+ export FFLAGS
+ ./configure --build=i386-redhat-linux-gnu --host=i386-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-ldns= --with-libevent --with-pthreads --with-ssl --disable-rpath --enable-debug --disable-static --with-conf-file=/etc/unbound/unbound.conf --with-pidfile=/var/run/unbound/unbound.pid --enable-sha2 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE QUIET=no'
checking for i386-redhat-linux-gnu-gcc... no
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/builddir/build/BUILD/unbound-1.4.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.

Paul
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 
Old 02-24-2010, 10:34 PM
Roland McGrath
 
Default pthreads linking in devel/F-13 issue

> Though CFLAGS is not the issue, LIBS= is.

You are mistaken. Your configure check decides -pthread alone is
sufficient (which it is), and that is all it sets. If your configure put
-lpthread into LIBS, then you would not have a problem. The substitution
of LIBS into the makefile is working fine.

> > So what would work is:
> >
> > %configure ...
> > CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"
>
> That fails with:
[...]
> + ./configure --build=i386-redhat-linux-gnu --host=i386-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-ldns= --with-libevent --with-pthreads --with-ssl --disable-rpath --enable-debug --disable-static --with-conf-file=/etc/unbound/unbound.conf --with-pidfile=/var/run/unbound/unbound.pid --enable-sha2 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE QUIET=no'

This indicates you wrote :

%configure ...
CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE QUIET=no"

QUIET=no belongs outside of quotes. It also does not serve any purpose
there at all. Leave it on your make line as you had it before.


Thanks,
Roland
--
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
 

Thread Tools




All times are GMT. The time now is 04:29 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org