Re: alsa-lib: alsa.pc's Libs shouldn't contain -lm -ldl -lpthread

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

 



Takashi,

Neither patch went in without some tweaking by hand, but this could be 
mangling from email or my inexperience.  At this point, there are only two 
errors left:

rootfs/usr/lib/libasound.a(conf.o): In function 
`snd_config_update_free_global':
alsa-lib/alsa-lib-1.0.13/src/conf.c:3131: undefined reference to 
`pthread_mutex_lock'
alsa-lib/alsa-lib-1.0.13/src/conf.c:3138: undefined reference to 
`pthread_mutex_unlock'
rootfs/usr/lib/libasound.a(conf.o): In function `snd_config_update':
alsa-lib/alsa-lib-1.0.13/src/conf.c:3102: undefined reference to 
`pthread_mutex_lock'
alsa-lib/alsa-lib-1.0.13/src/conf.c:3104: undefined reference to 
`pthread_mutex_unlock'

I'm fairly confident I can follow your examples and get rid of these.   A 
very big THANK YOU! for all your help!

John

>From: Takashi Iwai <tiwai@xxxxxxx>
>To: "r10 kindsofpeople" <r10kindsofpeople@xxxxxxxxxxx>
>CC: alsa-user@xxxxxxxxxxxxxxxxxxxxx, benoit.fouet@xxxxxxxxxxxxxx
>Subject: Re:  alsa-lib: alsa.pc's Libs shouldn't contain 
>-lm	-ldl	-lpthread
>Date: Tue, 21 Nov 2006 18:49:00 +0100
>
>At Tue, 21 Nov 2006 18:18:24 +0100,
>I wrote:
> >
> > At Tue, 21 Nov 2006 09:58:01 -0600,
> > r10 kindsofpeople wrote:
> > >
> > > I'm further along on my goal, but now even more confused.
> > >
> > > Benoit's comment about 'plug-ins' sparked the thought that, since my
> > > interest is in midi, not audio, I could try --disable-pcm.  This 
>turned out
> > > to be insufficient, but combined with --disable-mixer, alsa-lib now 
>builds
> > > without the -ldl errors.
> > >
> > > This turned out to be a small victory, however.  When I try to link my
> > > application with the resulting asound library, I'm back to having 
>pthread
> > > and dl undefined references, and also snd_pcm_async among others.  The
> > > application only makes 'snd_seq*' calls, but I haven't tried tracing 
>them to
> > > see what they call.
> >
> > Does the patch below fix the references?
>
>In addition, the following patch may work for you.
>The configure checks libdl and libpthread.  Together with
>--with-softfloat option, all three libs will be disabled.
>Give it a try.
>
>
>Takashi
>
>diff -r 1c84c4d3c803 configure.in
>--- a/configure.in	Thu Nov 16 07:49:24 2006 +0100
>+++ b/configure.in	Tue Nov 21 18:44:28 2006 +0100
>@@ -147,6 +147,23 @@ else
>  else
>    AC_MSG_RESULT(no)
>  fi
>+
>+AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"])
>+AC_CHECK_LIB([pthread], [pthread_join], [HAVE_LIBPTHREAD="yes"])
>+
>+ALSA_DEPLIBS=""
>+if test "$softfloat" != "yes"; then
>+  ALSA_DEPLIBS="-lm"
>+fi
>+if test "$HAVE_LIBDL" = "yes"; then
>+  ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl"
>+  AC_DEFINE([HAVE_LIBDL], 1, [Have libdl])
>+fi
>+if test "$HAVE_LIBPTHREAD" = "yes"; then
>+  ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread"
>+  AC_DEFINE([HAVE_LIBPTHREAD], 1, [Have libpthread])
>+fi
>+AC_SUBST(ALSA_DEPLIBS)
>
>  dnl Check for architecture
>  AC_MSG_CHECKING(for architecture)
>diff -r 1c84c4d3c803 src/Makefile.am
>--- a/src/Makefile.am	Thu Nov 16 07:49:24 2006 +0100
>+++ b/src/Makefile.am	Tue Nov 21 18:24:07 2006 +0100
>@@ -41,7 +41,7 @@ libasound_la_LIBADD += alisp/libalisp.la
>  libasound_la_LIBADD += alisp/libalisp.la
>  endif
>  SUBDIRS += compat conf
>-libasound_la_LIBADD += compat/libcompat.la -lm -ldl -lpthread
>+libasound_la_LIBADD += compat/libcompat.la @ALSA_DEPLIBS@
>
>  libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS)
>
>diff -r 1c84c4d3c803 src/dlmisc.c
>--- a/src/dlmisc.c	Thu Nov 16 07:49:24 2006 +0100
>+++ b/src/dlmisc.c	Tue Nov 21 18:42:40 2006 +0100
>@@ -53,13 +53,19 @@ void *snd_dlopen(const char *name, int m
>  	if (name == NULL)
>  		return &snd_dlsym_start;
>  #else
>+#ifdef HAVE_LIBDL
>  	if (name == NULL) {
>  		Dl_info dlinfo;
>  		if (dladdr(snd_dlopen, &dlinfo) > 0)
>  			name = dlinfo.dli_fname;
>  	}
>  #endif
>+#endif
>+#ifdef HAVE_LIBDL
>  	return dlopen(name, mode);
>+#else
>+	return NULL;
>+#endif
>  }
>
>  /**
>@@ -76,7 +82,11 @@ int snd_dlclose(void *handle)
>  	if (handle == &snd_dlsym_start)
>  		return 0;
>  #endif
>+#ifdef HAVE_LIBDL
>  	return dlclose(handle);
>+#else
>+	return 0;
>+#endif
>  }
>
>  /**
>@@ -91,6 +101,7 @@ int snd_dlclose(void *handle)
>   */
>  static int snd_dlsym_verify(void *handle, const char *name, const char 
>*version)
>  {
>+#ifdef HAVE_LIBDL
>  	int res;
>  	char *vname;
>
>@@ -107,6 +118,9 @@ static int snd_dlsym_verify(void *handle
>  	if (res < 0)
>  		SNDERR("unable to verify version for symbol %s", name);
>  	return res;
>+#else
>+	return 0;
>+#endif
>  }
>
>  /**
>@@ -139,10 +153,14 @@ void *snd_dlsym(void *handle, const char
>  		return NULL;
>  	}
>  #endif
>+#ifdef HAVE_LIBDL
>  	err = snd_dlsym_verify(handle, name, version);
>  	if (err < 0)
>  		return NULL;
>  	return dlsym(handle, name);
>+#else
>+	return NULL;
>+#endif
>  }
>
>  /*
>diff -r 1c84c4d3c803 utils/alsa.pc.in
>--- a/utils/alsa.pc.in	Thu Nov 16 07:49:24 2006 +0100
>+++ b/utils/alsa.pc.in	Tue Nov 21 18:30:07 2006 +0100
>@@ -8,7 +8,7 @@ Version: @VERSION@
>  Version: @VERSION@
>  Requires:
>  Libs: -L${libdir} -lasound
>-Libs.private: -lm -ldl -lpthread
>+Libs.private: @ALSA_DEPLIBS@
>  # -I${includedir}/alsa below is just for backward compatibility
>  # (it was set so mistakely in the older version)
>  Cflags: -I${includedir} -I${includedir}/alsa

_________________________________________________________________
Stay up-to-date with your friends through the Windows Live Spaces friends 
list. 
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux