bug-gnulib
[Top][All Lists]
Advanced

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

Re: C++ libtool build error?


From: Bruno Haible
Subject: Re: C++ libtool build error?
Date: Fri, 12 Mar 2010 13:15:14 +0100
User-agent: KMail/1.9.9

Hi Simon, Ludo,

> > /bin/bash ../libtool --preserve-dup-deps  --mode=link g++     -o 
> > test-fcntl-h-c++ test-fcntl-h-c++.o libtests.a ../gl/libgnu.la libtests.a   
> >  
> > libtool: link: unable to infer tagged configuration
> > libtool: link: specify a tag with `--tag'
> > make[4]: *** [test-fcntl-h-c++] Error 1
> > make[4]: Leaving directory `/home/jas/src/libidn/gltests'
> 
> For the record, it also breaks “make check” in libunistring with current
> Gnulib:

Thanks for mentioning this. In libunistring, it is easier to reproduce for me.

The problem is that this piece of libtool documentation (from libtool 2.2.6,
node 'Tags') is incorrect:

       `libtool' tries to automatically infer which tag to use from the
    compiler command being used to compile or link.  If it can't infer a
    tag, then it defaults to the configuration for the `C' language.

       The tag can also be specified using `libtool''s `--tag=TAG' option
    (*note Invoking libtool::).  It is a good idea to do so in `Makefile'
    rules, because that will allow users to substitute the compiler without
    relying on `libtool' inference heuristics.  When no tag is specified,
    `libtool' will default to `CC'; this tag always exists.

This is correct if the configure.ac file contains no invocation of
LT_LANG. However, if configure.ac contains an LT_LANG invocation, and
you don't pass a --tag option, then libtool may bail out with the error
"unable to infer tagged configuration" mentioned above. You find this
behaviour implemented in libtool's 'func_infer_tag' function, right at
the beginning:
  if test -n "$available_tags" && test -z "$tagname"; then

And libunistring indeed has an LT_LANG invocation:
  LT_LANG([Windows Resource])

The libtool command line is synthetized by 'automake'. Automake
apparently defines
  CXXLINK = $(LIBTOOL) $(AM_LIBTOOLFLAGS) ...
by default, and
  CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) ...
if it has spotted an LT_LANG([CXX]) invocation.

So, the fix is to add an LT_LANG([CXX]) invocation to your configure.ac.
This fixes it for libunistring. It does not hurt to use it in the testdirs
as well, so I'm committing this:


2010-03-12  Bruno Haible  <address@hidden>

        Fix problem with automake's definition of CXXLINK.
        * gnulib-tool (func_create_testdir): After LT_INIT, also use LT_LANG.
        Reported by Simon Josefsson and Ludovic Courtès.

--- gnulib-tool.orig    Fri Mar 12 13:00:12 2010
+++ gnulib-tool Fri Mar 12 12:55:53 2010
@@ -4637,6 +4637,7 @@
        | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
      if test "$libtool" = true; then
        echo "LT_INIT([win32-dll])"
+       echo "LT_LANG([C++])"
        echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
        echo "gl_cond_libtool=true"
      else
@@ -4761,6 +4762,7 @@
      | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
    if test "$libtool" = true; then
      echo "LT_INIT([win32-dll])"
+     echo "LT_LANG([C++])"
      echo "AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
      echo "gl_cond_libtool=true"
    else




reply via email to

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