[Flac-dev] XMMS plugin build fix

Matt Zimmerman mdz at debian.org
Fri Jul 20 14:26:51 PDT 2001


On Fri, Jul 20, 2001 at 01:06:53PM -0700, Josh Coalson wrote:

> >  xmmsinputplugin_LTLIBRARIES = libxmms-flac.la
> >  libxmms_flac_la_SOURCES = plugin.c
> > -libxmms_flac_la_LIBADD = -L$(top_builddir)/src/libFLAC/.libs -lFLAC
> > @XMMS_LIBS@
> > +libxmms_flac_la_LIBADD = @XMMS_LIBS@
> > $(top_builddir)/src/libFLAC/libFLAC.la
> >  libxmms_flac_la_LDFLAGS = -module -avoid-version
> 
> now when I build the xmms plugin, upon linking I get:
> 
> ../../libtool-disable-static --mode=link gcc  -I./include -I
> ../../include -Wall -W -O3 -DNDEBUG -fomit-frame-pointer -funroll-loops
> -finline-functions -Winline -DFLaC__INLINE=__inline__ -g -O2
> -I/usr/include/xmms -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2
> -I/usr/lib/glib/include -D_REENTRANT -I/usr/X11R6/include  -o
> libxmms-flac.la -rpath /usr/lib/xmms/Input -module -avoid-version
> plugin.lo -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule
> -lgthread -lglib -lpthread -ldl -lXi -lXext -lX11 -lm -lxmms
> ../../src/libFLAC/libFLAC.la
> libtool-disable-static: link: error: cannot link shared libraries into
> libtool libraries
> 
> where if I revert to the old _LIBADD line things work fine.

Weird, it works here:

../../libtool-disable-static --mode=link gcc  -I./include -I ../../include -Wall -W -O3 -DNDEBUG -fomit-frame-pointer -funroll-loops -finline-functions -Winline -DFLaC__INLINE=__inline__ -g -O2 -I/usr/include/xmms -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include  -o libxmms-flac.la -rpath /usr/lib/xmms/Input -module -avoid-version plugin.lo -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm -lxmms ../../src/libFLAC/libFLAC.la 
mkdir .libs
rm -fr .libs/libxmms-flac.la .libs/libxmms-flac.* .libs/libxmms-flac.*
(cd . && ln -s plugin.lo plugin.o)
gcc -shared  plugin.lo  -Wl,--rpath -Wl,/home/mdz/src/deb/mine/upstream/flac/src/libFLAC/.libs -Wl,--rpath -Wl,/usr/local/lib  -L/usr/lib -L/usr/X11R6/lib /usr/lib/libgtk.so /usr/lib/libgdk.so -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm /usr/lib/libxmms.so ../../src/libFLAC/.libs/libFLAC.so   -Wl,-soname -Wl,libxmms-flac.so -o .libs/libxmms-flac.so
creating libxmms-flac.la
(cd .libs && rm -f libxmms-flac.la && ln -s ../libxmms-flac.la libxmms-flac.la)

The only difference in the command lines seems to be that your xmms-config
explicitly links with -lgthread, while I suppose mine lets the dynamic linker
pull it in.  The only significant difference between the old and new _LIBADD
lines is that @XMMS_LIBS@ is at the beginning in the new one.  Now that I think
about it, it really should go at the end.  I don't know if moving it will fix
the problem, but give it a try.

> Also, if I try and force -static like so:
> 
> libxmms_flac_la_LIBADD = -static @XMMS_LIBS@
> $(top_builddir)/src/libFLAC/libFLAC.la
> 
> libtool complains "you cannot use linker flags such as
> `-static' in `libxmms_flac_la_LIBADD'.  But if I leave
> -static out of Makefile.am and jam it in to the generated
> Makefile, it links fine.
> 

But won't that cause the plugin to come out statically linked?

> At this point I'm not sure what should go in there, not
> being much of a libtool guy.

Basically, you are allowed to specify object code, whether in shared or static
libraries, normal object files, libtool libraries, and libtool object files.
libtool figures out any magic that needs to be done to actually link those
objects together, and calls the linker to do the work.

To link with a normal library, you can use the -l syntax, or just specify a
path.  For libtool libraries, you should always specify a path, because .la
files won't be searched for in -l (and in this case, it is in a different
directory anyway).

-- 
 - mdz





More information about the Flac-dev mailing list