NetBSD Problem Report #48672
From tsutsui@ceres.dti.ne.jp Fri Mar 21 09:37:46 2014
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher ECDHE-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 72893A580F
for <gnats-bugs@gnats.NetBSD.org>; Fri, 21 Mar 2014 09:37:46 +0000 (UTC)
Message-Id: <201403210835.s2L8ZYQJ012648@mirage.localdomain>
Date: Fri, 21 Mar 2014 17:35:34 +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: devel/ruby-atomic build fails on NetBSD/m68k and other !x86 ports
X-Send-Pr-Version: 3.95
>Number: 48672
>Category: pkg
>Synopsis: devel/ruby-atomic build fails on NetBSD/m68k and !x86 other ports
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: taca
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 21 09:40:00 +0000 2014
>Closed-Date: Thu Apr 16 15:42:58 +0000 2015
>Last-Modified: Thu Apr 16 15:42:58 +0000 2015
>Originator: Izumi Tsutsui
>Release: NetBSD 6.1.3
>Organization:
>Environment:
System: NetBSD 6.1.3 (GENERIC)
Architecture: m68k
Machine: luna68k, and x68, probably also all !x86 ports
>Description:
devel/ruby-atomic depends on the gcc specific __sync_bool_compare_and_swap()
atomic function but it doesn't available on NetBSD/m68k (and probably
NetBSD/arm), as PR pkg/48608 of textproc/icu.
>How-To-Repeat:
build devel/ruby-atomic on NetBSD/m68k 6.1.3.
It will fail by:
>> #error No CAS operation available for this platform
in atomic-1.1.14/ext/atomic_reference.c.
>Fix:
The following patch make the atomic gem use NetBSD's atomic_cas_ptr(9).
(though upstream is now 1.1.15 and it has more OS specific ifdefs)
Index: devel/ruby-atomic/distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/ruby-atomic/distinfo,v
retrieving revision 1.1
diff -u -p -d -r1.1 distinfo
--- devel/ruby-atomic/distinfo 13 Sep 2013 12:59:41 -0000 1.1
+++ devel/ruby-atomic/distinfo 18 Mar 2014 12:51:36 -0000
@@ -3,3 +3,4 @@ $NetBSD: distinfo,v 1.1 2013/09/13 12:59
SHA1 (atomic-1.1.14.gem) = 255bad8a4310719d62684c6ee8cf470c2322b7e2
RMD160 (atomic-1.1.14.gem) = 59cfaa3281a9ac35e9f61e45a8a4c3102efe96e5
Size (atomic-1.1.14.gem) = 16896 bytes
+SHA1 (patch-ext_atomic__reference.c) = 34bf845a42ed784c0b1923d3c5fdb50d0214f1d8
--- /dev/null 2014-03-18 12:39:42.000000000 +0000
+++ devel/ruby-atomic/patches/patch-ext_atomic__reference.c 2014-03-16 15:46:14.000000000 +0000
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- ext/atomic_reference.c.orig 2014-03-16 15:45:20.000000000 +0000
++++ ext/atomic_reference.c
+@@ -14,6 +14,9 @@
+ #if defined(__sun)
+ #include <atomic.h>
+ #endif
++#if defined(__NetBSD__)
++#include <sys/atomic.h>
++#endif
+
+ static void ir_mark(void *value) {
+ rb_gc_mark_maybe((VALUE) value);
+@@ -67,6 +70,10 @@ static VALUE ir_compare_and_set(volatile
+ return Qtrue;
+ }
+ #endif
++#elif defined(__NetBSD__)
++ if (atomic_cas_ptr((volatile void *) &DATA_PTR(self), expect_value, new_value)) {
++ return Qtrue;
++ }
+ #elif HAVE_GCC_CAS
+ if (__sync_bool_compare_and_swap(&DATA_PTR(self), expect_value, new_value)) {
+ return Qtrue;
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->taca
Responsible-Changed-By: taca@NetBSD.org
Responsible-Changed-When: Fri, 21 Mar 2014 13:16:27 +0000
Responsible-Changed-Why:
I'll check it.
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/48672 (devel/ruby-atomic build fails on NetBSD/m68k and !x86
other ports)
Date: Mon, 21 Apr 2014 22:43:24 +0900
Here is an updated patch for recent atomic-1.1.15.
(it looks 1.1.15 no longer checks gcc's cas builtins)
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/ruby-atomic/Makefile,v
retrieving revision 1.2
diff -u -p -d -r1.2 Makefile
--- Makefile 14 Mar 2014 15:19:51 -0000 1.2
+++ Makefile 21 Apr 2014 12:13:32 -0000
@@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.2 2014/03/14 15:19:51 taca Exp $
DISTNAME= atomic-1.1.15
+PKGREVISION= 1
CATEGORIES= devel
MAINTAINER= pkgsrc-users@NetBSD.org
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/ruby-atomic/distinfo,v
retrieving revision 1.2
diff -u -p -d -r1.2 distinfo
--- distinfo 14 Mar 2014 15:19:51 -0000 1.2
+++ distinfo 21 Apr 2014 12:13:32 -0000
@@ -3,3 +3,4 @@ $NetBSD: distinfo,v 1.2 2014/03/14 15:19
SHA1 (atomic-1.1.15.gem) = 6bfba5ecf9de5da4181b705dfd08ef9f59e016a4
RMD160 (atomic-1.1.15.gem) = 9ff8b80d048c7f09e6d59b8befc1565d5bb000fe
Size (atomic-1.1.15.gem) = 16896 bytes
+SHA1 (patch-ext_atomic__reference.c) = 9db50e037a09afb10c7be0c6a2c42c95e8d606e4
--- /dev/null 2014-04-21 12:12:19.000000000 +0000
+++ patches/patch-ext_atomic__reference.c 2014-04-21 12:12:10.000000000 +0000
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Check and use NetBSD's atomic_ops(3).
+At least gcc 4.5.x for arm and m68k in NetBSD 6.x base doesn't provide
+__sync_bool_compare_and_swap().
+
+--- ext/atomic_reference.c.orig 2014-04-21 12:05:31.000000000 +0000
++++ ext/atomic_reference.c
+@@ -14,6 +14,9 @@
+ #if defined(__sun)
+ #include <atomic.h>
+ #endif
++#if defined(__NetBSD__)
++#include <sys/atomic.h>
++#endif
+
+ #ifdef HAVE_LIBKERN_OSATOMIC_H
+ #include <libkern/OSAtomic.h>
+@@ -79,6 +82,10 @@ static VALUE ir_compare_and_set(volatile
+ if (InterlockedCompareExchange((LONG*)&DATA_PTR(self), new_value, expect_value)) {
+ return Qtrue;
+ }
++#elif defined(__NetBSD__)
++ if (atomic_cas_ptr((volatile void *) &DATA_PTR(self), expect_value, new_value)) {
++ return Qtrue;
++ }
+ #else
+ if (__sync_bool_compare_and_swap(&DATA_PTR(self), expect_value, new_value)) {
+ return Qtrue;
From: "Takahiro Kambe" <taca@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48672 CVS commit: pkgsrc/devel/ruby-atomic
Date: Sun, 1 Feb 2015 13:53:50 +0000
Module Name: pkgsrc
Committed By: taca
Date: Sun Feb 1 13:53:50 UTC 2015
Modified Files:
pkgsrc/devel/ruby-atomic: Makefile PLIST distinfo
Added Files:
pkgsrc/devel/ruby-atomic/patches: patch-ext_atomic__reference.c
patch-ext_extconf.rb
Log Message:
Update ruby-atomic to 1.1.99, which is last release of ruby-atomic.
A several fixes from 1.1.15.
"This gem has been deprecated in lieu of Concurrent Ruby." from github page.
And incorporate change from PR pkg/48672.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 pkgsrc/devel/ruby-atomic/Makefile \
pkgsrc/devel/ruby-atomic/PLIST pkgsrc/devel/ruby-atomic/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/devel/ruby-atomic/patches/patch-ext_atomic__reference.c \
pkgsrc/devel/ruby-atomic/patches/patch-ext_extconf.rb
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 14 Feb 2015 10:10:06 +0000
State-Changed-Why:
Is this fixed now?
State-Changed-From-To: feedback->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Thu, 16 Apr 2015 15:42:58 +0000
State-Changed-Why:
Confirmed builds on NetBSD/evbarm 6.1.5 + pkgsrc-2015Q1.
>Unformatted:
(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.