NetBSD Problem Report #49416

From tsutsui@ceres.dti.ne.jp  Mon Nov 24 15:57:06 2014
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8522FA663A
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 24 Nov 2014 15:57:06 +0000 (UTC)
Message-Id: <201411241557.sAOFv2SR007203@mirage.localdomain>
Date: Tue, 25 Nov 2014 00:57:02 +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: pkgsrc/audio/pulseaudio build failure on NetBSD/arm 6.1.5
X-Send-Pr-Version: 3.95

>Number:         49416
>Category:       pkg
>Synopsis:       pkgsrc/audio/pulseaudio build failure on NetBSD/arm 6.1.5
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ryoon
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 24 16:00:00 +0000 2014
>Last-Modified:  Sat Dec 06 11:13:22 +0000 2014
>Originator:     Izumi Tsutsui
>Release:        NetBSD 6.1.5
>Organization:
>Environment:
System: NetBSD/evbarm 6.1.5 (HPT5325)
Architecture: arm
Machine: evbarm
>Description:
audio/pulseaudio build on NetBSD/arm 6.1.5 fails due to lack of
atomic ops implementation (log is taken from build with MAKE_JOBS=2):
---
===> Building for pulseaudio-5.0nb2

 :
  CCLD     pacat
  CCLD     pactl
/usr/obj.evbarm/pkgsrc/audio/pulseaudio/work.arm/.buildlink/lib/libjson-c.so: undefined reference to `__sync_val_compare_and_swap_4'
Makefile:6088: recipe for target 'pacat' failed
gmake[3]: *** [pacat] Error 1
gmake[3]: *** Waiting for unfinished jobs....
/usr/obj.evbarm/pkgsrc/audio/pulseaudio/work.arm/.buildlink/lib/libjson-c.so: undefined reference to `__sync_val_compare_and_swap_4'
Makefile:6103: recipe for target 'pactl' failed
gmake[3]: *** [pactl] Error 1
gmake[3]: Leaving directory '/usr/obj.evbarm/pkgsrc/audio/pulseaudio/work.arm/pulseaudio-5.0/src'
Makefile:4654: recipe for target 'all' failed
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory '/usr/obj.evbarm/pkgsrc/audio/pulseaudio/work.arm/pulseaudio-5.0/src'
Makefile:759: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory '/usr/obj.evbarm/pkgsrc/audio/pulseaudio/work.arm/pulseaudio-5.0'
Makefile:594: recipe for target 'all' failed
gmake: *** [all] Error 2
:
---

>How-To-Repeat:
Build audio/pulseaudio on NetBSD/arm 6.1.5.

>Fix:
Fix pulseaudio to use NetBSD's native atomic_ops(3) functions
(at least for 6.x and prior) as textproc/icu mentioned in PR pkg/48608?

---

>Release-Note:

>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/49416: pkgsrc/audio/pulseaudio build failure on NetBSD/arm
	 6.1.5
Date: Sat, 29 Nov 2014 01:33:51 +0900

 >   CCLD     pactl
 > /usr/obj.evbarm/pkgsrc/audio/pulseaudio/work.arm/.buildlink/lib/libjson-c.so: undefined reference to `__sync_val_compare_and_swap_4'
 > Makefile:6088: recipe for target 'pacat' failed

 As the log message said, this is not pulseaudio problem
 but textproc/json-c atomic op problem.
 textproc/json-c/patches/patch-linkhash.c is incomplete.

 The following dumb patch works around.

 ---
 $NetBSD: patch-linkhash.c,v 1.1 2014/05/10 04:09:41 pho Exp $

 - GCC < 4.1 does not have atomic builtins.
 - use NetBSD native atomic_ops(3)

 TODO: This check should really be moved to configure.ac.

 --- linkhash.c.orig	2014-04-11 00:41:08.000000000 +0000
 +++ linkhash.c
 @@ -21,6 +21,10 @@
  # include <endian.h>    /* attempt to define endianness */
  #endif

 +#if defined(__NetBSD__)
 +# include <sys/atomic.h>
 +#endif
 +
  #include "random_seed.h"
  #include "linkhash.h"

 @@ -405,7 +409,9 @@
  		int seed;
  		/* we can't use -1 as it is the unitialized sentinel */
  		while ((seed = json_c_get_random_seed()) == -1);
 -#if defined __GNUC__
 +#if defined(__NetBSD__)
 +		atomic_cas_uint((unsigned int *)&random_seed, -1, seed);
 +#elif defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 1
  		__sync_val_compare_and_swap(&random_seed, -1, seed);
  #elif defined _MSC_VER
  		InterlockedCompareExchange(&random_seed, seed, -1);

 ---
 Izumi Tsutsui

Responsible-Changed-From-To: pkg-manager->ryoon
Responsible-Changed-By: obache@NetBSD.org
Responsible-Changed-When: Sat, 06 Dec 2014 11:13:22 +0000
Responsible-Changed-Why:
Over to maintainer of textproc/json-c


>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.