Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jul 2012 18:55:19 GMT
From:      Richard Yao <ryao@gentoo.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/169791: Update sysutils/coreutils to 8.17
Message-ID:  <201207111855.q6BItJK8068802@red.freebsd.org>
Resent-Message-ID: <201207111900.q6BJ0DO6060230@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         169791
>Category:       ports
>Synopsis:       Update sysutils/coreutils to 8.17
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 11 19:00:13 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Richard Yao
>Release:        FreeBSD 9.0-RELEASE
>Organization:
Gentoo
>Environment:
FreeBSD gfreebsd 9.0-r3-Gentoo FreeBSD Gentoo 9.0-r3 #0: Sun May 27 20:29:34 EDT 2012     root@gfreebsd:/usr/src/sys/amd64/compile/GENERIC  amd64
>Description:
coreutils relies on gnulib for many of its ./configure tests. A patch was made to gnulib shortly after the release of coreutils 8.17 to made libpthread detection work on OSF/1, but broke it on FreeBSD, so coreutils 8.12 is the last version that works.
>How-To-Repeat:
Try building coreutils 8.17 on FreeBSD. It will fail with the following linker error:

sort.c:(.text+0x4f25): undefined reference to `pthread_create'
>Fix:
Here is a Gentoo bug describing the problem:

https://bugs.gentoo.org/show_bug.cgi?id=415439

I am attaching our patch for this. It is against the ./configure script, rather than m4/pthread.m4.

I committed it to Gentoo a few hours ago. In our case, we could not build coreutils on Gentoo FreeBSD at all. I made a few minor changes to the ebuild for coreutils 8.17 and added this patch, which made it work.

Patch attached with submission follows:

diff --git a/configure b/configure
index f3156fe..925d6b5 100755
--- a/configure
+++ b/configure
@@ -42286,55 +42248,48 @@ fi
 
    LIB_PTHREAD=
    if test $ac_cv_header_pthread_h = yes; then
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_join" >&5
-$as_echo_n "checking for library containing pthread_join... " >&6; }
-if ${gl_cv_search_pthread_join+:} false; then :
+                              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create and pthread_join" >&5
+$as_echo_n "checking for library containing pthread_create and pthread_join... " >&6; }
+if ${gl_cv_lib_pthread+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gl_saved_libs="$LIBS"
-        gl_cv_search_pthread_join=
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <pthread.h>
-int
-main ()
-{
-pthread_join (pthread_self (), (void **) 0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_search_pthread_join="none required"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-        if test -z "$gl_cv_search_pthread_join"; then
-          LIBS="-lpthread $gl_saved_libs"
+  gl_saved_libs=$LIBS
+        gl_cv_lib_pthread=
+        for gl_lib_prefix in '' '-lpthread'; do
+          LIBS="$gl_lib_prefix $gl_saved_libs"
           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
+                 void *noop (void *p) { return p; }
 int
 main ()
 {
-pthread_join (pthread_self (), (void **) 0);
+pthread_t pt;
+                 void *arg = 0;
+                 pthread_create (&pt, 0, noop, arg);
+                 pthread_join (pthread_self (), &arg);
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_search_pthread_join="-lpthread"
+  if test -z "$gl_lib_prefix"; then
+               gl_cv_lib_pthread="none required"
+             else
+               gl_cv_lib_pthread=$gl_lib_prefix
+             fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-        fi
+          test -n "$gl_cv_lib_pthread" && break
+        done
         LIBS="$gl_saved_libs"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_search_pthread_join" >&5
-$as_echo "$gl_cv_search_pthread_join" >&6; }
-     if test "$gl_cv_search_pthread_join" != "none required"; then
-       LIB_PTHREAD="$gl_cv_search_pthread_join"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_lib_pthread" >&5
+$as_echo "$gl_cv_lib_pthread" >&6; }
+     if test "$gl_cv_lib_pthread" != "none required"; then
+       LIB_PTHREAD="$gl_cv_lib_pthread"
      fi
    fi
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207111855.q6BItJK8068802>