pkgsrc-Bugs archive

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

pkg/48912: audio/alsa-lib 1.0.27.2 DragonFly 3.9 maybe other OSes struct timespec, __u64, versionsort



>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:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 15 15:45:00 +0000 2014
>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



Home | Main Index | Thread Index | Old Index