GNU bug report logs - #10926
Minor problem with static building of coreutils-8.1[345]

Previous Next

Package: coreutils;

Reported by: Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>

Date: Fri, 2 Mar 2012 16:37:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10926 in the body.
You can then email your comments to 10926 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#10926; Package coreutils. (Fri, 02 Mar 2012 16:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 02 Mar 2012 16:37:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>
To: bug-coreutils <at> gnu.org
Subject: Minor problem with static building of coreutils-8.1[345]
Date: Fri, 02 Mar 2012 10:35:22 +0100
[Message part 1 (text/plain, inline)]
Hi,

I have a minor problem with the *static* building of coreutils. Building
"timeout" requires libpthread in addition to librt.

A simple patch is enclosed.

Thanks a lot for your great work and kind regards,

Ado

________________________________________________________________________

Dipl.-Ing. Heinz-Ado Arnolds

MPI fuer Astrophysik
Karl-Schwarzschild-Strasse 1            Postfach 1317
D-85748 Garching                        D-85741 Garching
Phone:  +49/89/30000-2217
FAX  :  +49/89/30000-2388
email:  arnolds[at]MPA-Garching.MPG.DE
________________________________________________________________________
[coreutils-8.15-static-timeout.patch (text/plain, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#10926; Package coreutils. (Fri, 02 Mar 2012 16:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 10926 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>
Cc: 10926 <at> debbugs.gnu.org
Subject: Re: bug#10926: Minor problem with static building of
	coreutils-8.1[345]
Date: Fri, 02 Mar 2012 16:49:27 +0000
On 03/02/2012 09:35 AM, Heinz-Ado Arnolds wrote:
> Hi,
> 
> I have a minor problem with the *static* building of coreutils. Building
> "timeout" requires libpthread in addition to librt.
> 
> A simple patch is enclosed.
> 
> Thanks a lot for your great work and kind regards,

Is this on an older glibc/kernel ?

cheers,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#10926; Package coreutils. (Tue, 06 Mar 2012 16:25:01 GMT) Full text and rfc822 format available.

Message #11 received at 10926 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: bug-gnulib <bug-gnulib <at> gnu.org>
Cc: 10926 <at> debbugs.gnu.org, Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>
Subject: [PATCH] timer-time: link explicitly with pthreads on glibc
Date: Tue, 06 Mar 2012 16:23:40 +0000
On 03/02/2012 09:35 AM, Heinz-Ado Arnolds wrote:
> Hi,
> 
> I have a minor problem with the *static* building of coreutils. Building
> "timeout" requires libpthread in addition to librt.
> 
> A simple patch is enclosed.
> 
> Thanks a lot for your great work and kind regards,
> 

I'm not sure if this is the right approach for the above issue.

cheers,
Pádraig.

From c18ffcdae1d7ffc012a2cd5dee1e2d0411dcfad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P <at> draigBrady.com>
Date: Tue, 6 Mar 2012 15:02:40 +0000
Subject: [PATCH] timer-time: link explicitly with pthreads on glibc

To support static linking we need to explicitly
specify the pthreads library which is referenced
(but not used on modern Linux kernels at least).

* m4/timer_time.m4 (LIB_TIMER_TIME): Add -lpthread
when newer GLIBC is detected as that contains
the pthread emulation.
* modules/timer-time: Depend on threadlib to
pull in the appropriate library to link
---
 m4/timer_time.m4   |   16 ++++++++++++++++
 modules/timer-time |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
index 6276759..d6e0efe 100644
--- a/m4/timer_time.m4
+++ b/m4/timer_time.m4
@@ -11,6 +11,7 @@ AC_DEFUN([gl_TIMER_TIME],
   dnl Based on clock_time.m4. See details there.

   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_REQUIRE([gl_THREADLIB])

   LIB_TIMER_TIME=
   AC_SUBST([LIB_TIMER_TIME])
@@ -18,6 +19,21 @@ AC_DEFUN([gl_TIMER_TIME],
     AC_SEARCH_LIBS([timer_settime], [rt posix4],
                    [test "$ac_cv_search_timer_settime" = "none required" ||
                     LIB_TIMER_TIME=$ac_cv_search_timer_settime])
+    dnl GLIBC uses threads to emulate posix timers when kernel support
+    dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
+    dnl Now the pthread lib is linked automatically in the normal case,
+    dnl but when linking statically, it needs to be explicitly specified.
+    AC_EGREP_CPP([Thread],
+      [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
+     && !defined __UCLIBC__
+  Thread emulation available
+ #endif
+#endif
+      ],
+      [LIB_TIMER_TIME="$LIBMULTITHREAD $LIB_TIMER_TIME"])
     AC_CHECK_FUNCS([timer_settime])
   LIBS=$gl_saved_libs
 ])
diff --git a/modules/timer-time b/modules/timer-time
index 07b439b..7bf8079 100644
--- a/modules/timer-time
+++ b/modules/timer-time
@@ -7,6 +7,7 @@ m4/timer_time.m4

 Depends-on:
 extensions
+threadlib

 configure.ac:
 gl_TIMER_TIME
-- 
1.7.6.4




Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sat, 10 Mar 2012 14:16:02 GMT) Full text and rfc822 format available.

Notification sent to Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>:
bug acknowledged by developer. (Sat, 10 Mar 2012 14:16:02 GMT) Full text and rfc822 format available.

Message #16 received at 10926-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: bug-gnulib <bug-gnulib <at> gnu.org>
Cc: 10926-done <at> debbugs.gnu.org, Heinz-Ado Arnolds <arnolds <at> MPA-Garching.MPG.DE>
Subject: Re: [PATCH] timer-time: link explicitly with pthreads on glibc
Date: Sat, 10 Mar 2012 13:45:17 +0000
On 03/06/2012 04:23 PM, Pádraig Brady wrote:
> On 03/02/2012 09:35 AM, Heinz-Ado Arnolds wrote:
>> Hi,
>>
>> I have a minor problem with the *static* building of coreutils. Building
>> "timeout" requires libpthread in addition to librt.
>>
>> A simple patch is enclosed.
>>
>> Thanks a lot for your great work and kind regards,
>>
> 
> I'm not sure if this is the right approach for the above issue.
> 
> cheers,
> Pádraig.
> 
>>From c18ffcdae1d7ffc012a2cd5dee1e2d0411dcfad8 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P <at> draigBrady.com>
> Date: Tue, 6 Mar 2012 15:02:40 +0000
> Subject: [PATCH] timer-time: link explicitly with pthreads on glibc

I'll apply this to gnulib so.

Marking this bug done.

cheers,
Pádraig.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 08 Apr 2012 11:24:03 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Mon, 20 Aug 2012 01:08:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#10926; Package coreutils. (Mon, 20 Aug 2012 01:19:02 GMT) Full text and rfc822 format available.

Message #23 received at 10926 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: 10926 <at> debbugs.gnu.org
Subject: Re: [PATCH] timer-time: fix linking order with pthreads/rt
Date: Mon, 20 Aug 2012 02:18:41 +0100
On 08/18/2012 10:57 PM, Mike Frysinger wrote:
> When statically linking pthreads with rt, the current order is:
> 	-lpthread -lrt
> 
> But when statically linking, the -lpthread will be discarded as it
> isn't used.  It needs to come after the -lrt.
> 
> * m4/timer_time.m4 (LIB_TIMER_TIME): Swap order of variables.
> ---
>  m4/timer_time.m4 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
> index d6e0efe..48fea11 100644
> --- a/m4/timer_time.m4
> +++ b/m4/timer_time.m4
> @@ -33,7 +33,7 @@ AC_DEFUN([gl_TIMER_TIME],
>   #endif
>  #endif
>        ],
> -      [LIB_TIMER_TIME="$LIBMULTITHREAD $LIB_TIMER_TIME"])
> +      [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
>      AC_CHECK_FUNCS([timer_settime])
>    LIBS=$gl_saved_libs
>  ])

Pushed http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=898f1431

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#10926; Package coreutils. (Mon, 20 Aug 2012 19:19:01 GMT) Full text and rfc822 format available.

Message #26 received at 10926 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 10926 <at> debbugs.gnu.org
Subject: Re: bug#10926: [PATCH] timer-time: fix linking order with pthreads/rt
Date: Mon, 20 Aug 2012 21:18:10 +0200
Pádraig Brady wrote:
> On 08/18/2012 10:57 PM, Mike Frysinger wrote:
>> When statically linking pthreads with rt, the current order is:
>> 	-lpthread -lrt
>>
>> But when statically linking, the -lpthread will be discarded as it
>> isn't used.  It needs to come after the -lrt.
>>
>> * m4/timer_time.m4 (LIB_TIMER_TIME): Swap order of variables.
>> ---
>>  m4/timer_time.m4 |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
>> index d6e0efe..48fea11 100644
>> --- a/m4/timer_time.m4
>> +++ b/m4/timer_time.m4
>> @@ -33,7 +33,7 @@ AC_DEFUN([gl_TIMER_TIME],
>>   #endif
>>  #endif
>>        ],
>> -      [LIB_TIMER_TIME="$LIBMULTITHREAD $LIB_TIMER_TIME"])
>> +      [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
>>      AC_CHECK_FUNCS([timer_settime])
>>    LIBS=$gl_saved_libs
>>  ])
>
> Pushed http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=898f1431

Thanks.  We'll inherit this fix in 8.20.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Sep 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 362 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.