[Top][All Lists]

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

gnulib-tool and shared libraries (was: Re: libposix)

From: Bruno Haible
Subject: gnulib-tool and shared libraries (was: Re: libposix)
Date: Tue, 5 Oct 2010 03:31:57 +0200
User-agent: KMail/1.9.9

Hi Bruce,

> On Mon, Oct 4, 2010 at 12:55 PM, Bruno Haible <address@hidden> wrote:
> > $ for m in `./posix-modules` ; do ./gnulib-tool --extract-link-directive $m 
> > ; done
> [...]
> > $(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise
> It seems that ``--extract-link-directive'' thinks it is sending output
> to a human.

Yes. The format of the link directive is documented here:

> Obviously, I can parse this output, but if it presumes a human reader,
> someone could change the output in unpredictable ways.
> Perhaps pay attention to "--libtool" and "--no-libtool" for it?
> Such that this works for my purpose:
> for m in $(posix-modules)
> do gnulib-tool --libtool --extract-link-directive $m
> done > libadd-list
> It should also not be necessary to remove empty lines.

Actually, this should be the default when --libtool was specified. Like
Eric said, '-no-undefined' is necessary for creating shared libraries on
some platforms (such as Cygwin and AIX). And '-no-undefined' in turn requires
that the dependencies are specified on the command line.

I'm applying this fix.

It also fixes a build failure of libunistring, when that is configured
with --enable-threads=pth --with-libpth-prefix=... on MacOS X. It failed like
  Undefined symbols:
    "_pth_mutex_release", referenced from:
        _libunistring_gl_locale_name_thread in localename.o
    "_pth_mutex_acquire", referenced from:
        _libunistring_gl_locale_name_thread in localename.o
    "_pth_once", referenced from:
        _libunistring_glthread_once_multithreaded in lock.o
  ld: symbol(s) not found
  collect2: ld returned 1 exit status
  make[3]: *** [libunistring.la] Error 1

2010-10-04  Bruno Haible  <address@hidden>

        gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
        * gnulib-tool (func_emit_lib_Makefile_am): When preparing for a libtool
        library, put '-no-undefined' and the link dependencies into _LDFLAGS.
        Reported by Bruce Korb and Eric Blake.

--- gnulib-tool.orig    Tue Oct  5 02:24:42 2010
+++ gnulib-tool Tue Oct  5 02:18:49 2010
@@ -2931,6 +2931,18 @@
   echo "EXTRA_${libname}_${libext}_SOURCES ="
   if test "$libtool" = true; then
     echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
+    echo "${libname}_${libext}_LDFLAGS += -no-undefined"
+    # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
+    # the link dependencies of all modules.
+    for module in $modules; do
+      func_verify_nontests_module
+      if test -n "$module"; then
+        func_get_link_directive "$module"
+      fi
+    done \
+      | LC_ALL=C sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
+      | LC_ALL=C sort -u \
+      | LC_ALL=C sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
   if test -n "$pobase"; then

reply via email to

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