Weird linking trouble, autotools/libtool experts to the rescue!

Michael Nottebrock michaelnottebrock at gmx.net
Mon Aug 4 05:23:04 PDT 2003


Hi,

I've been trying to update audio/libshout2 and I've been stumbling over some
very weird behaviour. In short, it builds fine on both 4-STABLE and
5.1-RELEASE, but on 4-STABLE, the shared library isn't linked to libc_r,
causing trouble when anything else tries to link it in - despite the fact
-pthread seems to be present in all the needed places, except the cc -shared
line, which (I think) comes from libtool.

The complete portdir is available as a tarball from
http://people.freebsd.org/~lofi/ports/libshout2.tar.gz. Below are the 
highlights from the Makefile in src/ (after a build) and the respective lines 
with cc -shared (note the absence/presence of -pthread / -lc_r) and the lines 
from libtool that gave me the idea that this might be a libtool thing.

LIBTOOL:

archive_cmds="\$CC -shared \$compile_rpath \$libobjs \$deplibs \$linkopts
\${wl}-soname \$wl\$soname -o \$lib"

archive_expsym_cmds="\$CC -shared
\$compile_rpath \$libobjs \$deplibs \$linkopts \${wl}-soname \$wl\$soname
\${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"

4-STABLE:
/bin/sh ../libtool --mode=link cc -Wall -ffast-math -fsigned-char
-D_THREAD_SAFE  -I/usr/local/include -D_THREAD_SAFE -I/usr/local/include
-pthread -L/usr/local/lib -o libshout.la -rpath /usr/local/lib -version-info
3:0:0 shout.lo util.lo vorbis.lo mp3.lo net/libicenet.la
timing/libicetiming.la
avl/libiceavl.la httpp/libicehttpp.la thread/libicethread.la -L/usr/local/lib
-lvorbisrm -fr .libs/libshout.la .libs/libshout.* .libs/libshout.*

cc -shared shout.lo util.lo vorbis.lo mp3.lo -Wl,--whole-archive
net/.libs/libicenet.al timing/.libs/libicetiming.al avl/.libs/libiceavl.al
httpp/.libs/libicehttpp.al thread/.libs/libicethread.al
 -Wl,--no-whole-archive -L/usr/local/lib           -lvorbis      -lc 
 -Wl,-soname -Wl,libshout.so.3 -o .libs/libshout.so.3

DEFS = -DHAVE_CONFIG_H
DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS =
LDFLAGS = -pthread -L/usr/local/lib
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
DEP_FILES = ./$(DEPDIR)/mp3.Plo ./$(DEPDIR)/shout.Plo \
        ./$(DEPDIR)/util.Plo ./$(DEPDIR)/vorbis.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
        $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libshout_la_SOURCES)
HEADERS = $(noinst_HEADERS)

5.1-RELEASE:

/bin/sh ../libtool --mode=link cc -Wall -ffast-math -fsigned-char
-D_THREAD_SAFE  -I/usr/local/include -D_THREAD_SAFE -I/usr/local/include
-lc_r
-L/usr/local/lib -o libshout.la -rpath /usr/local/lib -version-info 3:0:0
shout.lo util.lo vorbis.lo mp3.lo net/libicenet.la timing/libicetiming.la
avl/libiceavl.la httpp/libicehttpp.la thread/libicethread.la -L/usr/local/lib
-lvorbisrm -fr .libs/libshout.la .libs/libshout.* .libs/libshout.*

cc -shared shout.lo util.lo vorbis.lo mp3.lo -Wl,--whole-archive
net/.libs/libicenet.altiming/.libs/libicetiming.al avl/.libs/libiceavl.al
httpp/.libs/libicehttpp.althread/.libs/libicethread.al -Wl,--no-whole-archive
-L/usr/local/lib-lc_r -lvorbis      -lc  -Wl,-soname -Wl,libshout.so.3 -o
.libs/libshout.so.3

DEFS = -DHAVE_CONFIG_H
DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
CPPFLAGS =
LDFLAGS = -lc_r -L/usr/local/lib
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
DEP_FILES = ./$(DEPDIR)/mp3.Plo ./$(DEPDIR)/shout.Plo \
        ./$(DEPDIR)/util.Plo ./$(DEPDIR)/vorbis.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
        $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libshout_la_SOURCES)
HEADERS = $(noinst_HEADERS)


Thanks,
--
   ,_,   | Michael Nottebrock 		    | lofi at freebsd.org
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: signature
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20030804/6ec4accb/attachment.bin


More information about the freebsd-ports mailing list