Skip to contentSkip to conversation

Debian alsa-plugins patches

PATCH In review Jordi Mallach 3 participants 9 messages May 15, 2013 – May 16, 2013

lore
Share & tools
lore
#0 lore raw

As previously discussed, I'm posting all Debian patches against alsa-plugins that were pending upstreaming

Thanks,
Jordi

#1 lore raw

PATCH 1/3 Link arcam-av module against libpthread.

From: Steve Langasek <[email protected]>

The arcam-av module uses libpthread, so it should pass -pthread explicitly when building in order to avoid leaving any undefined symbols or missing symbol versioning info.

---
 arcam-av/Makefile.am |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arcam-av/Makefile.am +1 -1
index 5c7855f..eeb2e90 100644
@@ -3,7 +3,7 @@ asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la
 asound_module_ctl_arcam_avdir = @ALSA_PLUGIN_DIR@
 
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
-AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
+AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined -pthread
 
 libasound_module_ctl_arcam_av_la_SOURCES = ctl_arcam_av.c arcam_av.c arcam_av.h
 libasound_module_ctl_arcam_av_la_LIBADD = @ALSA_LIBS@
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 1/3] Link arcam-av module against libpthread.

At Wed, 15 May 2013 19:11:46 +0200,

Quoted 17 lines · Jordi Mallach

From: Steve Langasek <[email protected]>

The arcam-av module uses libpthread, so it should pass -pthread explicitly when building in order to avoid leaving any undefined symbols or missing symbol versioning info.

---
 arcam-av/Makefile.am |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arcam-av/Makefile.am +0 -0
index 5c7855f..eeb2e90 100644

arcam-av/Makefile.am asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la · line 6

Quoted 5 lines
arcam-av/Makefile.am +1 -1
@@ -3,7 +3,7 @@ asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la
 asound_module_ctl_arcam_avdir = @ALSA_PLUGIN_DIR@
 
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
-AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
+AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined -pthread

Is AM_LDFLAGS the right place to add -lXXX? It'd work, but...

Takashi

Quoted 11 lines
arcam-av/Makefile.am +0 -0
 libasound_module_ctl_arcam_av_la_SOURCES = ctl_arcam_av.c arcam_av.c arcam_av.h
 libasound_module_ctl_arcam_av_la_LIBADD = @ALSA_LIBS@
Signature · 6 lines
1.7.10.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#3 lore raw

Re: [PATCH 1/3] Link arcam-av module against libpthread.

Quoted 21 lines · Takashi Iwai

At Wed, 15 May 2013 19:11:46 +0200,

Quoted 19 lines · Jordi Mallach

From: Steve Langasek <[email protected]>

The arcam-av module uses libpthread, so it should pass -pthread explicitly when building in order to avoid leaving any undefined symbols or missing symbol versioning info.

---
 arcam-av/Makefile.am |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arcam-av/Makefile.am +0 -0
index 5c7855f..eeb2e90 100644
@@ -3,7 +3,7 @@ asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la
 asound_module_ctl_arcam_avdir = @ALSA_PLUGIN_DIR@
 
Quoted 5 lines

arcam-av/Makefile.am asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la · line 6

Quoted 3 lines
arcam-av/Makefile.am +1 -1
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
-AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
+AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined -pthread

Is AM_LDFLAGS the right place to add -lXXX?

No - libname_LIBADD should be used for -lXXX, otherwise it will not work with -Wl,--as-needed (which is the default in some distributions). AM_LDFLAGS comes before object files on the linker command line, and all libraries must come after object files when using -Wl,--as-needed.

But note that the option here is not -lpthread, but -pthread - this option is handled by gcc internally, and -lpthread is added at the same place as -lc in the actual linker command line, so -pthread will work even in AM_LDFLAGS (at least while only C is used - libtool is known to mishandle -pthread when linking C++ shared libraries).

Also the current pthread usage in alsa-plugins is inconsistent:

$ find -name Makefile.am -print0 | xargs -r0 grep -i PTHREAD -- 
./pulse/Makefile.am:AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ $(PTHREAD_CFLAGS) $(pulseaudio_CFLAGS) -D_GNU_SOURCE
./pulse/Makefile.am:libasound_module_pcm_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
./pulse/Makefile.am:libasound_module_ctl_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
./pulse/Makefile.am:libasound_module_conf_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
./maemo/Makefile.am:libasound_module_pcm_alsa_dsp_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread 
./maemo/Makefile.am:libasound_module_ctl_dsp_ctl_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread 

PTHREAD_CFLAGS and PTHREAD_LIBS do not seem to be defined anywhere.

#4 lore raw

Re: [PATCH 1/3] Link arcam-av module against libpthread.

At Thu, 16 May 2013 18:10:06 +0400,

Quoted 34 lines · Sergey Vlasov
Quoted 21 lines · Takashi Iwai

At Wed, 15 May 2013 19:11:46 +0200,

Quoted 19 lines · Jordi Mallach

From: Steve Langasek <[email protected]>

The arcam-av module uses libpthread, so it should pass -pthread explicitly when building in order to avoid leaving any undefined symbols or missing symbol versioning info.

---
 arcam-av/Makefile.am |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arcam-av/Makefile.am +0 -0
index 5c7855f..eeb2e90 100644
@@ -3,7 +3,7 @@ asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la
 asound_module_ctl_arcam_avdir = @ALSA_PLUGIN_DIR@
 
Quoted 5 lines

arcam-av/Makefile.am asound_module_ctl_arcam_av_LTLIBRARIES = libasound_module_ctl_arcam_av.la · line 6

Quoted 3 lines
arcam-av/Makefile.am +1 -1
 AM_CFLAGS = -Wall -g @ALSA_CFLAGS@
-AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined
+AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined -pthread

Is AM_LDFLAGS the right place to add -lXXX?

No - libname_LIBADD should be used for -lXXX, otherwise it will not work with -Wl,--as-needed (which is the default in some distributions). AM_LDFLAGS comes before object files on the linker command line, and all libraries must come after object files when using -Wl,--as-needed.

Quoted 5 lines

But note that the option here is not -lpthread, but -pthread - this option is handled by gcc internally, and -lpthread is added at the same place as -lc in the actual linker command line, so -pthread will work even in AM_LDFLAGS (at least while only C is used - libtool is known to mishandle -pthread when linking C++ shared libraries).

Ah, right, I missed that.

Quoted 11 lines

Also the current pthread usage in alsa-plugins is inconsistent:

$ find -name Makefile.am -print0 | xargs -r0 grep -i PTHREAD -- 
./pulse/Makefile.am:AM_CFLAGS = -Wall -g @ALSA_CFLAGS@ $(PTHREAD_CFLAGS) $(pulseaudio_CFLAGS) -D_GNU_SOURCE
./pulse/Makefile.am:libasound_module_pcm_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
./pulse/Makefile.am:libasound_module_ctl_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
./pulse/Makefile.am:libasound_module_conf_pulse_la_LIBADD = @ALSA_LIBS@ $(PTHREAD_LIBS) $(pulseaudio_LIBS)
./maemo/Makefile.am:libasound_module_pcm_alsa_dsp_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread 
./maemo/Makefile.am:libasound_module_ctl_dsp_ctl_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread 

PTHREAD_CFLAGS and PTHREAD_LIBS do not seem to be defined anywhere.

The pthread things are actually set implicitly in alsa-lib pkgconfig or whatever, IIRC...

Takashi

#5 lore raw

PATCH 2/3 Check for and include libavutil.h to avoid unresolved symbols.

In reply to Jordi Mallach

The a52 plugin uses av_free(), but does not check for libavutil availability. Patch configure.in to check for the module, and include libavutil.h.

---
 a52/pcm_a52.c |    1 +
 configure.in  |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
a52/pcm_a52.c +1 -0
index c40aadc..75c68bd 100644
@@ -26,6 +26,7 @@
 #include <alsa/pcm_external.h>
 #include <alsa/pcm_plugin.h>
 #include AVCODEC_HEADER
+#include <libavutil/avutil.h>
 
 #if LIBAVCODEC_VERSION_MAJOR >= 53 && LIBAVCODEC_VERSION_MINOR >= 34
 #include <libavutil/audioconvert.h>
configure.in +1 -1
index 6f345f5..bf8676b 100644
@@ -67,7 +67,7 @@ AC_ARG_ENABLE([avcodec],
       AS_HELP_STRING([--disable-avcodec], [Don't build plugins depending on avcodec (a52)]))
 
 if test "x$enable_avcodec" != "xno"; then
-  PKG_CHECK_MODULES(AVCODEC, [libavcodec], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
+  PKG_CHECK_MODULES(AVCODEC, [libavcodec libavutil], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
 fi
 
 if test "x$HAVE_AVCODEC" = "xno"; then
Signature · 1 line
1.7.10.4
#6 lore raw

Re: [PATCH 2/3] Check for and include libavutil.h to avoid unresolved symbols.

At Wed, 15 May 2013 19:11:47 +0200,

Quoted 6 lines · Jordi Mallach

The a52 plugin uses av_free(), but does not check for libavutil availability. Patch configure.in to check for the module, and include libavutil.h.

Well, the unconditional inclusion of libavutil/avutil.h is not 100% correct fix, but it should be OK for 99% of systems right now, so I took it as is.

thanks,

Takashi

Quoted 38 lines
---
 a52/pcm_a52.c |    1 +
 configure.in  |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
a52/pcm_a52.c +1 -0
index c40aadc..75c68bd 100644
@@ -26,6 +26,7 @@
 #include <alsa/pcm_external.h>
 #include <alsa/pcm_plugin.h>
 #include AVCODEC_HEADER
+#include <libavutil/avutil.h>
 
 #if LIBAVCODEC_VERSION_MAJOR >= 53 && LIBAVCODEC_VERSION_MINOR >= 34
 #include <libavutil/audioconvert.h>
configure.in +1 -1
index 6f345f5..bf8676b 100644
@@ -67,7 +67,7 @@ AC_ARG_ENABLE([avcodec],
       AS_HELP_STRING([--disable-avcodec], [Don't build plugins depending on avcodec (a52)]))
 
 if test "x$enable_avcodec" != "xno"; then
-  PKG_CHECK_MODULES(AVCODEC, [libavcodec], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
+  PKG_CHECK_MODULES(AVCODEC, [libavcodec libavutil], [HAVE_AVCODEC=yes], [HAVE_AVCODEC=no])
 fi
 
 if test "x$HAVE_AVCODEC" = "xno"; then
Signature · 6 lines
1.7.10.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#7 lore raw

PATCH 3/3 Add AM_MAINTAINER_MODE([enable]) to configure.in.

In reply to Jordi Mallach
---
 configure.in |    2 ++
 1 file changed, 2 insertions(+)
configure.in +2 -0
index bf8676b..abc7013 100644
@@ -3,6 +3,8 @@ AC_INIT(oss/pcm_oss.c)
 AM_INIT_AUTOMAKE(alsa-plugins, 1.0.27)
 AC_PREFIX_DEFAULT(/usr)
 
+AM_MAINTAINER_MODE([enable])
+
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_MACRO_DIR([m4])
 
Signature · 1 line
1.7.10.4