pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/47941: devel/glib2 build failure on NetBSD/arm 6.1



The following reply was made to PR pkg/47941; it has been noted by GNATS.

From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: pkg/47941: devel/glib2 build failure on NetBSD/arm 6.1
Date: Wed, 19 Jun 2013 23:41:43 +0900

 > >Fix:
 > No idea.
 > Make glib2 use MI atomic_ops(3) on all NetBSD platform?
 
 There are three bugs in glib2 distribution for arm + gcc-4.5.x,
 which lacks both __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 and
 __sync_bool_compare_and_swap.
 
 (1)inverted configure test for __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
 
  The following AC_TRY_COMPILE() statement seems wrong
  (causes inverted results):
  
https://git.gnome.org/browse/glib/tree/configure.ac?h=glib-2-36&id=8bd53990e1a60d1f47d04486813690abea75b5c7#n2416
 
  On NetBSD/i386 6.1 gcc(1) has __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
  but config.h claims "#undef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4".
 
  On NetBSD/arm 6.1 gcc(1) doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
  but config.h claims "#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1"
  so it causes the errors mentioned as this PR.
 
  Swapping arguments in AC_TRY_COMPILE() fixes this problem.
 
 (2)incorrect configure test for __sync_bool_compare_and_swap()
 
  configure.ac script checks if __sync_bool_compare_and_swap() is defined
  to set glib_cv_g_atomic_lock_free (and G_ATOMIC_LOCK_FREE):
  
https://git.gnome.org/browse/glib/tree/configure.ac?h=glib-2-36&id=8bd53990e1a60d1f47d04486813690abea75b5c7#n2393
 
  On NetBSD/arm 6.1 gcc(1) doesn't have __sync_bool_compare_and_swap()
  but config.h claims glib_cv_g_atomic_lock_free=yes.
 
  This is because AC_TRY_COMPILE() doesn't cause an error against
  undefined macro with parentheses, which could be external symbols.
 
  I think the configure.ac should rather use AC_TRY_LINK() in that case.
  (and it's also safe to use AC_TRY_LINK() in the above
   __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 check)
 
 (3)prototype mismatches of g_atomic functions in !G_ATOMIC_LOCK_FREE case
 
  In !G_ATOMIC_LOCK_FREE and !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 case,
  glib2 will use own implementations for g_atomic_*() functions,
  but argument types defined in gatomic.c functions don't match ones
  declated in gatomic.h:
  
https://git.gnome.org/browse/glib/tree/glib/gatomic.c?h=glib-2-36&id=20c630bde60da5723848cad76fdb5b876510b1fc#n686
  ---
  gint
  (g_atomic_int_get) (volatile gint *atomic)
  ---
  
https://git.gnome.org/browse/glib/tree/glib/gatomic.h?h=glib-2-36&id=20c630bde60da5723848cad76fdb5b876510b1fc#n33
  ---
  gint                    g_atomic_int_get                      (const volatile 
gint *atomic);
  ---
 
 
 The following pkgsrc patch (for patches) fixes the above all problems.
 It fixes a build failure on NetBSD/evbarm 6.1, and doesn't break builds
 on NetBSD/i386 6.1.
 
 (BTW, I think patchdiff shouldn't remove new patches which have
  different line numbers in diff...)
 
 ---
 Index: patches/patch-aa
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/glib2/patches/patch-aa,v
 retrieving revision 1.54
 diff -u -p -r1.54 patch-aa
 --- patches/patch-aa   6 Oct 2012 20:44:05 -0000       1.54
 +++ patches/patch-aa   19 Jun 2013 14:25:51 -0000
 @@ -1,8 +1,8 @@
  $NetBSD: patch-aa,v 1.54 2012/10/06 20:44:05 prlw1 Exp $
  
 ---- configure.orig    2012-09-24 01:26:24.000000000 +0000
 +--- configure.orig    2013-06-09 22:53:42.000000000 +0000
  +++ configure
 -@@ -721,6 +721,7 @@ GIO
 +@@ -724,6 +724,7 @@ GIO
   GSPAWN
   GLIB_DEBUG_FLAGS
   G_MODULE_NEED_USCORE
 @@ -10,7 +10,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   G_MODULE_BROKEN_RTLD_GLOBAL
   G_MODULE_HAVE_DLERROR
   G_MODULE_LDFLAGS
 -@@ -21565,6 +21566,8 @@ else
 +@@ -21108,6 +21109,8 @@ else
   # ifdef _MSC_VER
   #  include <malloc.h>
   #  define alloca _alloca
 @@ -19,7 +19,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   # else
   #  ifdef HAVE_ALLOCA_H
   #   include <alloca.h>
 -@@ -22610,8 +22613,8 @@ else
 +@@ -22153,8 +22156,8 @@ else
   fi
   
   
 @@ -30,7 +30,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   /* end confdefs.h.  */
   #if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
 -@@ -24210,16 +24213,48 @@ fi
 +@@ -23807,16 +23810,48 @@ fi
   
   case $host in
     *-*-solaris* )
 @@ -80,7 +80,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   esac
   
   if test "$ac_cv_func_statfs" = yes; then :
 -@@ -25231,10 +25266,11 @@ if test x"$glib_native_win32" = xyes; th
 +@@ -24829,10 +24864,11 @@ if test x"$glib_native_win32" = xyes; th
       G_MODULE_LDFLAGS=
   else
     export SED
 @@ -93,7 +93,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   G_MODULE_HAVE_DLERROR=0
   if test -z "$G_MODULE_IMPL"; then
     case "$host" in
 -@@ -25452,13 +25488,13 @@ if  test "$G_MODULE_IMPL" = "G_MODULE_IM
 +@@ -25050,13 +25086,13 @@ if  test "$G_MODULE_IMPL" = "G_MODULE_IM
        LIBS="$G_MODULE_LIBS $LIBS"
        LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
        echo "void glib_plugin_test(void) { }" > plugin.c
 @@ -110,7 +110,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RTLD_GLOBAL 
brokenness" >&5
   $as_echo_n "checking for RTLD_GLOBAL brokenness... " >&6; }
   if ${glib_cv_rtldglobal_broken+:} false; then :
 -@@ -25568,6 +25604,56 @@ fi
 +@@ -25166,6 +25202,56 @@ fi
        LIBS="$LIBS_orig"
   
   fi
 @@ -167,7 +167,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   if test -z "$G_MODULE_IMPL"; then
        G_MODULE_IMPL=0
           G_MODULE_SUPPORTED=false
 -@@ -25578,7 +25664,7 @@ fi
 +@@ -25176,7 +25262,7 @@ fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the suffix of module 
shared libraries" >&5
   $as_echo_n "checking for the suffix of module shared libraries... " >&6; }
   export SED
 @@ -176,7 +176,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   eval $shrext_cmds
   module=yes eval std_shrext=$shrext_cmds
   # chop the initial dot
 -@@ -25602,6 +25688,7 @@ fi
 +@@ -25200,6 +25286,7 @@ fi
   
   
   
 @@ -184,7 +184,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gspawn implementation" 
>&5
   $as_echo_n "checking for gspawn implementation... " >&6; }
   case "$host" in
 -@@ -26543,62 +26630,8 @@ if  test x"$have_threads" = xposix; then
 +@@ -26177,62 +26264,8 @@ if  test x"$have_threads" = xposix; then
         G_THREAD_LIBS="-lpthread -lthread"
         ;;
       *)
 @@ -249,7 +249,7 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
          ;;
     esac
   
 -@@ -27112,6 +27145,7 @@ case $host in
 +@@ -26746,6 +26779,7 @@ case $host in
       ;;
     *-*-openbsd*)
       LDFLAGS="$LDFLAGS -pthread"
 @@ -257,3 +257,37 @@ $NetBSD: patch-aa,v 1.54 2012/10/06 20:4
       ;;
     *)
       G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS"
 +@@ -26844,7 +26878,7 @@ volatile int atomic = 2;\
 +   return 0;
 + }
 + _ACEOF
 +-if ac_fn_c_try_compile "$LINENO"; then :
 ++if ac_fn_c_try_link "$LINENO"; then :
 +   glib_cv_g_atomic_lock_free=yes
 + else
 +   glib_cv_g_atomic_lock_free=no
 +@@ -26865,7 +26899,7 @@ volatile int atomic = 2;\
 +   return 0;
 + }
 + _ACEOF
 +-if ac_fn_c_try_compile "$LINENO"; then :
 ++if ac_fn_c_try_link "$LINENO"; then :
 +   as_fn_error $? "GLib must be build with -march=i486 or later." "$LINENO" 5
 + fi
 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 +@@ -26896,12 +26930,12 @@ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;
 +   return 0;
 + }
 + _ACEOF
 +-if ac_fn_c_try_compile "$LINENO"; then :
 +-
 +-else
 ++if ac_fn_c_try_link "$LINENO"; then :
 + 
 + $as_echo "#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1" >>confdefs.h
 + 
 ++else
 ++
 + fi
 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 +     fi
 Index: patches/patch-ak
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/glib2/patches/patch-ak,v
 retrieving revision 1.15
 diff -u -p -r1.15 patch-ak
 --- patches/patch-ak   19 Apr 2013 22:21:41 -0000      1.15
 +++ patches/patch-ak   19 Jun 2013 14:25:51 -0000
 @@ -1,6 +1,6 @@
  $NetBSD: patch-ak,v 1.15 2013/04/19 22:21:41 prlw1 Exp $
  
 ---- configure.ac.orig 2013-03-25 20:37:16.000000000 +0000
 +--- configure.ac.orig 2013-06-09 22:53:13.000000000 +0000
  +++ configure.ac
  @@ -858,7 +858,7 @@ int main (void)
   AC_MSG_RESULT($g_have_gnuc_visibility)
 @@ -158,3 +158,35 @@ $NetBSD: patch-ak,v 1.15 2013/04/19 22:2
       ;;
     *)
       G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS"
 +@@ -2390,7 +2423,7 @@ AC_CACHE_CHECK([for lock-free atomic int
 +       glib_cv_g_atomic_lock_free=yes
 +       ;;
 +     *)
 +-      AC_TRY_COMPILE([],
 ++      AC_TRY_LINK([],
 +                      [volatile int atomic = 2;\
 +                       __sync_bool_compare_and_swap (&atomic, 2, 3);],
 +                      [glib_cv_g_atomic_lock_free=yes],
 +@@ -2398,7 +2431,7 @@ AC_CACHE_CHECK([for lock-free atomic int
 +       if test "$glib_cv_g_atomic_lock_free" = "no"; then
 +         SAVE_CFLAGS="${CFLAGS}"
 +         CFLAGS="-march=i486"
 +-        AC_TRY_COMPILE([],
 ++        AC_TRY_LINK([],
 +                        [volatile int atomic = 2;\
 +                         __sync_bool_compare_and_swap (&atomic, 2, 3);],
 +                        [AC_MSG_ERROR([GLib must be build with -march=i486 or 
later.])],
 +@@ -2416,10 +2449,10 @@ case $host in
 +     # Some compilers support atomic operations but do not define
 +     # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, like clang
 +     if test x"$glib_cv_g_atomic_lock_free" = xyes; then
 +-      AC_TRY_COMPILE([],
 ++      AC_TRY_LINK([],
 +                      [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],
 +-                     [],
 +-                     [AC_DEFINE(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, 1, [ 
compiler supports atomic operations])])
 ++                     [AC_DEFINE(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, 1, [ 
compiler supports atomic operations])],
 ++                     [])
 +     fi
 +     ;;
 +  esac
 Index: patches/patch-ce
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/glib2/patches/patch-ce,v
 retrieving revision 1.5
 diff -u -p -r1.5 patch-ce
 --- patches/patch-ce   30 Apr 2012 13:53:48 -0000      1.5
 +++ patches/patch-ce   19 Jun 2013 14:25:51 -0000
 @@ -3,7 +3,7 @@ $NetBSD: patch-ce,v 1.5 2012/04/30 13:53
  Fix inconsistency of .hidden attributes, leading to link error on amd64,
  reported by Tobias Nygren.
  
 ---- glib/gatomic.c.orig       2012-03-12 00:42:41.000000000 +0000
 +--- glib/gatomic.c.orig       2013-06-09 22:03:17.000000000 +0000
  +++ glib/gatomic.c
  @@ -22,6 +22,7 @@
   #include "config.h"
 @@ -13,3 +13,24 @@ reported by Tobias Nygren.
   
   /**
    * SECTION:atomic_operations
 +@@ -682,7 +683,7 @@ gsize
 + static pthread_mutex_t g_atomic_lock = PTHREAD_MUTEX_INITIALIZER;
 + 
 + gint
 +-(g_atomic_int_get) (volatile gint *atomic)
 ++(g_atomic_int_get) (const volatile gint *atomic)
 + {
 +   gint value;
 + 
 +@@ -797,9 +798,9 @@ guint
 + 
 + 
 + gpointer
 +-(g_atomic_pointer_get) (volatile void *atomic)
 ++(g_atomic_pointer_get) (const volatile void *atomic)
 + {
 +-  volatile gpointer *ptr = atomic;
 ++  const volatile gpointer *ptr = atomic;
 +   gpointer value;
 + 
 +   pthread_mutex_lock (&g_atomic_lock);
 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/glib2/distinfo,v
 retrieving revision 1.190
 diff -u -p -r1.190 distinfo
 --- distinfo   16 Jun 2013 20:37:07 -0000      1.190
 +++ distinfo   19 Jun 2013 14:25:50 -0000
 @@ -3,7 +3,7 @@ $NetBSD: distinfo,v 1.190 2013/06/16 20:
  SHA1 (glib-2.36.3.tar.xz) = aafba69934b9ba77cc8cb0e5d8105aa1d8463eba
  RMD160 (glib-2.36.3.tar.xz) = 2db71aacc028a6d39ec5fdeacf326b7a19e8bb28
  Size (glib-2.36.3.tar.xz) = 6626972 bytes
 -SHA1 (patch-aa) = 71405ed89d2abd25edec375d52c43fe50c9f7c82
 +SHA1 (patch-aa) = 0fec82e3650f3b704c44a7f628d9bbbe4a40a3fd
  SHA1 (patch-ab) = 04bde955a2a588011a8c77ada4923d5464a0d544
  SHA1 (patch-ac) = 96e153339675457356f71e35d20375bed669d337
  SHA1 (patch-ae) = 09f16e8e14bdea3ee0e478d335f65cb66939e5f5
 @@ -11,7 +11,7 @@ SHA1 (patch-af) = 45c46d5d01517563fde21b
  SHA1 (patch-ah) = 64765bc71ed7d75ff3e47f77359ecfce63c0e851
  SHA1 (patch-aha) = 3249929122a567eec3c421a1efa0ac510f1474b7
  SHA1 (patch-ai) = 037e2bb85fbc473c431bbf736dae89825236ff31
 -SHA1 (patch-ak) = 950b7ca1e414560123b6ba56bb273baaa42364f7
 +SHA1 (patch-ak) = 7ee6d852e537d3d0cdf682816ccb2f97eee8641b
  SHA1 (patch-al) = bde29693322c568f9a4ad090f1d469de5f69920e
  SHA1 (patch-am) = 99f54927d76580dfeda2a6b1909e1bea5dbdc293
  SHA1 (patch-an) = 2d4eaa904347481bec55668e56d2ac431b567bc9
 @@ -21,7 +21,7 @@ SHA1 (patch-ba) = 1119c43d1cc6e36aeb50be
  SHA1 (patch-cb) = 56e2a9b2de04c8e528faf7ce778503fa55dcc3ac
  SHA1 (patch-cc) = f3d37cbb483863aab602f9c1209650e3e4795871
  SHA1 (patch-cd) = 312e2f322b295ddec613f9ce9760ecafeab69047
 -SHA1 (patch-ce) = ab978e9acfbfcd4e1249cbc2f9ab7e503d62a53f
 +SHA1 (patch-ce) = dc2aa070a3bc0003fce495a5fdaced35d49054e8
  SHA1 (patch-cj) = 6e5fa171080b45372af9c95ab0abfde5e90fdf57
  SHA1 (patch-ck) = 324116cc6fb8dbce8ce8d20f5b237fc469a55cd2
  SHA1 (patch-cl) = eb00468c5c5c70dd41803a2a263204686959a415
 
 ---
 Izumi Tsutsui
 


Home | Main Index | Thread Index | Old Index