NetBSD Problem Report #48912
From www@NetBSD.org Sun Jun 15 15:41:51 2014
Return-Path: <www@NetBSD.org>
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 B6D75A6543
for <gnats-bugs@gnats.NetBSD.org>; Sun, 15 Jun 2014 15:41:51 +0000 (UTC)
Message-Id: <20140615154150.200ECA654C@mollari.NetBSD.org>
Date: Sun, 15 Jun 2014 15:41:50 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: audio/alsa-lib 1.0.27.2 DragonFly 3.9 maybe other OSes struct timespec, __u64, versionsort
X-Send-Pr-Version: www-1.0
>Number: 48912
>Category: pkg
>Synopsis: audio/alsa-lib 1.0.27.2 DragonFly 3.9 maybe other OSes struct timespec, __u64, versionsort
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: ryoon
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jun 15 15:45:00 +0000 2014
>Last-Modified: Sun Dec 04 06:25:01 +0000 2016
>Originator: David Shao
>Release: DragonFly 3.9-DEVELOPMENT x86_64
>Organization:
>Environment:
DragonFly 3.9-DEVELOPMENT DragonFly v3.9.0.116.gc598b-DEVELOPMENT #3: Sat Jun 14 19:10:45 PDT 2014 xxxxx@:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64
>Description:
Using relatively recent current cvs pkgsrc on DragonFly 3.9-DEVELOPMENT x86_64 (the problem does not manifest on NetBSD 6.99.43 amd64), audio/alsa-lib fails to build with:
CC cards.lo
In file included from ../../include/local.h:136:0,
from control_local.h:22,
from cards.c:35:
../../include/sound/asound.h:407:18: error: field 'trigger_tstamp' has incomplete type
../../include/sound/asound.h:408:18: error: field 'tstamp' has incomplete type
../../include/sound/asound.h:417:18: error: field 'audio_tstamp' has incomplete type
../../include/sound/asound.h:418:35: error: invalid application of 'sizeof' to incomplete type 'struct timespec'
../../include/sound/asound.h:425:18: error: field 'tstamp' has incomplete type
../../include/sound/asound.h:427:18: error: field 'audio_tstamp' has incomplete type
../../include/sound/asound.h:594:18: error: field 'tstamp' has incomplete type
../../include/sound/asound.h:706:18: error: field 'tstamp' has incomplete type
../../include/sound/asound.h:756:18: error: field 'tstamp' has incomplete type
../../include/sound/asound.h:863:4: error: unknown type name '__u64'
../../include/sound/asound.h:897:18: error: field 'tstamp' has incomplete type
../../include/sound/asound.h:898:36: error: invalid application of 'sizeof' to incomplete type 'struct timespec'
Makefile:330: recipe for target 'cards.lo' failed
...
and if fixed later fails with:
gmake[2]: Entering directory '/usr/pkgsrc/audio/alsa-lib/work/alsa-lib-1.0.27.2/src/ucm'
CC utils.lo
CC parser.lo
parser.c: In function 'uc_mgr_scan_master_configs':
parser.c:1262:54: error: 'versionsort' undeclared (first use in this function)
parser.c:1262:54: note: each undeclared identifier is reported only once for each function it appears in
Makefile:311: recipe for target 'parser.lo' failed
>How-To-Repeat:
>Fix:
Modifying the following three patches found in patches/ allows the build to complete on DragonFly. Looking at the patches required, it would appear other non-NetBSD OSes might need to see if they require similar changes.
DragonFly needs __u64 to be defined and to #include <time.h> for struct timespec:
$NetBSD$
--- include/sound/asound.h.orig 2013-07-08 12:31:36.000000000 +0000
+++ include/sound/asound.h
@@ -23,8 +23,18 @@
#ifndef _UAPI__SOUND_ASOUND_H
#define _UAPI__SOUND_ASOUND_H
+#if defined(__linux__)
#include <linux/types.h>
-
+#else
+#include <sys/ioctl.h>
+#define __bitwise
+typedef uint32_t __u32;
+#if defined(__DragonFly__)
+#include <time.h>
+typedef uint64_t __u64;
+#endif
+typedef int __kernel_pid_t;
+#endif
/*
* protocol version
...
Only NetBSD had the check for missing versionsort applied. Other OSes might need similar treatment:
$NetBSD$
--- src/conf.c.orig 2013-07-08 12:31:36.000000000 +0000
+++ src/conf.c
@@ -426,9 +426,12 @@ beginning:</P>
#ifndef DOC_HIDDEN
-#ifdef HAVE_LIBPTHREAD
+#if defined(HAVE_LIBPTHREAD) && defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
static pthread_mutex_t snd_config_update_mutex =
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#else
+pthread_mutexattr_t attr;
+pthread_mutex_t _mutex;
#endif
struct _snd_config {
@@ -474,12 +477,22 @@ typedef struct {
static inline void snd_config_lock(void)
{
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
pthread_mutex_lock(&snd_config_update_mutex);
+#else
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&_mutex, &attr);
+#endif
}
static inline void snd_config_unlock(void)
{
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
pthread_mutex_unlock(&snd_config_update_mutex);
+#else
+ pthread_mutexattr_destroy(&attr);
+#endif
}
#else
@@ -3506,7 +3519,7 @@ int snd_config_hook_load(snd_config_t *r
int n;
#ifndef DOC_HIDDEN
-#ifdef _GNU_SOURCE
+#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__DragonFly__)
#define SORTFUNC versionsort
#else
#define SORTFUNC alphasort
...
$NetBSD$
--- src/ucm/parser.c.orig 2013-07-08 12:31:36.000000000 +0000
+++ src/ucm/parser.c
@@ -1254,7 +1254,7 @@ int uc_mgr_scan_master_configs(const cha
"%s", env ? env : ALSA_USE_CASE_DIR);
filename[MAX_FILE-1] = '\0';
-#ifdef _GNU_SOURCE
+#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__DragonFly__)
#define SORTFUNC versionsort
#else
#define SORTFUNC alphasort
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->ryoon
Responsible-Changed-By: ryoon@NetBSD.org
Responsible-Changed-When: Tue, 17 Jun 2014 00:36:17 +0000
Responsible-Changed-Why:
I am updater. I will take this.
From: David Shao <davshao@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/48912: audio/alsa-lib 1.0.27.2 DragonFly 3.9 maybe other OSes
struct timespec, __u64, versionsort
Date: Sat, 3 Dec 2016 22:23:36 -0800
I now use the following to get audio/alsa-lib to build on DragonFly
4.7-DEVELOPMENT:
diff -Nur audio/alsa-lib/Makefile audio/alsa-lib.new/Makefile
--- audio/alsa-lib/Makefile 2016-06-03 08:45:43.000000000 -0700
+++ audio/alsa-lib.new/Makefile 2016-12-03 22:09:38.095823000 -0800
@@ -27,6 +27,7 @@
CPPFLAGS.SunOS+= -D__u32=uint32_t -D__u64=uint64_t
CPPFLAGS.NetBSD+= -D__u32=uint32_t -D__u64=uint64_t
CPPFLAGS.FreeBSD+= -D__u32=uint32_t -D__u64=uint64_t
+CPPFLAGS.DragonFly+= -D__u32=uint32_t -D__u64=uint64_t
LIBS.SunOS+= -lsocket -lnsl
diff -Nur audio/alsa-lib/distinfo audio/alsa-lib.new/distinfo
--- audio/alsa-lib/distinfo 2016-06-03 08:45:43.000000000 -0700
+++ audio/alsa-lib.new/distinfo 2016-12-03 22:08:44.544679000 -0800
@@ -15,9 +15,10 @@
SHA1 (patch-bk) = 55754e4d0ac947c2e7e59b604a21fb5798ae5b39
SHA1 (patch-configure.ac) = 1c407e8a9d9ea745ab1b79175f6fc0ec6d475acc
SHA1 (patch-include_iatomic.h) = 7096f31a6b38c10b2e11a907f8431d33d98cce94
-SHA1 (patch-src_conf.c) = 432e04179798c54a76f5ce072dd9c0b79221df85
+SHA1 (patch-include_sound_asound.h) = f8c6370bde21f3f8f973f5cb01ad6f3ea43d92d4
+SHA1 (patch-src_conf.c) = 77e3a28f6f4ba9b0c2a3085d568742f144582333
SHA1 (patch-src_control_control__hw.c) =
07cfe3abe586b32f6b989403cd162599da07e865
SHA1 (patch-src_pcm_pcm__mmap.c) = 2d0f05aa53b30cef1ec083aa4f5d559d0a679058
SHA1 (patch-src_seq_seq__midi__event.c) =
2a5de492d6ca19a0f0c564e8f5a065e5fc57ea5c
SHA1 (patch-src_shmarea.c) = d6d0876ae7911ff16138bb82a3b1c79e795218cf
-SHA1 (patch-src_ucm_parser.c) = 13dc6b85281d996450c1010cec1bc6e9e87e6b3c
+SHA1 (patch-src_ucm_parser.c) = 0b48ed576ef666ea8ae3e5f07f5e3c53a0c6b373
diff -Nur audio/alsa-lib/patches/patch-include_sound_asound.h
audio/alsa-lib.new/patches/patch-include_sound_asound.h
--- audio/alsa-lib/patches/patch-include_sound_asound.h 1969-12-31
16:00:00.000000000 -0800
+++ audio/alsa-lib.new/patches/patch-include_sound_asound.h
2016-12-03 21:54:43.192418000 -0800
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- include/sound/asound.h.orig 2016-03-31 13:10:39.000000000 +0000
++++ include/sound/asound.h
+@@ -23,6 +23,10 @@
+ #ifndef _UAPI__SOUND_ASOUND_H
+ #define _UAPI__SOUND_ASOUND_H
+
++#ifdef __DragonFly__
++#include <sys/time.h>
++#endif
++
+ #if defined(__KERNEL__) || defined(__linux__)
+ #include <linux/types.h>
+ #else
diff -Nur audio/alsa-lib/patches/patch-src_conf.c
audio/alsa-lib.new/patches/patch-src_conf.c
--- audio/alsa-lib/patches/patch-src_conf.c 2016-04-15
01:47:50.000000000 -0700
+++ audio/alsa-lib.new/patches/patch-src_conf.c 2016-12-03
22:07:00.312452000 -0800
@@ -1,8 +1,6 @@
-$NetBSD: patch-src_conf.c,v 1.5 2016/04/15 08:47:50 wiz Exp $
+$NetBSD$
-* SunOS has no dirent d_type
-
---- src/conf.c.orig 2015-11-09 07:39:18.000000000 +0000
+--- src/conf.c.orig 2016-03-31 13:10:39.000000000 +0000
+++ src/conf.c
@@ -3419,11 +3419,19 @@ static int snd_config_hooks(snd_config_t
@@ -24,3 +22,12 @@
return 0;
flen = strlen(dirent->d_name);
+@@ -3549,7 +3557,7 @@ int snd_config_hook_load(snd_config_t *r
+ int n;
+
+ #ifndef DOC_HIDDEN
+-#if defined(_GNU_SOURCE) && !defined(__NetBSD__) &&
!defined(__FreeBSD__) && !defined(__sun)
++#if defined(_GNU_SOURCE) && !defined(__NetBSD__) &&
!defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__sun)
+ #define SORTFUNC versionsort
+ #else
+ #define SORTFUNC alphasort
diff -Nur audio/alsa-lib/patches/patch-src_ucm_parser.c
audio/alsa-lib.new/patches/patch-src_ucm_parser.c
--- audio/alsa-lib/patches/patch-src_ucm_parser.c 2016-04-15
01:47:50.000000000 -0700
+++ audio/alsa-lib.new/patches/patch-src_ucm_parser.c 2016-12-03
22:07:00.592459000 -0800
@@ -1,10 +1,8 @@
-$NetBSD: patch-src_ucm_parser.c,v 1.4 2016/04/15 08:47:50 wiz Exp $
+$NetBSD$
-* SunOS has no dirent d_type
-
---- src/ucm/parser.c.orig 2013-07-08 12:31:36.000000000 +0000
+--- src/ucm/parser.c.orig 2016-03-31 13:10:39.000000000 +0000
+++ src/ucm/parser.c
-@@ -1224,9 +1224,17 @@ int uc_mgr_import_master_config(snd_use_
+@@ -1234,9 +1234,17 @@ int uc_mgr_import_master_config(snd_use_
static int filename_filter(const struct dirent *dirent)
{
@@ -22,3 +20,12 @@
if (dirent->d_name[0] == '.') {
if (dirent->d_name[1] == '\0')
return 0;
+@@ -1264,7 +1272,7 @@ int uc_mgr_scan_master_configs(const cha
+ "%s", env ? env : ALSA_USE_CASE_DIR);
+ filename[MAX_FILE-1] = '\0';
+
+-#if defined(_GNU_SOURCE) && !defined(__NetBSD__) &&
!defined(__FreeBSD__) && !defined(__sun)
++#if defined(_GNU_SOURCE) && !defined(__NetBSD__) &&
!defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__sun)
+ #define SORTFUNC versionsort
+ #else
+ #define SORTFUNC alphasort
>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-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.