[Pkg-alsa-devel] Bug#522544: libasound2-dev: Statically linking libasound.a does not work
Samuel Thibault
samuel.thibault at ens-lyon.org
Sat Apr 18 16:06:05 UTC 2009
tags 522544 + patch
thanks
Hello,
Samuel Thibault, le Sat 04 Apr 2009 19:52:07 +0200, a écrit :
> I'm far from at ease with libtool, is that a know bug, or perhaps a
> missing bit in the alsa-lib Makefile.am?
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.
Samuel
-------------- next part --------------
--- alsa-lib-1.0.19/include/global.h 2009-01-19 12:17:18.000000000 +0100
+++ alsa-lib-1.0.19-mine/include/global.h 2009-04-18 17:52:11.000000000 +0200
@@ -51,17 +51,8 @@
#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 @@
* \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 @@
snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
}
-#endif
-
#ifndef __STRING
/** \brief Return 'x' argument as string */
#define __STRING(x) #x
--- alsa-lib-1.0.19/src/dlmisc.c 2009-01-19 12:17:18.000000000 +0100
+++ alsa-lib-1.0.19-mine/src/dlmisc.c 2009-04-18 17:47:06.000000000 +0200
@@ -32,10 +32,8 @@
#include "local.h"
#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.
More information about the Pkg-alsa-devel
mailing list