All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: lib: Fix static linking of libasound
@ 2010-12-28 21:46 Daniel Chen
  2011-01-01 15:07 ` Jaroslav Kysela
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Chen @ 2010-12-28 21:46 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 145 bytes --]

Hi,

Attached is a patch from Samuel Thibault that fixes static linking of
libasound.a (forwarded from Debian bug report #522544).

Thanks,
-Dan

[-- Attachment #2: 0001-ALSA-lib-Fix-static-linking-of-libasound.patch --]
[-- Type: text/x-diff, Size: 2845 bytes --]

From 5165bf7571e49ae950608b4eeabdc3f0620e0ce4 Mon Sep 17 00:00:00 2001
From: Daniel T Chen <crimsun@ubuntu.com>
Date: Tue, 28 Dec 2010 16:36:16 -0500
Subject: [PATCH] ALSA: lib: Fix static linking of libasound

BugLink: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522544

In Debian BTS #522544, Samuel Thibault reports that
snd_dlsym("_snd_ctl_hw_open") fails at runtime for a statically-linked
libasound and later follows up, "Actually it's worse, it's a building
design bug: .a files for sublibraries are created, and then assembled in
both a PIC .so and a static .a. The attached patch makes alsa always
include the linking tricks needed for static linking."

Here is Samuel's patch rediffed against current alsa-lib master HEAD.

Reported-and-tested-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Daniel T Chen <crimsun@ubuntu.com>
---
 include/global.h |   14 ++------------
 src/dlmisc.c     |    2 --
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/include/global.h b/include/global.h
index 3e3680f..d3a27c8 100644
--- a/include/global.h
+++ b/include/global.h
@@ -51,17 +51,8 @@ const char *snd_asoundlib_version(void);
 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
 #endif
 
-#ifdef PIC /* dynamic build */
-
 /** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
-#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
-/**
- * \hideinitializer
- * \brief Appends the build version to the name of a versioned dynamic symbol.
- */
-#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
-
-#else /* static build */
+#define __SND_DLSYM_DYN_VERSION(name, version) _ ## name ## version
 
 struct snd_dlsym_link {
 	struct snd_dlsym_link *next;
@@ -78,6 +69,7 @@ extern struct snd_dlsym_link *snd_dlsym_start;
  * \brief Appends the build version to the name of a versioned dynamic symbol.
  */
 #define SND_DLSYM_BUILD_VERSION(name, version) \
+  char __SND_DLSYM_DYN_VERSION(name, version); \
   static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
   void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
   void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
@@ -87,8 +79,6 @@ extern struct snd_dlsym_link *snd_dlsym_start;
     snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
   }
 
-#endif
-
 #ifndef __STRING
 /** \brief Return 'x' argument as string */
 #define __STRING(x)     #x
diff --git a/src/dlmisc.c b/src/dlmisc.c
index ecbbe8d..b0b23b1 100644
--- a/src/dlmisc.c
+++ b/src/dlmisc.c
@@ -34,10 +34,8 @@
 #endif
 
 #ifndef DOC_HIDDEN
-#ifndef PIC
 struct snd_dlsym_link *snd_dlsym_start = NULL;
 #endif
-#endif
 
 /**
  * \brief Opens a dynamic library - ALSA wrapper for \c dlopen.
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-03 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-28 21:46 [PATCH] ALSA: lib: Fix static linking of libasound Daniel Chen
2011-01-01 15:07 ` Jaroslav Kysela
2011-01-01 17:41   ` Daniel Chen
2011-01-01 23:42     ` Jaroslav Kysela
2011-01-03 10:50       ` Colin Guthrie
2011-01-03 17:03   ` Why is snd_pcm_hw_params_set_format() not setting the format at all? Philip Chu
2011-01-03 17:08     ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.