NetBSD Problem Report #48608

From tsutsui@ceres.dti.ne.jp  Fri Feb 21 12:52:30 2014
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7A8D5A64AE
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 21 Feb 2014 12:52:30 +0000 (UTC)
Message-Id: <201402211252.s1LCqKVJ019569@mirage.localdomain>
Date: Fri, 21 Feb 2014 21:52:20 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@gnats.NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: textproc/icu build fails on NetBSD/m68k 6.1.3
X-Send-Pr-Version: 3.95

>Number:         48608
>Category:       pkg
>Synopsis:       textproc/icu build fails on NetBSD/m68k 6.1.3
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 21 12:55:00 +0000 2014
>Closed-Date:    Tue May 13 10:25:58 +0000 2014
>Last-Modified:  Tue May 13 10:25:58 +0000 2014
>Originator:     Izumi Tsutsui
>Release:        pkgsrc-2013Q4
>Organization:
>Environment:
System: NetBSD/luna68k and NetBSD/atari 6.1.3
Architecture: m68k
Machine: luna68k and atari
Probably more MACHINE_ARCH will be affected
>Description:
textproc/icu build on NetBSD/m68k 6.1.3 fails due to lack of
gcc's atomic ops implementation:
---
c++ -O2 -fno-reorder-blocks -fno-ipa-sra -I/usr/include -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x  -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib  -o ../../bin/makeconv makeconv.o ucnvstat.o genmbcs.o gencnvex.o -L../../lib -licutu -L../../lib -licui18n -L../../lib -licuuc -L../../stubdata -licudata -lpthread -lm  
../../lib/libicui18n.so: undefined reference to `__sync_sub_and_fetch_4'
../../lib/libicui18n.so: undefined reference to `__sync_add_and_fetch_4'
Makefile:78: recipe for target '../../bin/makeconv' failed
gmake[2]: *** [../../bin/makeconv] Error 1
gmake[2]: Leaving directory '/usr/obj.luna68k/pkgsrc/textproc/icu/work.m68k/icu/source/tools/makeconv'
Makefile:41: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 2
gmake[1]: Leaving directory '/usr/obj.luna68k/pkgsrc/textproc/icu/work.m68k/icu/source/tools'
 :
---

Most pkgsrc apps fail due to gtk2+ -> pango -> harfbuzz -> icu dependency.

>How-To-Repeat:
Build textproc/icu on NetBSD/m68k 6.1.3.

>Fix:
(1) add more #if !defined(__foo__) as patch-common_putilimp.h does for arm:
---
-#elif U_GCC_MAJOR_MINOR >= 404 || defined(__clang__)
+#elif (U_GCC_MAJOR_MINOR >= 404 && !defined(__arm__)) || defined(__clang__)
---

(2) implement necessary atomic ops using NetBSD's atomic_ops(3) functions:
---
? patches/patch-common_umutex.h
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/textproc/icu/distinfo,v
retrieving revision 1.43
diff -u -p -d -r1.43 distinfo
--- distinfo	4 Dec 2013 21:02:23 -0000	1.43
+++ distinfo	30 Jan 2014 17:03:27 -0000
@@ -10,7 +10,8 @@ SHA1 (patch-acinclude.m4) = 40ddfb09cbc9
 SHA1 (patch-ad) = 8189e81e9c624e3b7a42f9af65a4b2f334747284
 SHA1 (patch-af) = dcfbaf16844292a9ae57536ae2fb62fd1659d067
 SHA1 (patch-common_Makefile.in) = 20fa472bd0e5e5fac15153774a58a8ce034d1996
-SHA1 (patch-common_putilimp.h) = a68faa97c2bffeecaca1586e26f5bbe48e71b262
+SHA1 (patch-common_putilimp.h) = c3db0106cec42624559739882e28346741b875af
+SHA1 (patch-common_umutex.h) = a3efdb611e67880433444de7f45061d3a22fe057
 SHA1 (patch-common_unicode_platform.h) = 82786dff790782eb07cdc527061de33e771ec63c
 SHA1 (patch-common_uposixdefs.h) = abe1989ea4312702e5d0172b662409957b3e2d91
 SHA1 (patch-config_icu-config-bottom) = 168b89ee9180d4ae545125866ee91eb004010501
Index: patches/patch-common_putilimp.h
===================================================================
RCS file: /cvsroot/pkgsrc/textproc/icu/patches/patch-common_putilimp.h,v
retrieving revision 1.4
diff -u -p -d -r1.4 patch-common_putilimp.h
--- patches/patch-common_putilimp.h	5 Nov 2013 15:25:37 -0000	1.4
+++ patches/patch-common_putilimp.h	30 Jan 2014 17:03:27 -0000
@@ -13,11 +13,14 @@ $NetBSD: patch-common_putilimp.h,v 1.4 2
  #else
  #   define U_TIMEZONE timezone
  #endif
-@@ -187,7 +189,7 @@ typedef size_t uintptr_t;
+@@ -187,7 +189,10 @@ typedef size_t uintptr_t;
      /* Use the predefined value. */
  #elif U_PLATFORM == U_PF_MINGW
      #define U_HAVE_GCC_ATOMICS 0
 -#elif U_GCC_MAJOR_MINOR >= 404 || defined(__clang__)
++#elif U_PLATFORM == U_PF_BSD && defined(__NetBSD__)
++    #define U_HAVE_GCC_ATOMICS 0
++    #define U_HAVE_NETBSD_ATOMIC_OPS 1
 +#elif (U_GCC_MAJOR_MINOR >= 404 && !defined(__arm__)) || defined(__clang__)
      /* TODO: Intel icc and IBM xlc on AIX also support gcc atomics.  (Intel originated them.)
       *       Add them for these compilers.
--- /dev/null	2014-01-30 17:03:15.000000000 +0000
+++ patches/patch-common_umutex.h	2014-01-30 17:01:24.000000000 +0000
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- common/umutex.h.orig	2013-10-04 20:49:16.000000000 +0000
++++ common/umutex.h
+@@ -117,6 +117,34 @@ inline int32_t umtx_atomic_dec(u_atomic_
+ U_NAMESPACE_END
+ 
+ 
++#elif U_HAVE_NETBSD_ATOMIC_OPS
++/*
++ * NetBSD MI atomic_ops(3).
++ */
++
++U_NAMESPACE_BEGIN
++#include <sys/atomic.h>
++typedef volatile uint32_t u_atomic_int32_t;
++#define ATOMIC_INT32_T_INITIALIZER(val) val
++
++inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
++    return atomic_cas_32(&var, 0, 0);
++}
++
++inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
++    atomic_swap_32(&var, val);
++}
++
++inline int32_t umtx_atomic_inc(u_atomic_int32_t *p)  {
++   return atomic_inc_32_nv(p);
++}
++
++inline int32_t umtx_atomic_dec(u_atomic_int32_t *p)  {
++   return atomic_dec_32_nv(p);
++}
++U_NAMESPACE_END
++
++
+ #elif U_HAVE_GCC_ATOMICS
+ /*
+  * gcc atomic ops. These are available on several other compilers as well.

---

The latter is confirmed on NetBSD/m68k 6.1.3 and NetBSD/i386 6.1.3.

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: obache@NetBSD.org
State-Changed-When: Tue, 04 Mar 2014 12:08:43 +0000
State-Changed-Why:
Should be fixed in pkgsrc-HEAD.  Could you confirm it?


From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48608 CVS commit: pkgsrc/textproc/icu
Date: Tue, 4 Mar 2014 12:07:16 +0000

 Module Name:	pkgsrc
 Committed By:	obache
 Date:		Tue Mar  4 12:07:16 UTC 2014

 Modified Files:
 	pkgsrc/textproc/icu: distinfo
 	pkgsrc/textproc/icu/patches: patch-configure
 Added Files:
 	pkgsrc/textproc/icu/patches: patch-common_umutex.h patch-configure.ac

 Log Message:
 Add NetBSD MI atomic_ops support.
 Based on PR pkg/48608 by Izumi Tsutsui.


 To generate a diff of this commit:
 cvs rdiff -u -r1.43 -r1.44 pkgsrc/textproc/icu/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/textproc/icu/patches/patch-common_umutex.h \
     pkgsrc/textproc/icu/patches/patch-configure.ac
 cvs rdiff -u -r1.2 -r1.3 pkgsrc/textproc/icu/patches/patch-configure

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: obache@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/48608 (textproc/icu build fails on NetBSD/m68k 6.1.3)
Date: Tue, 4 Mar 2014 21:27:08 +0900

 > Should be fixed in pkgsrc-HEAD.  Could you confirm it?

 Well, it will take ~10 days to build icu on TT030
 (it doesn't build on 040/060 due to PR/9725)
 so I'll try it on 2014Q1.

 Probably it's worth to confirm it on (fast) NetBSD/arm.

 ---
 Izumi Tsutsui

From: "OBATA Akio" <obata@lins.jp>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/48608 (textproc/icu build fails on NetBSD/m68k 6.1.3)
Date: Wed, 05 Mar 2014 10:01:42 +0900

 On Tue, 04 Mar 2014 21:30:00 +0900, Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> wrote:

 >  Well, it will take ~10 days to build icu on TT030
 >  (it doesn't build on 040/060 due to PR/9725)

 Following may avoid the issue (or should be set as "no"?).

 Index: textproc/icu/hacks.mk
 ===================================================================
 RCS file: /cvsroot/pkgsrc/textproc/icu/hacks.mk,v
 retrieving revision 1.2
 diff -u -r1.2 hacks.mk
 --- textproc/icu/hacks.mk       7 Aug 2013 10:19:04 -0000       1.2
 +++ textproc/icu/hacks.mk       5 Mar 2014 00:58:12 -0000
 @@ -11,4 +11,10 @@
   .  endif
   .endif

 +# GNU autoconf mmap() test causes panic on 040/060
 +# PR port-m68k/9725
 +.  if ${OPSYS} == "NetBSD" && ${MACHINE_ARCH} == "m68k"
 +CONFIGURE_ENV+=         ac_cv_func_mmap_ok=yes
 +.  endif
 +
   .endif


 -- 
 OBATA Akio / obata@lins.jp

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: obache@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/48608 (textproc/icu build fails on NetBSD/m68k 6.1.3)
Date: Wed, 5 Mar 2014 21:48:33 +0900

 >  +.  if ${OPSYS} == "NetBSD" && ${MACHINE_ARCH} == "m68k"
 >  +CONFIGURE_ENV+=         ac_cv_func_mmap_ok=yes
 >  +.  endif

 The actual problem is not the mmap test but 224MB address space limit
 of 68040/060 pmap. Compiling some sources in icu requires more VA space
 than the limit and causes the "out of address space" panic mentioned
 in the PR.

 The mmap test was the easiest way to waste VA space in the past,
 but nowadays gcc actually eats much more memory..
 ---
 Izumi Tsutsui

State-Changed-From-To: feedback->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Tue, 13 May 2014 10:25:58 +0000
State-Changed-Why:
icu in pkgsrc-2014Q1 builds on NetBSD/atari 6.1.4 (in ~12 days)
and NetBSD/evbarm 6.1.4.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.