automake
[Top][All Lists]
Advanced

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

Example in libtool manual gives wrong dependencies w/ automake.


From: Nick Bowler
Subject: Example in libtool manual gives wrong dependencies w/ automake.
Date: Fri, 1 Apr 2011 10:04:21 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hello,

I'm working on a project which uses libltdl to load modules, and I've
set it up in a manner pretty similar to what's described in the libtool
manual (10.3 Linking with dlopened modules, http://xrl.us/bjk9e5).
In that section, the manual recommends to use a weak library interface.

However, the example given in the manual does not work because
the generated makefile lacks dependencies from libloader.la to
libinterface.la's objects.  Here's a simplified and complete
version of the example in the libtool manual:

  % cat >Makefile.am <<'EOF'
  lib_LTLIBRARIES = libbar.la libfoo.la

  libfoo_la_SOURCES = foo.c

  libbar_la_SOURCES = bar.c
  libbar_la_LDFLAGS = -weak libfoo.la
  libbar_la_LIBADD  = $(libfoo_la_OBJECTS)
  EOF

  % cat >configure.ac <<'EOF'
  AC_INIT([test], [1.0])

  AM_INIT_AUTOMAKE([foreign])
  AM_SILENT_RULES([yes])
  LT_INIT

  AC_CONFIG_FILES([Makefile])
  AC_OUTPUT
  EOF

  % touch foo.c bar.c

Attempting to build the above (with autoconf 2.68, automake 1.11.1 and
libtool 2.4):

  % ./configure -q && make
    CC     bar.lo
    CCLD   libbar.la
  libtool: link: `foo.lo' is not a valid libtool object
  make: *** [libbar.la] Error 1

Looking at the generated Makefile.in, we see this is because libbar.la
doesn't have any dependency on foo.lo.  We can add it to the
Makefile.am:

  libbar_la = libbar.la
  $(libbar_la): $(libfoo_la_OBJECTS)

and now it will build.  So, should automake support the example in the
libtool manual, or does the libtool manual need to be fixed?  If the
latter, is the above workaround a good one?

Thanks,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]