[alsa-devel] [PATCH 1/3] Link arcam-av module against libpthread.

Sergey Vlasov vsu at altlinux.ru
Thu May 16 16:10:06 CEST 2013


On Thu, May 16, 2013 at 10:30:26AM +0200, Takashi Iwai wrote:
> At Wed, 15 May 2013 19:11:46 +0200,
> Jordi Mallach wrote:
> > 
> > From: Steve Langasek <steve.langasek at canonical.com>
> > 
> > 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.
> > 
> > Signed-off-by: Jordi Mallach <jordi at debian.org>
> > ---
> >  arcam-av/Makefile.am |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arcam-av/Makefile.am b/arcam-av/Makefile.am
> > index 5c7855f..eeb2e90 100644
> > --- a/arcam-av/Makefile.am
> > +++ b/arcam-av/Makefile.am
> > @@ -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?

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20130516/000011fe/attachment-0001.sig>


More information about the Alsa-devel mailing list